diff --git a/WebSocketTool/Client/ClientViewModel.cs b/WebSocketTool/Client/ClientViewModel.cs index 2f8e61b..4b0d878 100644 --- a/WebSocketTool/Client/ClientViewModel.cs +++ b/WebSocketTool/Client/ClientViewModel.cs @@ -6,6 +6,7 @@ using log4net; using WebSocketSharp; using WebSocketTool.Base; using WebSocketTool.Util; +using WebSocketTool.View.Dialog; using LogManager = log4net.LogManager; namespace WebSocketTool.Client @@ -106,7 +107,7 @@ namespace WebSocketTool.Client public void Connect() { - if (string.IsNullOrEmpty(WsUrl)) + if (string.IsNullOrEmpty(WsUrl) || (!WsUrl.StartsWith("wss://") && !WsUrl.StartsWith("ws://"))) { view.AppendInfo($"Hint {TimeUtil.GetCurrentDateTime()} \n 请输入正确的WebSocket地址"); return; @@ -126,8 +127,16 @@ namespace WebSocketTool.Client view.AppendInfo($"Hint {TimeUtil.GetCurrentDateTime()} \n Start Connect Socket"); if (IsProxyChecked) { - view.AppendInfo($"use proxy: {ProxyAddress}"); - mClient.SetHttpProxy(ProxyAddress, ProxyUserName, ProxyPassword); + if (!string.IsNullOrEmpty(ProxyAddress)) + { + view.AppendInfo($"Hint use proxy: {ProxyAddress}"); + mClient.SetHttpProxy(ProxyAddress, ProxyUserName, ProxyPassword); + } + else + { + view.ShowToast("请输入代理地址!"); + view.AppendInfo($"use proxy address is empty!"); + } } mClient.ConnectAsync(); } diff --git a/WebSocketTool/Client/ClientWindow.xaml.cs b/WebSocketTool/Client/ClientWindow.xaml.cs index 95de842..394ee6f 100644 --- a/WebSocketTool/Client/ClientWindow.xaml.cs +++ b/WebSocketTool/Client/ClientWindow.xaml.cs @@ -75,11 +75,18 @@ namespace WebSocketTool.Client { viewModel.Close(); } + + public Window GetWindow() + { + return this; + } } public interface IClientView { void ShowToast(string msg); void AppendInfo(string info); + + Window GetWindow(); } } diff --git a/WebSocketTool/pack/build.bat b/WebSocketTool/pack/build.bat index a05fab4..b09041f 100644 --- a/WebSocketTool/pack/build.bat +++ b/WebSocketTool/pack/build.bat @@ -1,4 +1,4 @@ -set version=1.0.0 +set version=1.0.3 if not "%~1"=="" ( set version=%1 diff --git a/websocket-sharp/websocket-sharp.csproj b/websocket-sharp/websocket-sharp.csproj index 8b75874..a61b4a9 100644 --- a/websocket-sharp/websocket-sharp.csproj +++ b/websocket-sharp/websocket-sharp.csproj @@ -9,7 +9,7 @@ Library WebSocketSharp websocket-sharp - v3.5 + v4.5.2 true websocket-sharp.snk