修复主界面在开始前显示当前所选配方

This commit is contained in:
tfarcraw 2026-11-08 21:51:35 +08:00
parent 3436d08d4a
commit 6359fadad8
2 changed files with 7 additions and 2 deletions

View File

@ -59,7 +59,7 @@
<Border Grid.Row="0" Classes="panel">
<StackPanel>
<TextBlock Text="当前配方" Classes="Title" />
<TextBlock Text="{Binding ActiveRecipe}" Margin="0,10,0,0" FontSize="18" FontWeight="SemiBold" TextWrapping="Wrap" />
<TextBlock Text="{Binding SelectedRecipe, TargetNullValue=未选择配方}" Margin="0,10,0,0" FontSize="18" FontWeight="SemiBold" TextWrapping="Wrap" />
<WrapPanel Margin="0,10,0,0">
<TextBlock Text="状态" Width="40" />
<TextBlock Text="{Binding StatusText}" Foreground="{StaticResource Accent}" />

View File

@ -65,6 +65,7 @@ internal static class Smoke
var sopView=window.GetVisualDescendants().OfType<SopPage>().Single();
Check(!sopView.GetVisualDescendants().Any(c=>c is ComboBox or Slider),"Operator page contains no camera, recipe or parameter editors");
Check(sop.ActiveRecipe=="未应用配方","No recipe is reported active before applying");
Check(!string.IsNullOrWhiteSpace(sop.SelectedRecipe)&&sopView.GetVisualDescendants().OfType<TextBlock>().Any(t=>t.Text==sop.SelectedRecipe),"Operator page displays the selected recipe before applying or starting");
navigation.SelectedIndex=2;await Task.Delay(100);
var settings=window.GetVisualDescendants().OfType<SopHelper.VVMs.RuntimeSettings.RuntimeSettings>().Single();
Check(ReferenceEquals(settings.DataContext,sop),"Settings and operator page share runtime state");
@ -74,7 +75,11 @@ internal static class Smoke
var applied=sop.ActiveRecipe;var selected=sop.SelectedRecipe;
sop.SelectedRecipe="pending.yaml";
Check(sop.ActiveRecipe==applied,"Unapplied recipe selection does not change current recipe");
sop.SelectedRecipe=selected;
navigation.SelectedIndex=0;await Task.Delay(80);
Check(window.GetVisualDescendants().OfType<SopPage>().Single().GetVisualDescendants().OfType<TextBlock>().Any(t=>t.Text=="pending.yaml"),"Operator page updates to the selected recipe without applying or starting");
sop.SelectedRecipe=selected;await Task.Delay(80);
Check(window.GetVisualDescendants().OfType<SopPage>().Single().GetVisualDescendants().OfType<TextBlock>().Any(t=>t.Text==selected),"Recipe selection changes notify the operator page immediately");
navigation.SelectedIndex=2;await Task.Delay(80);
Save(window,"runtime-settings");
navigation.SelectedIndex=0;await Task.Delay(100);
Check(window.GetVisualDescendants().OfType<SopPage>().Single().GetVisualDescendants().OfType<TextBlock>().Any(t=>t.Text==applied),"Operator page displays the applied recipe");