活跃的mq Artemis转移伐木(Active mq Artemis divert logging)
有没有办法记录有效的mq Artemis转移? 那么你可以看到哪个转移应用于给定的消息? 我似乎无法在文档中找到这个。
Is there a way to log active mq Artemis diverts? So you can see which divert was applied to a given message? I can't seem to find this in the docs.
原文:https://stackoverflow.com/questions/48372892
最满意答案
这里有一些问题。
首先,您没有正确使用Thread类, 请查看本教程以开始使用
即使您确实更正了Thread类的使用,您要么最终阻止UI线程,要么最终会遇到跨线程异常。
在这种情况下,您可能最简单的方法是使用DispatcherTimer
public MainPage() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) }; timer.Tick += new EventHandler(timer_Tick); SetImageSource(); timer.Start(); } void timer_Tick(object sender, EventArgs e) { SetImageSource(); } void SetImageSource() { int hour = DateTime.Now.Hour; if (hour % 10 == 0) imag1.Source = new BitmapImage(new Uri("img/knapTaand.png", UriKind.Relative)); else imag1.Source = new BitmapImage(new Uri("img/knapSluk.png", UriKind.Relative)); }
There are a few problems here.
First you are not using the Thread class correctly, check this tutorial to get started
Even when you do correct your usage of the Thread class, you are either going to end up blocking the UI Thread, or you will end up with a Cross-Thread exception.
In this case, perhaps the easiest way for you to achieve what you want is to use a DispatcherTimer
public MainPage() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) }; timer.Tick += new EventHandler(timer_Tick); SetImageSource(); timer.Start(); } void timer_Tick(object sender, EventArgs e) { SetImageSource(); } void SetImageSource() { int hour = DateTime.Now.Hour; if (hour % 10 == 0) imag1.Source = new BitmapImage(new Uri("img/knapTaand.png", UriKind.Relative)); else imag1.Source = new BitmapImage(new Uri("img/knapSluk.png", UriKind.Relative)); }
相关问答
更多-
是的,在.NET平台上使用C#创建GUI非常容易。 为了您的目的。 您将需要以下类/控件: 形成 的MenuStrip 工具条 StatusStrip中 DataView的/的DataGridView 文本框 标签 的TabControl TabPage的 图片框 按键 和其他人(你需要弄清楚)。 只需在MSDN中浏览这些类(你会在那里找到很多例子)。 如果你想快速启动。 否则我得到一本好书,有坚实的基础。 Yeah its very easy to create GUI using C# on .NET ...
-
解决了: 问题似乎是,该事件立即被触发但文件尚未最终复制。 这意味着我们必须等到文件空闲。 事件开始时的Thread.Sleep(100)完成工作。 我现在知道谷歌的用途,我找到了两个链接: 这个和这个你可以找到: 创建文件后立即引发OnCreated事件。 如果正在将文件复制或传输到监视目录中,则会立即引发OnCreated事件,然后是一个或多个OnChanged事件 因此,对我的情况最有效的方法是包括一个方法来测试文件是否仍然被锁定,而不是在事件开始时等待解锁文件。 无需额外的线程或Background ...
-
这里有一些问题。 首先,您没有正确使用Thread类, 请查看本教程以开始使用 即使您确实更正了Thread类的使用,您要么最终阻止UI线程,要么最终会遇到跨线程异常。 在这种情况下,您可能最简单的方法是使用DispatcherTimer public MainPage() { InitializeComponent(); DispatcherTimer timer = new DispatcherTimer() { Interval = TimeSpan.FromHours(1) }; ...
-
如何使用Datagridview绑定源C#更新SQL Server数据库(How to update SQL Server database using Datagridview binding source C#)[2023-04-21]
在不调用bindingSource1.EndEdit您的基础DataTable看不到任何更改,因此Update命令无需更新。 private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e) { bindingSource1.EndEdit(); DataTable dt = (DataTable)bindingSource1.DataSource; // Just for test ... -
Beautifulsoup没有img(Beautifulsoup no img)[2023-06-28]
通过id获取图片。 要加入URL部分,请使用urlparse.urljoin() : base_url = 'http://www.weatheronline.co.uk' print urljoin(base_url, soup.find('img', id='pictureid')['src']) Get the pictures by id. To join URL parts, use urlparse.urljoin(): base_url = 'http://www.weatheronline ... -
您可能需要为C项目创建托管代码包装器,以便可以从C#访问它。 请参阅此前提出的问题:将C ++移植(非托管)到C#与在C#应用程序中使用C ++作为DLL You are probably going to need to create a managed code wrapper for your C project so that it can be accessed from C#. See this previously asked question: Porting (unmanaged) C++ ...
-
pushbutton1_Callback和pushbutton2_Callback是projetGUI_OpeningFcn嵌套函数吗? 如果没有,那么是的, img仅存在于projetGUI_OpeningFcn的工作空间中, projetGUI_OpeningFcn存在于其他两个函数的工作空间中。 一个可能的解决方法是在projetGUI_OpeningFcn和guidata(hObject, handles);使用handles.img而不是img guidata(hObject, handles); ...
-
C#自定义列表框GUI(C# custom listbox GUI)[2022-12-14]
让你的列表项目实现一个接口,提供显示所需的所有内容: public interface IDisplayItem { event System.ComponentModel.ProgressChangedEventHandler ProgressChanged; string Subject { get; } string Description { get; } // Provide everything you need for the display here } 传 ... -
C# - 使用委托从另一个线程更新GUI datagridview(C# - Update GUI datagridview from another thread using delegate)[2023-11-06]
确保您的对象彼此通信:您的myOtherClass将不得不知道AcquireForm对象 - 您不能只创建一个新对象(如您所发现的那样)。 您需要将AcquireForm 对象传递给myOtherClass 对象 (例如myOtherObject.SetForm(myAcquireForm)),并在需要时引用它。 如果你遇到调用问题可能会有所帮助 - 我如何调用“下一步”按钮点击: BeginInvoke(new Action(()=>button_next_Click(null,null))); 此外, ... -
获得img的价值(Getting the value of an img)[2022-01-17]
value是一个只能应用于表单元素的属性,如input 。 如果要获取简单属性,请使用name 。 value is an attribute that can only be applied to form elements, like input. If you want to get a simple attribute, use name.