Optimize the information function
This commit is contained in:
@@ -261,14 +261,10 @@ namespace ServiceLib.Handler
|
|||||||
_updateFunc(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
|
_updateFunc(true, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, "geo"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunAvailabilityCheck(Action<bool, string> update)
|
public async Task RunAvailabilityCheck(Action<bool, string> update)
|
||||||
{
|
{
|
||||||
Task.Run(async () =>
|
var time = await (new DownloadHandler()).RunAvailabilityCheck(null);
|
||||||
{
|
update(false, string.Format(ResUI.TestMeOutput, time));
|
||||||
var time = await (new DownloadHandler()).RunAvailabilityCheck(null);
|
|
||||||
|
|
||||||
update(false, string.Format(ResUI.TestMeOutput, time));
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region private
|
#region private
|
||||||
|
|||||||
@@ -349,10 +349,6 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
private void UpdateHandler(bool notify, string msg)
|
private void UpdateHandler(bool notify, string msg)
|
||||||
{
|
{
|
||||||
if (!_config.uiItem.showInTaskbar)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_noticeHandler?.SendMessage(msg);
|
_noticeHandler?.SendMessage(msg);
|
||||||
if (notify)
|
if (notify)
|
||||||
{
|
{
|
||||||
@@ -611,21 +607,16 @@ namespace ServiceLib.ViewModels
|
|||||||
SetDefaultServer(SelectedServer.ID);
|
SetDefaultServer(SelectedServer.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TestServerAvailability()
|
public async Task TestServerAvailability()
|
||||||
{
|
{
|
||||||
var item = ConfigHandler.GetDefaultServer(_config);
|
var item = ConfigHandler.GetDefaultServer(_config);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(new UpdateHandler()).RunAvailabilityCheck(async (bool success, string msg) =>
|
await (new UpdateHandler()).RunAvailabilityCheck(async (bool success, string msg) =>
|
||||||
{
|
{
|
||||||
_noticeHandler?.SendMessageEx(msg);
|
_noticeHandler?.SendMessageEx(msg);
|
||||||
|
|
||||||
if (!_config.uiItem.showInTaskbar)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);
|
await _updateView?.Invoke(EViewAction.DispatcherServerAvailability, msg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -715,7 +706,7 @@ namespace ServiceLib.ViewModels
|
|||||||
|
|
||||||
LoadCore().ContinueWith(async task =>
|
LoadCore().ContinueWith(async task =>
|
||||||
{
|
{
|
||||||
TestServerAvailability();
|
await TestServerAvailability();
|
||||||
|
|
||||||
await _updateView?.Invoke(EViewAction.DispatcherReload, null);
|
await _updateView?.Invoke(EViewAction.DispatcherReload, null);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ namespace ServiceLib.ViewModels
|
|||||||
}
|
}
|
||||||
|
|
||||||
_blLockShow = true;
|
_blLockShow = true;
|
||||||
|
if (!_config.uiItem.showInTaskbar)
|
||||||
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
|
}
|
||||||
|
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
var txt = string.Join("", _queueMsg.ToArray());
|
var txt = string.Join("", _queueMsg.ToArray());
|
||||||
|
|||||||
Reference in New Issue
Block a user