Hi,
A quicke summarize:
I made a windows form that can set up a socket connection. It also has
events that fire when data arives. Now I am using this form in a hidden
way inside other code (was the only way I could get the threading to
work for the client without the client needing to test for thread save
stuff) It works in several programs (perfectly), but in a Windows
Services it doesn't fire the event. I used debug lines to check what
went on, it gets to the fireing of the event akts normal (no error) but
the event doesn't get fired.
When I insert this into a windows form I can access the GUI without
getting a conflict about accessing a GUI element from a different thread
than the creator.
private void ServerDataReceived(string Message)
{
if (InvokeRequired)
{
object[] pList = { Message };
ReceivedDataTextBox.BeginInvoke(new
UpdateServerCallback(DoServerDataReceived), pList);
}
else
{
DoServerDataReceived(Message);
}
}
private void DoServerDataReceived(string Message)
{
ReceivedDataTextBox.Text = Message;
if (OnMessageReceivedFromServer != null)
{
OnMessageReceivedFromServer(this, Message); <-- It just walks over this
line, no error no event ...
}
else
{
Log.LogError("No one is listening to OnMessageReceivedFromServer");
}
}
If anybody know what goes on here or can help me find out what to check,
please :)
-Mark
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com