mardi 7 avril 2015

How can I send a string From my window service to my desktop application to trigger my gui?

I want to send a piece of message from my window service. That piece of message will be sent from my STOP() service function. I want to send this message to my desktop application which has a GUI. I want to trigger that GUI on receiving the message.


There are several posts which tells about named pipes, tcp binding. But here i am looking for something very simple , easy and quick to implement .


Thanks in Advance


Updated My QUESTION : PLEASE READ IT BEFORE DOWN VOTING


I already created a web service which bring from my CRM 2013 and insert it into a SQL database. This service keeps on checking for any new records. But sometimes it stops. And i want to display a clear Flashy Warning to my client that the service is not working at this moment. I have read on the internet that you cant interact with GUI after Window Vista . Many solutions suggests of making an independent application which i don't want to do . So my question any other way of doing this ? I need help code for my webservice



enter code here

protected override void OnStop()
{
FileStream fs = new FileStream(@"e:\temp\mcWindowsService.txt",
FileMode.OpenOrCreate, FileAccess.Write);
StreamWriter m_streamWriter = new StreamWriter(fs);
m_streamWriter.BaseStream.Seek(0, SeekOrigin.End);
m_streamWriter.WriteLine(" mcWindowsService: Service Stopped \n"); m_streamWriter.Flush();
m_streamWriter.Close();

// my code




}

Aucun commentaire:

Enregistrer un commentaire