R
RedLars
Hi,
How can I make sure that the m_eventHandler code is executed in the
context of the UI thread given that the NotifySubscriber can be called
from a worker thread? This code is ran in .NET 3.5. Notice that the
class does not derive from either Form or Windows class.
internal class MyClass
{
private Action<string, int> m_eventHandler;
private string m_text;
private int m_int;
internal MyClass(Action<string, int> eventHandler)
{
m_eventHandler = eventHandler;
}
private void NotifySubscriber()
{
if (m_eventHandler != null)
{
m_eventHandler(m_text, m_int);
}
}
}
How can I make sure that the m_eventHandler code is executed in the
context of the UI thread given that the NotifySubscriber can be called
from a worker thread? This code is ran in .NET 3.5. Notice that the
class does not derive from either Form or Windows class.
internal class MyClass
{
private Action<string, int> m_eventHandler;
private string m_text;
private int m_int;
internal MyClass(Action<string, int> eventHandler)
{
m_eventHandler = eventHandler;
}
private void NotifySubscriber()
{
if (m_eventHandler != null)
{
m_eventHandler(m_text, m_int);
}
}
}