修改测试问题

master
mzhifa 7 months ago
parent 4f686ff5d0
commit 7dda496345

@ -88,9 +88,8 @@ namespace StartServerWPF.Modules.Main.ViewModels
} }
catch (Exception ex) catch (Exception ex)
{ {
MessageBox.Show("加载配置失败,"+path); MessageBox.Show($"加载配置失败,路径:{path},错误:{ex}");
} }
} }
SetProperty(ref _wareaSelectedIndex, value); SetProperty(ref _wareaSelectedIndex, value);
} }
@ -276,8 +275,8 @@ namespace StartServerWPF.Modules.Main.ViewModels
{ {
ApmsEventSource.Clear(); ApmsEventSource.Clear();
} }
var fileName = Directory.GetFiles(SavePath, "*.index", SearchOption.AllDirectories);
var fileName = Directory.GetFiles(SavePath, "*.index", SearchOption.AllDirectories);
foreach (var file in fileName) foreach (var file in fileName)
{ {
bool flag= DateTime.TryParseExact(Path.GetFileNameWithoutExtension(file), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture, bool flag= DateTime.TryParseExact(Path.GetFileNameWithoutExtension(file), "yyyyMMdd", System.Globalization.CultureInfo.CurrentCulture,
@ -289,7 +288,6 @@ namespace StartServerWPF.Modules.Main.ViewModels
File.Delete(file); File.Delete(file);
} }
} }
} }
Task.Run(() => Task.Run(() =>

@ -21,15 +21,11 @@ namespace StartServerWPF.Modules.Main
public Action<string> WebSocketMessageReceived; public Action<string> WebSocketMessageReceived;
public void WebSocketInit(string url) public void WebSocketInit(string url)
{ {
Debug.WriteLine("客户端");
webSocket4Net = new WebSocket(url); webSocket4Net = new WebSocket(url);
webSocket4Net.Opened += WebSocket4Net_Opened; webSocket4Net.Opened += WebSocket4Net_Opened;
webSocket4Net.Error += new EventHandler<ErrorEventArgs>(WebSocket_Error); webSocket4Net.Error += new EventHandler<ErrorEventArgs>(WebSocket_Error);
webSocket4Net.MessageReceived += WebSocket4Net_MessageReceived; webSocket4Net.MessageReceived += WebSocket4Net_MessageReceived;
Debug.WriteLine("客户端连接成功!"); Debug.WriteLine("客户端连接成功!");
// thread.Start();
} }
private string name = string.Empty; private string name = string.Empty;
private string pwd = string.Empty; private string pwd = string.Empty;
@ -40,8 +36,6 @@ namespace StartServerWPF.Modules.Main
name = account; name = account;
pwd = password; pwd = password;
webSocket4Net.Open(); webSocket4Net.Open();
// string jsonstr= JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account=account,password=password});
// SendMes(jsonstr);
Task.Run(async () =>{ Task.Run(async () =>{
await Task.Delay(2000); await Task.Delay(2000);
isHeartbeat = true; isHeartbeat = true;
@ -91,7 +85,7 @@ namespace StartServerWPF.Modules.Main
private void WebSocket4Net_Opened(object sender, EventArgs e) 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 }); string jsonstr = JsonSerializer.Serialize(new CSUserSigin { type = CSMessage.sigin, utype = "device", account = name, password = pwd });
SendMes(jsonstr); SendMes(jsonstr);
} }

Loading…
Cancel
Save