Improved await _updateView

pull/5829/head
2dust 2024-10-08 14:55:06 +08:00
parent b2669103dc
commit f5956e7bf0
11 changed files with 19 additions and 19 deletions

View File

@ -32,9 +32,9 @@ namespace ServiceLib.ViewModels
}
CoreType = SelectedSource?.coreType?.ToString();
BrowseServerCmd = ReactiveCommand.CreateFromTask(async () =>
BrowseServerCmd = ReactiveCommand.Create(() =>
{
await _updateView?.Invoke(EViewAction.BrowseServer, null);
_updateView?.Invoke(EViewAction.BrowseServer, null);
});
EditServerCmd = ReactiveCommand.Create(() =>
@ -67,7 +67,7 @@ namespace ServiceLib.ViewModels
if (ConfigHandler.EditCustomServer(_config, SelectedSource) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{

View File

@ -87,7 +87,7 @@ namespace ServiceLib.ViewModels
if (ConfigHandler.AddServer(_config, SelectedSource) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{

View File

@ -109,7 +109,7 @@ namespace ServiceLib.ViewModels
return;
}
await _updateView?.Invoke(EViewAction.DispatcherRefreshConnections, it?.connections);
_updateView?.Invoke(EViewAction.DispatcherRefreshConnections, it?.connections);
});
}

View File

@ -177,7 +177,7 @@ namespace ServiceLib.ViewModels
}
if (refreshUI)
{
await _updateView?.Invoke(EViewAction.DispatcherRefreshProxyGroups, null);
_updateView?.Invoke(EViewAction.DispatcherRefreshProxyGroups, null);
}
});
}
@ -396,7 +396,7 @@ namespace ServiceLib.ViewModels
return;
}
await _updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.name, Delay = result });
_updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.name, Delay = result });
});
}

View File

@ -106,7 +106,7 @@ namespace ServiceLib.ViewModels
ConfigHandler.SaveDNSItems(_config, item2);
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
}
}

View File

@ -433,7 +433,7 @@ namespace ServiceLib.ViewModels
catch { }
finally
{
await _updateView?.Invoke(EViewAction.Shutdown, null);
_updateView?.Invoke(EViewAction.Shutdown, null);
}
}
@ -630,7 +630,7 @@ namespace ServiceLib.ViewModels
await (new UpdateService()).RunAvailabilityCheck(async (bool success, string msg) =>
{
NoticeHandler.Instance.SendMessageEx(msg);
await _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);
_updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);
});
}
@ -721,7 +721,7 @@ namespace ServiceLib.ViewModels
{
await TestServerAvailability();
await _updateView?.Invoke(EViewAction.DispatcherReload, null);
_updateView?.Invoke(EViewAction.DispatcherReload, null);
});
}
@ -781,7 +781,7 @@ namespace ServiceLib.ViewModels
private async Task ChangeSystemProxyStatusAsync(ESysProxyType type, bool blChange)
{
//await _updateView?.Invoke(EViewAction.UpdateSysProxy, _config.tunModeItem.enableTun ? true : false);
await _updateView?.Invoke(EViewAction.UpdateSysProxy, false);
_updateView?.Invoke(EViewAction.UpdateSysProxy, false);
NoticeHandler.Instance.SendMessageEx($"{ResUI.TipChangeSystemProxy} - {_config.systemProxyItem.sysProxyType.ToString()}");
BlSystemProxyClear = (type == ESysProxyType.ForcedClear);
@ -793,7 +793,7 @@ namespace ServiceLib.ViewModels
if (blChange)
{
await _updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);
_updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);
}
}
@ -844,7 +844,7 @@ namespace ServiceLib.ViewModels
{
NoticeHandler.Instance.SendMessageEx(ResUI.TipChangeRouting);
Reload();
await _updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);
_updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);
}
}

View File

@ -342,7 +342,7 @@ namespace ServiceLib.ViewModels
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
}
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{

View File

@ -87,7 +87,7 @@ namespace ServiceLib.ViewModels
return;
}
//NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
}
}

View File

@ -240,7 +240,7 @@ namespace ServiceLib.ViewModels
if (ConfigHandler.SaveRoutingItem(_config, item) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{

View File

@ -200,7 +200,7 @@ namespace ServiceLib.ViewModels
if (ConfigHandler.SaveConfig(_config) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{

View File

@ -44,7 +44,7 @@ namespace ServiceLib.ViewModels
if (ConfigHandler.AddSubItem(_config, SelectedSource) == 0)
{
NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);
await _updateView?.Invoke(EViewAction.CloseWindow, null);
_updateView?.Invoke(EViewAction.CloseWindow, null);
}
else
{