启动加载页
This commit is contained in:
@@ -234,11 +234,23 @@ namespace MainModule.ViewModels
|
||||
#region 命令处理与事件
|
||||
private async Task OnLoad()
|
||||
{
|
||||
if (!IsInitialized)
|
||||
// 设备初始化期间仅对当前台架显示灰度遮罩层,初始化完成后关闭(finally 保证异常时也能关闭)
|
||||
_eventAggregator.GetEvent<ScopeOverlayEvent>().Publish(new ScopeOverlayArgs { Scope = TestStatus, Show = true });
|
||||
// 让遮罩层先完成渲染,再进入同步阻塞的设备初始化(泵送 Dispatcher 至 Render 优先级)
|
||||
System.Windows.Application.Current?.Dispatcher.Invoke(() => { }, System.Windows.Threading.DispatcherPriority.Render);
|
||||
try
|
||||
{
|
||||
await _deviceManager.ConnectAllDevices();
|
||||
IsInitialized = true;
|
||||
if (!IsInitialized)
|
||||
{
|
||||
await _deviceManager.ConnectAllDevices();
|
||||
IsInitialized = true;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_eventAggregator.GetEvent<ScopeOverlayEvent>().Publish(new ScopeOverlayArgs { Scope = TestStatus, Show = false });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void OnRefresh()
|
||||
|
||||
Reference in New Issue
Block a user