Files
Chronos/src/Titano.App/Sections/WelcomeView.xaml
T
Claude b82f7462f2 fix(ui): group radio buttons by their panel; the RTL dialog test waits for Loaded
The installer capture builds one window per stage, each with its own view model.
Radio buttons named into one group are shared by every window not yet on screen,
so Just me / All users of two windows unchecked each other forever.
The right-to-left smoke test now waits for the dialog's Loaded event (the first
render can come after an idle tick) instead of an idle dispatcher.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
2026-10-06 08:03:13 +00:00

123 lines
8.3 KiB
XML

<UserControl x:Class="Titano.App.Sections.WelcomeView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ui="clr-namespace:Titano.Ui.Controls;assembly=Titano.Ui"
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui">
<UserControl.Resources>
<!-- Welcome.html choice: 68 px card, highlighted = accent border with the AccentSelected glow. -->
<Style x:Key="RadioButton.Choice" TargetType="RadioButton">
<Setter Property="FocusVisualStyle" Value="{StaticResource Focus.Ring}" />
<Setter Property="Foreground" Value="{DynamicResource Brush.Text}" />
<Setter Property="Height" Value="68" />
<Setter Property="Margin" Value="0,0,0,10" />
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid>
<Border x:Name="Glow" Margin="-3" CornerRadius="11" BorderThickness="3" BorderBrush="{DynamicResource Brush.AccentSelected}" Visibility="Collapsed" />
<Border x:Name="Bd" Background="{DynamicResource Brush.Card}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="1"
CornerRadius="{StaticResource Radius.Card}" Padding="16,0">
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Stretch" />
</Border>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.CardHover}" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
<Setter TargetName="Glow" Property="Visibility" Value="Visible" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="Text.ChoiceTitle" TargetType="TextBlock">
<Setter Property="FontSize" Value="14" />
<Setter Property="FontWeight" Value="SemiBold" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
<Style x:Key="Text.ChoiceDetail" TargetType="TextBlock">
<Setter Property="FontSize" Value="12" />
<Setter Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
<Setter Property="Margin" Value="0,3,0,0" />
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
</Style>
</UserControl.Resources>
<!-- A modal dialog over the dimmed shell: Tab, Ctrl+Tab and the arrows stay inside it, and it opens with focus on the chosen card. -->
<Border Width="640" Background="{DynamicResource Brush.Surface}" BorderBrush="{DynamicResource Brush.Stroke}" BorderThickness="1"
CornerRadius="{StaticResource Radius.Dialog}" Padding="32,28" Effect="{StaticResource Shadow.Popup}"
KeyboardNavigation.TabNavigation="Cycle" KeyboardNavigation.ControlTabNavigation="Cycle" KeyboardNavigation.DirectionalNavigation="Contained">
<StackPanel>
<DockPanel LastChildFill="True">
<ComboBox DockPanel.Dock="Right" VerticalAlignment="Top" MinWidth="120" ItemsSource="{Binding Languages}" SelectedItem="{Binding SelectedLanguage}"
DisplayMemberPath="Name" ToolTip="{l:Loc Tooltips.Welcome.Language}" AutomationProperties.Name="{l:Loc Settings.General.Language}" />
<ui:BrandMarkIcon Width="56" Height="56" ShowPlate="True" FlowDirection="LeftToRight" />
<StackPanel Margin="16,0,16,0" VerticalAlignment="Center">
<TextBlock Text="{l:Loc Shell.Welcome.Title}" FontSize="20" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
<TextBlock Text="{l:Loc Shell.Welcome.Question}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0" TextTrimming="CharacterEllipsis" />
</StackPanel>
</DockPanel>
<StackPanel Margin="0,20,0,0">
<!-- Create a local archive -->
<RadioButton x:Name="LocalChoice" Style="{StaticResource RadioButton.Choice}" IsChecked="{Binding IsLocal}" ToolTip="{l:Loc Tooltips.Welcome.Local}"
AutomationProperties.Name="{l:Loc Shell.Welcome.Local}">
<DockPanel>
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Subtle}" Content="{l:Loc Shell.Welcome.Change}" Command="{Binding ChangeRootCommand}"
ToolTip="{l:Loc Tooltips.Welcome.Change}" Foreground="{DynamicResource Brush.TextMuted}" />
<ui:Icon Glyph="{StaticResource Icon.Folder}" Size="24" Foreground="{DynamicResource Brush.Accent}" VerticalAlignment="Center" />
<StackPanel Margin="14,0,8,0" VerticalAlignment="Center">
<TextBlock Style="{StaticResource Text.ChoiceTitle}" Text="{l:Loc Shell.Welcome.Local}" />
<TextBlock Style="{StaticResource Text.ChoiceDetail}" Text="{Binding LocalDetail}" Typography.NumeralAlignment="Tabular" />
</StackPanel>
</DockPanel>
</RadioButton>
<!-- Adopt an existing folder -->
<RadioButton x:Name="AdoptChoice" Style="{StaticResource RadioButton.Choice}" IsChecked="{Binding IsAdopt}" ToolTip="{l:Loc Tooltips.Welcome.Adopt}"
AutomationProperties.Name="{l:Loc Shell.Welcome.Adopt}">
<DockPanel>
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Subtle}" Content="{l:Loc Shell.Welcome.Choose}" Command="{Binding ChooseAdoptCommand}"
ToolTip="{l:Loc Tooltips.Welcome.Choose}" Foreground="{DynamicResource Brush.TextMuted}" />
<ui:Icon Glyph="{StaticResource Icon.Archive}" Size="24" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
<StackPanel Margin="14,0,8,0" VerticalAlignment="Center">
<TextBlock Style="{StaticResource Text.ChoiceTitle}" Text="{l:Loc Shell.Welcome.Adopt}" />
<TextBlock Style="{StaticResource Text.ChoiceDetail}" Text="{Binding AdoptDetail}" Visibility="{Binding HasAdoptDetail, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</DockPanel>
</RadioButton>
<!-- Connect to a server -->
<RadioButton x:Name="ServerChoice" Style="{StaticResource RadioButton.Choice}" IsChecked="{Binding IsServer}" ToolTip="{l:Loc Tooltips.Welcome.Server}"
AutomationProperties.Name="{l:Loc Shell.Welcome.Server}" Margin="0">
<DockPanel>
<ui:StatusGlyph DockPanel.Dock="Right" Kind="Online" Text="{l:Loc Shell.Welcome.Found}" VerticalAlignment="Center" ToolTip="{l:Loc Tooltips.Welcome.Found}"
Visibility="{Binding IsServerDiscovered, Converter={StaticResource BoolToVisibility}}" />
<ui:Icon Glyph="{StaticResource Icon.Server}" Size="24" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
<StackPanel Margin="14,0,8,0" VerticalAlignment="Center">
<TextBlock Style="{StaticResource Text.ChoiceTitle}" Text="{l:Loc Shell.Welcome.Server}" />
<TextBlock Style="{StaticResource Text.ChoiceDetail}" Text="{Binding ServerDetail}" Visibility="{Binding HasServerDetail, Converter={StaticResource BoolToVisibility}}" />
</StackPanel>
</DockPanel>
</RadioButton>
</StackPanel>
<!-- Consent, then Continue (visual and Tab order); the consent has the same label as in Settings. -->
<Grid Margin="0,20,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<CheckBox Content="{l:Loc Settings.General.UsageCounts}" IsChecked="{Binding UsageCounts}" ToolTip="{l:Loc Tooltips.Settings.UsageCounts}" VerticalAlignment="Center"
HorizontalAlignment="Left" Foreground="{DynamicResource Brush.TextMuted}" />
<Button Grid.Column="1" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Margin="12,0,0,0" Content="{l:Loc Shell.Welcome.Continue}"
Command="{Binding ContinueCommand}" ToolTip="{l:Loc Tooltips.Welcome.Continue}" IsDefault="True" />
</Grid>
</StackPanel>
</Border>
</UserControl>