I have a software that uses a service to encrypt files. The GUI serializes a hashtable containing the file paths, then uses the ExecuteCommand method to notify the service. The service deserializes the hashtable and processes the files.
What I need for the service to do is somehow tell the GUI that it’s done processing so the GUI can display some form of notification. What would be the best way for the service to send the data to the GUI? Also if anyone has an alternative to my current method of sending file paths to a service, I am open to suggestions.
EDIT:
This is what I am doing now:
Dim sk = My.Computer.Registry.LocalMachine.CreateSubKey("SOFTWARE\AesESvc")
Dim scAES As New ServiceProcess.ServiceController("AesESvc")
sk.SetValue("Processing", 1, Microsoft.Win32.RegistryValueKind.DWord)
scAES.ExecuteCommand(132)
Do While (sk.GetValue("Processing") = 1)
sblProcess.Text = "Processing"
Loop
Dim total As Int32 = lvwLoad.Items.Count - sk.GetValue("ErrorsInLastProcess")
If total > 1 Then
sblProcess.Text = (total & " items successfully processed." & vbCrLf & sk.GetValue("ErrorsInLastProcess") & " error(s)")
ElseIf total = 1 Then
sblProcess.Text = (total & " item successfully processed." & vbCrLf & sk.GetValue("ErrorsInLastProcess") & " error(s)")
ElseIf total < 1 Then
sblProcess.Text = ("None of the items could be processed." & vbCrLf & sk.GetValue("ErrorsInLastProcess") & " error(s)")
End If
The service changes the Processing registry value to 0 when it is finished.
Named pipes should work well. Here’s some information:
http://msdn.microsoft.com/en-us/library/bb546085.aspx