| 
															
																@@ -1,5 +1,6 @@ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using CommunityToolkit.Mvvm.ComponentModel; 
															 | 
															
															 | 
															
																 using CommunityToolkit.Mvvm.ComponentModel; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using CommunityToolkit.Mvvm.Input; 
															 | 
															
															 | 
															
																 using CommunityToolkit.Mvvm.Input; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+using EEMSUIClient.Models; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using EEMSUIClient.Services; 
															 | 
															
															 | 
															
																 using EEMSUIClient.Services; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using GeneralData; 
															 | 
															
															 | 
															
																 using GeneralData; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 using System.IO; 
															 | 
															
															 | 
															
																 using System.IO; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -12,7 +13,8 @@ public partial class MainWindowViewModel : ObservableObject 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 { 
															 | 
															
															 | 
															
																 { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     private readonly IClientService _clientService; 
															 | 
															
															 | 
															
																     private readonly IClientService _clientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    private readonly string jsonFilePath = $"{Environment.CurrentDirectory}/DeviceInformation.json"; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    private readonly string _ipAddressFilePath = $"{Environment.CurrentDirectory}/IpAddressInformation.json"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    private readonly string _deviceInfoFilePath = $"{Environment.CurrentDirectory}/DeviceInformation.json"; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     private bool _isInitialized = false; 
															 | 
															
															 | 
															
																     private bool _isInitialized = false; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																     [ObservableProperty] 
															 | 
															
															 | 
															
																     [ObservableProperty] 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -58,8 +60,8 @@ public partial class MainWindowViewModel : ObservableObject 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     public MainWindowViewModel(IClientService clientService) 
															 | 
															
															 | 
															
																     public MainWindowViewModel(IClientService clientService) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     { 
															 | 
															
															 | 
															
																     { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         _clientService = clientService; 
															 | 
															
															 | 
															
																         _clientService = clientService; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        _clientService.RequestFileReceived += OnRequestFileReceived; 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        Initialize(); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        InitializeIpAddress(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        InitializeDeviceInfo(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																     public bool IsNotConnected => !IsConnected; 
															 | 
															
															 | 
															
																     public bool IsNotConnected => !IsConnected; 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -82,6 +84,15 @@ public partial class MainWindowViewModel : ObservableObject 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																         IsConnected = true; 
															 | 
															
															 | 
															
																         IsConnected = true; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        var addressInfo = new AddressInfo() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            Ip= IpAddress, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            Port=int.Parse(Port), 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            HubName=HubName, 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        }; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        string jsonString = JsonSerializer.Serialize(addressInfo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        File.WriteAllText(_ipAddressFilePath, jsonString); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																     [RelayCommand] 
															 | 
															
															 | 
															
																     [RelayCommand] 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -122,8 +133,8 @@ public partial class MainWindowViewModel : ObservableObject 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             GuidStr = guid.ToString(); 
															 | 
															
															 | 
															
																             GuidStr = guid.ToString(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             MessageBox.Show("设备注册成功。"); 
															 | 
															
															 | 
															
																             MessageBox.Show("设备注册成功。"); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            string jsonString = JsonSerializer.Serialize(deviceInfo); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-            File.WriteAllText(jsonFilePath, jsonString); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            var jsonString = JsonSerializer.Serialize(deviceInfo); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            File.WriteAllText(_deviceInfoFilePath, jsonString); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         catch (Exception ex) 
															 | 
															
															 | 
															
																         catch (Exception ex) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         { 
															 | 
															
															 | 
															
																         { 
															 | 
														
													
												
											
												
													
														
															 | 
															
																@@ -131,14 +142,33 @@ public partial class MainWindowViewModel : ObservableObject 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     } 
															 | 
															
															 | 
															
																     } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-    private void Initialize() 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    private void InitializeIpAddress() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (!Path.Exists(_ipAddressFilePath)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        string jsonFromFile = File.ReadAllText(_ipAddressFilePath); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        var deserializedAddressInfo = JsonSerializer.Deserialize<AddressInfo>(jsonFromFile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (deserializedAddressInfo is null) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+            return; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        IpAddress = deserializedAddressInfo.Ip; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        Port = deserializedAddressInfo.Port.ToString(); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        HubName = deserializedAddressInfo.HubName; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+ 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+    private void InitializeDeviceInfo() 
															 | 
														
													
												
													
														
															| 
															 | 
															
																     { 
															 | 
															
															 | 
															
																     { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        if (!Path.Exists(jsonFilePath)) 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        if (!Path.Exists(_deviceInfoFilePath)) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         { 
															 | 
															
															 | 
															
																         { 
															 | 
														
													
												
													
														
															| 
															 | 
															
																             return; 
															 | 
															
															 | 
															
																             return; 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         } 
															 | 
															
															 | 
															
																         } 
															 | 
														
													
												
													
														
															| 
															 | 
															
																  
															 | 
															
															 | 
															
																  
															 | 
														
													
												
													
														
															| 
															 | 
															
																-        string jsonFromFile = File.ReadAllText(jsonFilePath); 
															 | 
															
															 | 
															
																 
															 | 
														
													
												
													
														
															| 
															 | 
															
																 
															 | 
															
															 | 
															
																+        string jsonFromFile = File.ReadAllText(_deviceInfoFilePath); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         var deserializedDeviceInfo = JsonSerializer.Deserialize<Models.DeviceInfo>(jsonFromFile); 
															 | 
															
															 | 
															
																         var deserializedDeviceInfo = JsonSerializer.Deserialize<Models.DeviceInfo>(jsonFromFile); 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         if (deserializedDeviceInfo is null) 
															 | 
															
															 | 
															
																         if (deserializedDeviceInfo is null) 
															 | 
														
													
												
													
														
															| 
															 | 
															
																         { 
															 | 
															
															 | 
															
																         { 
															 |