2

我有一个使用服务加密文件的软件。GUI 序列化包含文件路径的哈希表,然后使用该ExecuteCommand方法通知服务。该服务反序列化哈希表并处理文件。

我需要该服务以某种方式告诉 GUI 它已完成处理,以便 GUI 可以显示某种形式的通知。服务将数据发送到 GUI 的最佳方式是什么?此外,如果有人可以替代我当前将文件路径发送到服务的方法,我愿意接受建议。

编辑:这就是我现在正在做的事情:

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

服务Processing完成后将注册表值更改为 0。

4

1 回答 1

1

命名管道应该可以正常工作。这里有一些信息:

http://msdn.microsoft.com/en-us/library/bb546085.aspx

于 2013-01-20T04:57:10.027 回答