diff --git a/StartServerWPF.Modules.Main/ViewModels/DataProcessViewModel.cs b/StartServerWPF.Modules.Main/ViewModels/DataProcessViewModel.cs index 1324bb9..84fdce5 100644 --- a/StartServerWPF.Modules.Main/ViewModels/DataProcessViewModel.cs +++ b/StartServerWPF.Modules.Main/ViewModels/DataProcessViewModel.cs @@ -88,9 +88,8 @@ namespace StartServerWPF.Modules.Main.ViewModels } catch (Exception ex) { - MessageBox.Show("加载配置失败,"+path); + MessageBox.Show($"加载配置失败,路径:{path},错误:{ex}"); } - } SetProperty(ref _wareaSelectedIndex, value); } @@ -276,8 +275,8 @@ namespace StartServerWPF.Modules.Main.ViewModels { ApmsEventSource.Clear(); } - var fileName = Directory.GetFiles(SavePath, "*.index", SearchOption.AllDirectories); + var fileName = Directory.GetFiles(SavePath, "*.index", SearchOption.AllDirectories); foreach (var file in fileName) { bool flag= DateTime.TryParseExact(Path.GetFileNameWithoutExtension(file), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture, @@ -289,7 +288,6 @@ namespace StartServerWPF.Modules.Main.ViewModels File.Delete(file); } } - } Task.Run(() => diff --git a/StartServerWPF.Modules.Main/WebsocketClient.cs b/StartServerWPF.Modules.Main/WebsocketClient.cs index 693be87..cf301fd 100644 --- a/StartServerWPF.Modules.Main/WebsocketClient.cs +++ b/StartServerWPF.Modules.Main/WebsocketClient.cs @@ -21,15 +21,11 @@ namespace StartServerWPF.Modules.Main public Action WebSocketMessageReceived; public void WebSocketInit(string url) { - Debug.WriteLine("客户端"); webSocket4Net = new WebSocket(url); webSocket4Net.Opened += WebSocket4Net_Opened; webSocket4Net.Error += new EventHandler(WebSocket_Error); - webSocket4Net.MessageReceived += WebSocket4Net_MessageReceived; - + webSocket4Net.MessageReceived += WebSocket4Net_MessageReceived; Debug.WriteLine("客户端连接成功!"); - - // thread.Start(); } private string name = string.Empty; private string pwd = string.Empty; @@ -40,8 +36,6 @@ namespace StartServerWPF.Modules.Main name = account; pwd = password; webSocket4Net.Open(); - // string jsonstr= JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account=account,password=password}); - // SendMes(jsonstr); Task.Run(async () =>{ await Task.Delay(2000); isHeartbeat = true; @@ -91,7 +85,7 @@ namespace StartServerWPF.Modules.Main private void WebSocket4Net_Opened(object sender, EventArgs e) { - Debug.WriteLine("连接websocket成功****************"); + Debug.WriteLine("连接websocket成功,自动登录****************"); string jsonstr = JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account = name, password = pwd }); SendMes(jsonstr); }