diff --git a/ADP/ViewModels/ShellViewModel.cs b/ADP/ViewModels/ShellViewModel.cs
index b656b16..f39b168 100644
--- a/ADP/ViewModels/ShellViewModel.cs
+++ b/ADP/ViewModels/ShellViewModel.cs
@@ -154,6 +154,24 @@ namespace ADP.ViewModels
public ICommand MonitorValueSettingCommand { get; set; }
public ICommand GetFileStringCommand { get; set; }
public ICommand SilenceBuzzerCommand { get; set; }
+ public ICommand GoBackCommand { get; set; }
+ #endregion
+
+ #region 子程序导航
+
+ public bool CanGoBack =>
+ (CurrentContext?.MainNav.CanGoBack ?? false) ||
+ (CurrentContext?.ErrorNav.CanGoBack ?? false);
+
+ private void OnGoBack()
+ {
+ var ctx = CurrentContext;
+ if (ctx == null) return;
+ // 工具栏按钮同时重置两个 Tab 的导航
+ ctx.MainNav.Reset(ctx.Program, "主程序");
+ ctx.ErrorNav.Reset(ctx.Program, "错误程序");
+ }
+
#endregion
public ShellViewModel(IContainerProvider containerProvider)
@@ -188,6 +206,7 @@ namespace ADP.ViewModels
MonitorValueSettingCommand = new DelegateCommand(MonitorValueSetting);
GetFileStringCommand = new DelegateCommand(GetFileString);
SilenceBuzzerCommand = new AsyncDelegateCommand(SilenceBuzzer);
+ GoBackCommand = new DelegateCommand(OnGoBack);
_globalInfo.ContextDic.Add("default", new ScopedContext());
@@ -457,6 +476,9 @@ namespace ADP.ViewModels
LoggerHelper.InfoWithNotify(runningScope, $"{_globalInfo.UserName} 执行工位 [{runningScope}] 复位命令");
+ // 重置导航栈,回到根程序界面
+ targetContext.ResetNavigation();
+
_executionTasks.TryGetValue(runningScope, out var currentTask);
_errorExecutionTasks.TryGetValue(runningScope, out var errorTask);
@@ -573,6 +595,7 @@ namespace ADP.ViewModels
targetContext.Program.Parameters.Clear();
targetContext.Program.StepCollection.Clear();
targetContext.Program.ErrorStepCollection.Clear();
+ targetContext.ResetNavigation();
foreach (var item in CurrentConfig.ParameterList)
{
var param = CurrentConfig.SharedParameterList.FirstOrDefault(x => x.ParameterName == item.Name);
diff --git a/ADP/Views/ShellView.xaml b/ADP/Views/ShellView.xaml
index 88df17c..a1b0306 100644
--- a/ADP/Views/ShellView.xaml
+++ b/ADP/Views/ShellView.xaml
@@ -226,6 +226,16 @@ Command="{Binding GetFileStringCommand}">
Foreground="Black" />
+
+
+