Move status text and loading overlay to MainWindow.xaml (Phase 5b step 2)
Express the status TextBlock and full loading overlay (ProgressRing + label) declaratively with x:Bind to ViewModel.StatusText and ViewModel.HardwareLoadingVisibility. Delete the imperative StatusHost population and BuildLoadingOverlay helper. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -94,7 +94,6 @@ public sealed partial class MainWindow : Window
|
||||
RootGrid.Loaded += RootGrid_Loaded;
|
||||
RootGrid.LayoutUpdated += RootGrid_LayoutUpdated;
|
||||
Bind(ContentGrid, UIElement.IsHitTestVisibleProperty, ViewModel, nameof(ViewModel.IsHardwareInteractionEnabled));
|
||||
Bind(OverlayHost, UIElement.VisibilityProperty, ViewModel, nameof(ViewModel.HardwareLoadingVisibility));
|
||||
|
||||
MeasureStartup("MainWindow.BuildMenuBar", () => MenuHost.Children.Add(BuildMenuBar()));
|
||||
|
||||
@@ -120,16 +119,6 @@ public sealed partial class MainWindow : Window
|
||||
_plotView = builtPlot!;
|
||||
ContentGrid.Children.Add(plotPane);
|
||||
|
||||
TextBlock statusText = new()
|
||||
{
|
||||
Padding = new Thickness(8, 4, 8, 4),
|
||||
TextTrimming = TextTrimming.CharacterEllipsis
|
||||
};
|
||||
Bind(statusText, TextBlock.TextProperty, ViewModel, nameof(ViewModel.StatusText));
|
||||
StatusHost.Children.Add(statusText);
|
||||
|
||||
MeasureStartup("MainWindow.BuildLoadingOverlay", () => OverlayHost.Children.Add(BuildLoadingOverlay()));
|
||||
|
||||
MeasureStartup("MainWindow.RestoreWindowBounds", _placementService.Restore);
|
||||
MeasureStartup("MainWindow.MaximizeWindow", _placementService.Maximize);
|
||||
MeasureStartup("MainWindow.ApplyTheme", ApplyTheme);
|
||||
@@ -440,41 +429,6 @@ public sealed partial class MainWindow : Window
|
||||
return menuBar;
|
||||
}
|
||||
|
||||
private Grid BuildLoadingOverlay()
|
||||
{
|
||||
Grid overlay = new()
|
||||
{
|
||||
Background = new SolidColorBrush(global::Windows.UI.Color.FromArgb(150, 128, 128, 128)),
|
||||
Visibility = ViewModel.HardwareLoadingVisibility,
|
||||
IsHitTestVisible = true
|
||||
};
|
||||
Bind(overlay, UIElement.VisibilityProperty, ViewModel, nameof(ViewModel.HardwareLoadingVisibility));
|
||||
|
||||
StackPanel content = new()
|
||||
{
|
||||
HorizontalAlignment = HorizontalAlignment.Center,
|
||||
VerticalAlignment = VerticalAlignment.Center,
|
||||
Spacing = 12
|
||||
};
|
||||
ProgressRing progressRing = new()
|
||||
{
|
||||
Width = 64,
|
||||
Height = 64,
|
||||
IsIndeterminate = true
|
||||
};
|
||||
TextBlock text = new()
|
||||
{
|
||||
Text = "Loading hardware devices...",
|
||||
FontWeight = new global::Windows.UI.Text.FontWeight { Weight = 600 },
|
||||
HorizontalAlignment = HorizontalAlignment.Center
|
||||
};
|
||||
content.Children.Add(progressRing);
|
||||
content.Children.Add(text);
|
||||
overlay.Children.Add(content);
|
||||
|
||||
return overlay;
|
||||
}
|
||||
|
||||
private Grid BuildSensorPane(out TreeView tree)
|
||||
{
|
||||
Grid pane = new()
|
||||
|
||||
@@ -23,7 +23,24 @@
|
||||
<RowDefinition Height="220" />
|
||||
</Grid.RowDefinitions>
|
||||
</Grid>
|
||||
<Grid x:Name="StatusHost" Grid.Row="2" />
|
||||
<Grid x:Name="OverlayHost" Grid.RowSpan="3" />
|
||||
<TextBlock x:Name="StatusText"
|
||||
Grid.Row="2"
|
||||
Padding="8,4,8,4"
|
||||
TextTrimming="CharacterEllipsis"
|
||||
Text="{x:Bind ViewModel.StatusText, Mode=OneWay}" />
|
||||
<Grid x:Name="OverlayHost"
|
||||
Grid.RowSpan="3"
|
||||
IsHitTestVisible="True"
|
||||
Visibility="{x:Bind ViewModel.HardwareLoadingVisibility, Mode=OneWay}">
|
||||
<Grid.Background>
|
||||
<SolidColorBrush Color="#80808080" />
|
||||
</Grid.Background>
|
||||
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center" Spacing="12">
|
||||
<ProgressRing Width="64" Height="64" IsIndeterminate="True" />
|
||||
<TextBlock Text="Loading hardware devices..."
|
||||
FontWeight="SemiBold"
|
||||
HorizontalAlignment="Center" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
Reference in New Issue
Block a user