子程序优化
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using DeviceCommand.Base;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Prism.Mvvm;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -14,9 +15,35 @@ using UIShare.UIViewModel;
|
||||
|
||||
namespace UIShare.GlobalVariable
|
||||
{
|
||||
public class ScopedContext
|
||||
public class ScopedContext : BindableBase
|
||||
{
|
||||
private static readonly Random _randomSeed = new Random();
|
||||
|
||||
#region 子程序导航(主程序 / 错误程序各自独立)
|
||||
|
||||
/// <summary>主程序 Tab 的导航状态</summary>
|
||||
public ProgramNavigationState MainNav { get; } = new();
|
||||
|
||||
/// <summary>错误程序 Tab 的导航状态</summary>
|
||||
public ProgramNavigationState ErrorNav { get; } = new();
|
||||
|
||||
/// <summary>
|
||||
/// 根据当前选中的 Tab 返回对应的导航状态
|
||||
/// </summary>
|
||||
public ProgramNavigationState ActiveNav =>
|
||||
SelectedStepList == "错误程序" ? ErrorNav : MainNav;
|
||||
|
||||
/// <summary>
|
||||
/// 重置两个 Tab 的导航栈,回到根程序
|
||||
/// </summary>
|
||||
public void ResetNavigation()
|
||||
{
|
||||
MainNav.Reset(Program, "主程序");
|
||||
ErrorNav.Reset(Program, "错误程序");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public ProgramVM Program { get; set; } = new();
|
||||
public String SelectedStepList { get; set; } = "主程序";
|
||||
public string CurrentFilePath { get; set; }
|
||||
@@ -45,6 +72,7 @@ namespace UIShare.GlobalVariable
|
||||
public int DebugRandomId { get; private set; }
|
||||
public ScopedContext()
|
||||
{
|
||||
ErrorNav.IsErrorTab = true;
|
||||
lock (_randomSeed)
|
||||
{
|
||||
// 每次诞生一个新上下文,就在 10000 到 99999 之间随机摇一个数
|
||||
|
||||
Reference in New Issue
Block a user