mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-26 03:59:34 +08:00
save
This commit is contained in:
@@ -49,7 +49,7 @@ namespace System.Net.WebSocket
|
||||
/// 启动连接且尝试握手
|
||||
/// </summary>
|
||||
/// <returns>Task</returns>
|
||||
internal async Task StartAsync(CancellationToken cancellationToken)
|
||||
internal async Task StartAsync()
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -62,7 +62,7 @@ namespace System.Net.WebSocket
|
||||
State = SocketState.Open;
|
||||
if (OnConnected != null)
|
||||
await OnConnected!.Invoke(new ConnectedEventArgs(this));
|
||||
await Task.Run(() => ReadAsync(), cancellationToken);
|
||||
await ReadAsync();
|
||||
}
|
||||
catch (SocketException e)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace System.Net.WebSocket
|
||||
OnDisconnected = OnClientDisconnected
|
||||
};
|
||||
tokenSource.Token.Register(() => { client.Dispose(); });
|
||||
await client.StartAsync(tokenSource.Token);
|
||||
await client.StartAsync();
|
||||
}, tokenSource.Token);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,13 +15,13 @@ namespace System.Application.UI.ViewModels
|
||||
partial class LoginOrRegisterWindowViewModel : WindowViewModel
|
||||
{
|
||||
ServerWebSocket server;
|
||||
public override void Activation()
|
||||
public override void Activation()
|
||||
{
|
||||
if (IsFirstActivation)
|
||||
{
|
||||
server = new ServerWebSocket("127.0.0.1", 9910);
|
||||
server.OnClientReceived += handle;
|
||||
server.Start();
|
||||
server.Start();
|
||||
}
|
||||
base.Activation();
|
||||
}
|
||||
@@ -48,11 +48,11 @@ namespace System.Application.UI.ViewModels
|
||||
if (IsBind)
|
||||
{
|
||||
await MainThread2.InvokeOnMainThreadAsync(async () =>
|
||||
{
|
||||
await UserService.Current.BindAccountAfterUpdateAsync(Channel, response.Content!);
|
||||
var msg = AppResources.Success_.Format(AppResources.User_AccountBind);
|
||||
Toast.Show(msg);
|
||||
});
|
||||
{
|
||||
await UserService.Current.BindAccountAfterUpdateAsync(Channel, response.Content!);
|
||||
var msg = AppResources.Success_.Format(AppResources.User_AccountBind);
|
||||
Toast.Show(msg);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user