Click here to Skip to main content
15,885,365 members

Comments by CSharpNewbie 2 (Top 11 by date)

CSharpNewbie 2 11-Apr-15 22:15pm View    
Deleted
I made sure, that I first ran the Windows Forms application and then I started my service. As per my understanding, Windows forms application is supposed to create the "MyEventName" and windowsService should open that MyEventName. Correct me if I am wrong
CSharpNewbie 2 11-Apr-15 22:00pm View    
I moved the same question below...I also updated it with the exception.System.Threading.WaitHandleCannotBeOpenedException
CSharpNewbie 2 11-Apr-15 21:47pm View    
Thank you Sergey, I am trying to signal a windows forms application from a Windows Service using the named events. I understand AutoResetEvents and ManualResetEvents are mainly used for thread synchronization, but now I have a requirement to use named events to signal a Windows Forms application. After reading your comment I started looking into EventWaitHandler and modifed my code and Here it is

Windows Service Code:

public void SetSignalToClient()
{

System.Threading.EventWaitHandle wh = EventWaitHandle.OpenExisting("MyEventName", EventWaitHandleRights.Modify);

wh.Set();
}

Windows Forms Application:
public void ReceiveSignalFromClient()
{
textBox1.Text = "Successful";
while (true)
{
EventWaitHandle wh = new EventWaitHandle(false, EventResetMode.AutoReset, "MyEventName");
wh.WaitOne();
textBox1.Text = "Failed";
}

}

But, my service is crashing with an exception. Please let me know if I am missing something.In Event Viewer I found the exception as: System.Threading.WaitHandleCannotBeOpenedException
CSharpNewbie 2 14-Oct-14 16:08pm View    
Thanks for the link, but I Dont think our management is planing to upgrade the game to XNA 4.0
CSharpNewbie 2 6-Oct-14 2:46am View    
Awesome Sinisa Hajnal. It worked. Thank you. I was thinking all the references would been loaded in the beginning, so why does the order so important?