Zixuan 13 часов назад
Родитель
Сommit
e20def5b42

+ 1 - 0
EEMSCenterUI/Views/MainWindow.xaml

@@ -54,6 +54,7 @@
                 <Button Command="{Binding StartServiceCommand}">Start Service</Button>
                 <TextBox Text="{Binding GUID}"/>
                 <Button Command="{Binding RequestFileCommand}">Request File</Button>
+                <Button Command="{Binding SendFileCommand}">Send File</Button>
             </StackPanel>
 
             <ItemsControl ItemsSource="{Binding Clients}" Grid.Row="2">

+ 1 - 0
Server/EEMSClientCore/HubBase.cs

@@ -28,6 +28,7 @@ public partial class ClientCaller(IClientBaseProvider baseProvider) : IDisposabl
             .Build();
 
         temp.On<Guid, FileType>("RequestFile", _clientProvider.RequestFile);
+        temp.On<Guid, FileType, byte[], int, int>("PushFile", _clientProvider.PushFile);
 
         for (int i = 1; i <= retry; i++)
         {

+ 2 - 2
Server/EEMSService/HubSender/ClientCaller.cs

@@ -101,7 +101,7 @@ public class ClientCaller : IClientProvider
         if (string.IsNullOrEmpty(name))
             return Task.FromResult(false);
 
-        if (ClientManager.DeviceClients.TryGetValue(guid, out ISingleClientProxy? client) || client is null)
+        if (!ClientManager.DeviceClients.TryGetValue(guid, out ISingleClientProxy? client) || client is null)
             return Task.FromResult(false);
 
         try
@@ -122,6 +122,6 @@ public class ClientCaller : IClientProvider
 
     Task<bool> IClientProvider.PushFile(Guid guid, FileType fileType, byte[] buffer, int current, int total)
     {
-        return this.SendAsync(guid, "ReceivedFile", guid, fileType, buffer, current, total);
+        return this.SendAsync(guid, "PushFile", guid, fileType, buffer, current, total);
     }
 }