feat(app): Import and Archive manager screens with capture scenes and resources
Import (cards and folders): the card pool with remembered profiles and the nickname field for new cards, the form (destination, scan, sessions, names with live preview and tokens, duplicates, after-import choices), the plan panel with editable session titles, Show plan, the archive import job or the folder/server run with progress, the verification result and the after-import actions (dry run, delete, format through the Windows dialog, eject, open in Library), card-insertion toasts, automatic import into the archive and resume after re-insertion. Deep analysis after import is queued with ProcessingJobs at background priority. Archive manager: archive picker, tree with availability, figure tiles and charts, mass operations on the selected set, scan/rebuild (dialog)/verify/ duplicates/orphans/adopt/maintenance as jobs, and the maintenance view with index health, recent runs and the duplicate and orphan reports with safe fixes. --capture renders import-<state> and archive-<view> from a simulated card and sample reports; en and it resources for both screens. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
31 files changed
+4531
-28
No files matched your search
@@ -2,8 +2,466 @@
|
||||
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">
|
||||
<Grid Margin="20">
|
||||
<ui:EmptyState Message="{l:Loc Archive.Empty}" />
|
||||
xmlns:v="clr-namespace:Titano.Ui.Visuals;assembly=Titano.Ui"
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:ar="clr-namespace:Titano.App.Archiving"
|
||||
xmlns:shell="clr-namespace:Titano.App.Shell">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="Text.PanelHeading" TargetType="TextBlock" BasedOn="{StaticResource Text.Section}">
|
||||
<Setter Property="FontSize" Value="13" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style x:Key="Button.Bar" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Margin" Value="0,0,8,0" />
|
||||
</Style>
|
||||
<Style x:Key="Button.Tool" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0,0,8,8" />
|
||||
</Style>
|
||||
|
||||
<!-- Dialog card (DESIGN §4: Surface, Stroke, radius 12, 24 px shadow, two buttons). -->
|
||||
<Style x:Key="Border.Dialog" TargetType="Border">
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Surface}" />
|
||||
<Setter Property="BorderBrush" Value="{DynamicResource Brush.Stroke}" />
|
||||
<Setter Property="BorderThickness" Value="1" />
|
||||
<Setter Property="CornerRadius" Value="{StaticResource Radius.Dialog}" />
|
||||
<Setter Property="Padding" Value="24,18,24,20" />
|
||||
<Setter Property="Effect" Value="{StaticResource Shadow.Popup}" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<DataTemplate DataType="{x:Type ar:RebuildDialogViewModel}">
|
||||
<Border Style="{StaticResource Border.Dialog}" Width="520">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{l:Loc Archive.Rebuild.Heading}" Style="{StaticResource Text.Title}" />
|
||||
<ItemsControl ItemsSource="{Binding FactRows}" Focusable="False" Margin="0,14,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:DialogFact}">
|
||||
<Grid Margin="0,0,0,8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Label}" Style="{StaticResource Text.Label}" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Value}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Value}" Typography.NumeralAlignment="Tabular" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,18,0,0">
|
||||
<Button Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{l:Loc Tooltips.Archive.CloseDialog}" IsDefault="True" IsCancel="True"
|
||||
MinWidth="96" />
|
||||
<Button Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Rebuild.Start}" Command="{Binding RebuildCommand}" ToolTip="{Binding RebuildToolTip}"
|
||||
MinWidth="96" Margin="8,0,0,0" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type ar:RenameDialogViewModel}">
|
||||
<Border Style="{StaticResource Border.Dialog}" Width="720" MaxHeight="560">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
||||
<Grid Grid.Row="1" Margin="0,14,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{l:Loc Archive.Rename.Template}" Style="{StaticResource Text.Label}" />
|
||||
<TextBox Grid.Column="1" Style="{StaticResource TextBox.Mono}" Text="{Binding Template.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding Template}" ToolTip="{Binding Template.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Rename.Template}" />
|
||||
</Grid>
|
||||
<TextBlock Grid.Row="2" Text="{Binding SummaryText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,0,6" Typography.NumeralAlignment="Tabular" />
|
||||
<ListBox Grid.Row="3" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}" MinHeight="120"
|
||||
AutomationProperties.Name="{l:Loc Archive.Rename.Preview}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:RenameRow}">
|
||||
<Grid Height="30" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="120" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" MinWidth="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding From}" Foreground="{DynamicResource Brush.TextMuted}" ToolTip="{Binding From}" />
|
||||
<ui:Icon Grid.Column="1" Glyph="{StaticResource Icon.Forward}" Margin="10,0" Foreground="{DynamicResource Brush.TextFaint}" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding To}" ToolTip="{Binding To}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<DockPanel Grid.Row="4" Margin="0,16,0,0">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Rename.Apply}" Command="{Binding ApplyCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.RenameApply}" MinWidth="96" Margin="8,0,0,0" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{l:Loc Tooltips.Archive.CloseDialog}" IsCancel="True"
|
||||
MinWidth="96" />
|
||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
||||
<DataTemplate DataType="{x:Type ar:RetagDialogViewModel}">
|
||||
<Border Style="{StaticResource Border.Dialog}" Width="520">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Heading}" Style="{StaticResource Text.Title}" />
|
||||
<Grid Margin="0,14,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock Text="{l:Loc Archive.Retag.Add}" Style="{StaticResource Text.Label}" />
|
||||
<TextBox Grid.Column="1" Text="{Binding Add.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding Add}"
|
||||
ToolTip="{Binding Add.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Add}" />
|
||||
<TextBlock Grid.Row="1" Text="{l:Loc Archive.Retag.Remove}" Style="{StaticResource Text.Label}" Margin="0,10,14,0" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="0,10,0,0" Text="{Binding Remove.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding Remove}" ToolTip="{Binding Remove.ToolTip}" AutomationProperties.Name="{l:Loc Archive.Retag.Remove}" />
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding SummaryText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,12,0,0" Typography.NumeralAlignment="Tabular" />
|
||||
<DockPanel Margin="0,18,0,0">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Retag.Apply}" Command="{Binding ApplyCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.RetagApply}" MinWidth="96" Margin="8,0,0,0" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Archive.Dialog.Cancel}" Command="{Binding CloseCommand}" ToolTip="{l:Loc Tooltips.Archive.CloseDialog}" IsCancel="True"
|
||||
MinWidth="96" />
|
||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" />
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid Margin="20,16">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- ===================== Toolbar ===================== -->
|
||||
<DockPanel Margin="0,0,0,6">
|
||||
<v:SegmentedControl DockPanel.Dock="Right" SelectedIndex="{Binding ViewIndex}" VerticalAlignment="Top" AutomationProperties.Name="{l:Loc Archive.View.Name}">
|
||||
<v:SegmentedItem Content="{l:Loc Archive.View.Overview}" ToolTip="{l:Loc Tooltips.Archive.Overview}" AutomationProperties.Name="{l:Loc Archive.View.Overview}" />
|
||||
<v:SegmentedItem Content="{l:Loc Archive.View.Maintenance}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceView}"
|
||||
AutomationProperties.Name="{l:Loc Archive.View.Maintenance}" />
|
||||
</v:SegmentedControl>
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding LastScanText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Top" Margin="0,8,14,0"
|
||||
Typography.NumeralAlignment="Tabular" ToolTip="{l:Loc Tooltips.Archive.LastScan}" />
|
||||
<ComboBox DockPanel.Dock="Left" Width="220" VerticalAlignment="Top" ItemsSource="{Binding Archives}" SelectedItem="{Binding SelectedArchive}" DisplayMemberPath="Name"
|
||||
ToolTip="{Binding ArchiveToolTip}" AutomationProperties.Name="{l:Loc Archive.Toolbar.Archive}" Margin="0,0,8,8" />
|
||||
<Border DockPanel.Dock="Left" Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="4,5,12,0" VerticalAlignment="Top" />
|
||||
<WrapPanel>
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Scan}" Command="{Binding ScanCommand}" ToolTip="{l:Loc Tooltips.Archive.Scan}" />
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Rebuild}" Command="{Binding RebuildCommand}" ToolTip="{l:Loc Tooltips.Archive.Rebuild}" />
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Verify}" Command="{Binding VerifyCommand}" ToolTip="{l:Loc Tooltips.Archive.Verify}" />
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Duplicates}" Command="{Binding FindDuplicatesCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.Duplicates}" />
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Orphans}" Command="{Binding FindOrphansCommand}" ToolTip="{l:Loc Tooltips.Archive.Orphans}" />
|
||||
<Button Style="{StaticResource Button.Tool}" Content="{l:Loc Archive.Toolbar.Adopt}" Command="{Binding AdoptCommand}" ToolTip="{l:Loc Tooltips.Archive.Adopt}" />
|
||||
<Button x:Name="MaintenanceButton" Style="{StaticResource Button.Tool}" Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Archive.Maintenance}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{l:Loc Archive.Toolbar.Maintenance}" />
|
||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
||||
</StackPanel>
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{l:Loc Archive.Maintenance.Run}" Command="{Binding MaintenanceCommand}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceRun}" />
|
||||
<MenuItem Header="{l:Loc Archive.Maintenance.DryRun}" Command="{Binding MaintenanceDryRunCommand}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceDryRun}" />
|
||||
<MenuItem Header="{l:Loc Archive.Maintenance.Proxies}" Command="{Binding RebuildProxiesCommand}" ToolTip="{l:Loc Tooltips.Archive.MaintenanceProxies}" />
|
||||
<Separator />
|
||||
<MenuItem Header="{l:Loc Archive.Maintenance.Relink}" Command="{Binding RelinkCommand}" ToolTip="{l:Loc Tooltips.Archive.Relink}" />
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
|
||||
<!-- ===================== Overview: tree, figures, charts ===================== -->
|
||||
<Grid Grid.Row="1" Visibility="{Binding IsOverview, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.34*" MinWidth="220" MaxWidth="320" />
|
||||
<ColumnDefinition Width="14" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="6,8">
|
||||
<ListBox x:Name="Tree" ItemsSource="{Binding TreeRows}" SelectionMode="Extended" SelectionChanged="OnTreeSelectionChanged"
|
||||
AutomationProperties.Name="{l:Loc Archive.Tree.Name}">
|
||||
<ListBox.ItemContainerStyle>
|
||||
<Style TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="MinHeight" Value="32" />
|
||||
<Setter Property="Padding" Value="6,0" />
|
||||
<Setter Property="ToolTip" Value="{Binding Detail}" />
|
||||
</Style>
|
||||
</ListBox.ItemContainerStyle>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:ArchiveTreeRowViewModel}">
|
||||
<Grid Margin="{Binding IndentMargin}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="24" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button x:Name="Toggle" Style="{StaticResource Button.IconSubtle}" Width="22" Height="22" MinWidth="22" ui:ButtonIcon.Glyph="{StaticResource Icon.ChevronRight}"
|
||||
Command="{Binding ToggleCommand}" ToolTip="{Binding ToggleToolTip}" AutomationProperties.Name="{Binding ToggleToolTip}" Visibility="Hidden" />
|
||||
<TextBlock x:Name="Title" Grid.Column="1" Text="{Binding Title}" TextTrimming="CharacterEllipsis" VerticalAlignment="Center" />
|
||||
<TextBlock x:Name="Detail" Grid.Column="2" Text="{Binding Detail}" Style="{StaticResource Text.Secondary}" VerticalAlignment="Center" Margin="8,0,0,0"
|
||||
Visibility="Collapsed" Typography.NumeralAlignment="Tabular" />
|
||||
<ui:StatusGlyph x:Name="State" Grid.Column="2" Kind="{Binding AvailabilityKind}" Text="{Binding AvailabilityText}" VerticalAlignment="Center"
|
||||
Margin="8,0,0,0" ToolTip="{Binding AvailabilityToolTip}" Visibility="Collapsed" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding HasChildren}" Value="True">
|
||||
<Setter TargetName="Toggle" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsExpanded}" Value="True">
|
||||
<Setter TargetName="Toggle" Property="ui:ButtonIcon.Glyph" Value="{StaticResource Icon.ChevronDown}" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsArchive}" Value="True">
|
||||
<Setter TargetName="Title" Property="FontWeight" Value="SemiBold" />
|
||||
<Setter TargetName="State" Property="Visibility" Value="Visible" />
|
||||
<Setter TargetName="Toggle" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsYear}" Value="True">
|
||||
<Setter TargetName="Title" Property="FontWeight" Value="SemiBold" />
|
||||
<Setter TargetName="Detail" Property="Visibility" Value="Visible" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<!-- Figure tiles (Archive.html). -->
|
||||
<ItemsControl ItemsSource="{Binding Tiles}" Focusable="False">
|
||||
<ItemsControl.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<UniformGrid Rows="1" />
|
||||
</ItemsPanelTemplate>
|
||||
</ItemsControl.ItemsPanel>
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:ArchiveTile}">
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="14,8" Margin="0,0,10,0" ToolTip="{Binding Caption}">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{Binding Value}" FontSize="22" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Text="{Binding Caption}" Style="{StaticResource Text.Secondary}" TextTrimming="CharacterEllipsis" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
|
||||
<Grid Grid.Row="1" Margin="0,12,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.2*" />
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Months}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||
<v:HeatmapStrip Rows="{Binding MonthRows}" ColumnLabels="{Binding MonthLabels}" ValueFormatter="{Binding CountFormatter}" MaxCellSize="18"
|
||||
ToolTip="{l:Loc Tooltips.Archive.Months}" AutomationProperties.Name="{l:Loc Archive.Chart.Months}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Storage}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||
<v:BarChart Items="{Binding StorageBars}" MinimumOpacity="0.55" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Storage}"
|
||||
AutomationProperties.Name="{l:Loc Archive.Chart.Storage}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Margin="0,12,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="12" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Cameras}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||
<v:BarChart Items="{Binding CameraBars}" BrushKey="Brush.Sun" MinimumOpacity="0.45" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Cameras}"
|
||||
AutomationProperties.Name="{l:Loc Archive.Chart.Cameras}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="14,10">
|
||||
<DockPanel>
|
||||
<TextBlock DockPanel.Dock="Top" Text="{l:Loc Archive.Chart.Formats}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||
<v:BarChart Items="{Binding FormatBars}" MinimumOpacity="0.35" BarThickness="12" ToolTip="{l:Loc Tooltips.Archive.Formats}"
|
||||
AutomationProperties.Name="{l:Loc Archive.Chart.Formats}" />
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- ===================== Maintenance: health, recent runs, duplicates, orphans ===================== -->
|
||||
<Grid Grid.Row="1" Visibility="{Binding IsMaintenance, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="14" />
|
||||
<ColumnDefinition Width="1.1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="16,12">
|
||||
<StackPanel>
|
||||
<TextBlock Text="{l:Loc Archive.Health.Title}" Style="{StaticResource Text.PanelHeading}" Margin="0,0,0,8" />
|
||||
<ItemsControl ItemsSource="{Binding Health}" Focusable="False">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:HealthLineViewModel}">
|
||||
<DockPanel Height="32">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{Binding FixText}" Command="{Binding FixCommand}"
|
||||
ToolTip="{Binding FixToolTip}" Visibility="{Binding HasFix, Converter={StaticResource BoolToVisibility}}" />
|
||||
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Text}" FontSize="13" VerticalAlignment="Center" ToolTip="{Binding KindToolTip}" />
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Style="{StaticResource Border.Panel}" Padding="16,12" Margin="0,14,0,0">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Recent.History}" Command="{Binding HistoryCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.History}" />
|
||||
<TextBlock Text="{l:Loc Archive.Recent.Title}" Style="{StaticResource Text.PanelHeading}" />
|
||||
</DockPanel>
|
||||
<ItemsControl ItemsSource="{Binding Recent}" Focusable="False">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:MaintenanceRow}">
|
||||
<Grid Height="28">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" MinWidth="90" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding DateText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding Text}" Margin="12,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis" ToolTip="{Binding Text}" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding StateText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Border Style="{StaticResource Border.Panel}" Padding="16,12">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="8,0,0,0" Content="{l:Loc Archive.Duplicates.Mark}"
|
||||
Command="{Binding MarkDuplicatesCommand}" ToolTip="{l:Loc Tooltips.Archive.MarkDuplicates}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindDuplicatesCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.Duplicates}" />
|
||||
<TextBlock Text="{l:Loc Archive.Duplicates.Title}" Style="{StaticResource Text.PanelHeading}" />
|
||||
<TextBlock Text="{Binding DuplicatesText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
<ListBox ItemsSource="{Binding Duplicates}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}" AutomationProperties.Name="{l:Loc Archive.Duplicates.Title}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:DuplicateRowViewModel}">
|
||||
<DockPanel Height="44">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{l:Loc Archive.Duplicates.Folder}" Command="{Binding RevealCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.DuplicateFolder}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{l:Loc Archive.Duplicates.Open}" Command="{Binding OpenCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.DuplicateOpen}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock TextTrimming="CharacterEllipsis">
|
||||
<Run Text="{Binding Row.Title, Mode=OneWay}" FontWeight="SemiBold" />
|
||||
<Run Text="{Binding Row.Detail, Mode=OneWay}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</TextBlock>
|
||||
<TextBlock Text="{Binding Places}" Style="{StaticResource Text.Secondary}" TextTrimming="CharacterEllipsis" ToolTip="{Binding Places}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Border Grid.Row="1" Style="{StaticResource Border.Panel}" Padding="16,12" Margin="0,14,0,0">
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top" Margin="0,0,0,8">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Margin="0" Content="{l:Loc Archive.Find.Run}" Command="{Binding FindOrphansCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.Orphans}" />
|
||||
<TextBlock Text="{l:Loc Archive.Orphans.Title}" Style="{StaticResource Text.PanelHeading}" />
|
||||
<TextBlock Text="{Binding OrphansText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="10,0,0,0" VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
<ListBox ItemsSource="{Binding Orphans}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}" AutomationProperties.Name="{l:Loc Archive.Orphans.Title}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type ar:OrphanRowViewModel}">
|
||||
<DockPanel Height="44">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Row}" Content="{Binding FixText}" Command="{Binding FixCommand}" ToolTip="{Binding FixToolTip}" />
|
||||
<StackPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Row.Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" ToolTip="{Binding Row.Title}" />
|
||||
<ui:StatusGlyph Kind="{Binding Kind}" Text="{Binding Row.Detail}" FontSize="12" ToolTip="{Binding KindText}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
<!-- ===================== Mass operations on the selected set ===================== -->
|
||||
<Border Grid.Row="2" Style="{StaticResource Border.Panel}" Padding="14,8,6,0" Margin="0,14,0,0" MinHeight="48"
|
||||
Visibility="{Binding IsOverview, Converter={StaticResource BoolToVisibility}}">
|
||||
<WrapPanel VerticalAlignment="Center">
|
||||
<TextBlock Text="{l:Loc Archive.Set.Label}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="0,0,10,8" />
|
||||
<Border BorderBrush="{DynamicResource Brush.Accent}" BorderThickness="1" CornerRadius="{StaticResource Radius.Control}" Padding="12,0" Height="30"
|
||||
Margin="0,0,8,8" ToolTip="{l:Loc Tooltips.Archive.Set}">
|
||||
<TextBlock Text="{Binding SetText}" VerticalAlignment="Center" Typography.NumeralAlignment="Tabular" MaxWidth="220" TextTrimming="CharacterEllipsis" />
|
||||
</Border>
|
||||
<Border Width="1" Height="22" Background="{DynamicResource Brush.Stroke}" Margin="4,0,12,8" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Analyse}" Command="{Binding AnalyseSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetAnalyse}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Proxies}" Command="{Binding ProxiesSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetProxies}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Thumbnails}" Command="{Binding ThumbnailsSetCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Archive.SetThumbnails}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Verify}" Command="{Binding VerifySetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetVerify}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Rename}" Command="{Binding RenameSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetRename}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Move}" Command="{Binding MoveSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetMove}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Retag}" Command="{Binding RetagSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetRetag}" />
|
||||
<Button Style="{StaticResource Button.Bar}" Margin="0,0,8,8" Content="{l:Loc Archive.Set.Export}" Command="{Binding ExportSetCommand}" ToolTip="{l:Loc Tooltips.Archive.SetExport}" />
|
||||
</WrapPanel>
|
||||
</Border>
|
||||
|
||||
<ui:EmptyState Grid.Row="1" Message="{l:Loc Archive.Empty}" Visibility="{Binding IsEmpty, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button Style="{StaticResource Button.Primary}" Content="{l:Loc Archive.Toolbar.Adopt}" Command="{Binding AdoptCommand}" ToolTip="{l:Loc Tooltips.Archive.Adopt}" />
|
||||
</ui:EmptyState>
|
||||
</Grid>
|
||||
|
||||
<!-- In-window dialogs (rebuild, rename, retag) over a scrim. -->
|
||||
<Grid Visibility="{Binding IsDialogOpen, Converter={StaticResource BoolToVisibility}}">
|
||||
<Border Background="{DynamicResource Brush.Scrim}" />
|
||||
<ContentPresenter Content="{Binding Dialog}" Margin="20" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,27 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using Titano.App.Archiving;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
|
||||
public partial class ArchiveView : UserControl
|
||||
{
|
||||
public ArchiveView() => InitializeComponent();
|
||||
|
||||
/// <summary>"Maintenance ▾" opens its menu under itself.</summary>
|
||||
private void OnOpenMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not Button { ContextMenu: { } menu } button) return;
|
||||
menu.DataContext = DataContext;
|
||||
menu.PlacementTarget = button;
|
||||
menu.Placement = PlacementMode.Bottom;
|
||||
menu.IsOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>The selected tree rows are the set the mass operations act on.</summary>
|
||||
private void OnTreeSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if (DataContext is ArchiveViewModel model) model.SetSelection(Tree.SelectedItems.OfType<ArchiveTreeRowViewModel>());
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,621 @@
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Windows.Input;
|
||||
using Titano.App.Archiving;
|
||||
using Titano.App.Infrastructure;
|
||||
using Titano.App.Jobs;
|
||||
using Titano.App.Shell;
|
||||
using Titano.Core.Archiving;
|
||||
using Titano.Core.Diagnostics;
|
||||
using Titano.Core.IO;
|
||||
using Titano.Core.Localization;
|
||||
using Titano.Core.Model;
|
||||
using Titano.Data;
|
||||
using Titano.Data.Archiving;
|
||||
using Titano.Data.Archiving.Jobs;
|
||||
using Titano.Data.Processing;
|
||||
using Titano.Data.Repositories;
|
||||
using Titano.Ui.Mvvm;
|
||||
using Titano.Ui.Visuals;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
|
||||
/// <summary>Archive manager (BRIEF §12.5).</summary>
|
||||
public sealed class ArchiveViewModel(ShellViewModel shell) : SectionViewModel(SectionKey.Archive, "Icon.Archive")
|
||||
/// <summary>
|
||||
/// Archive manager (BRIEF §12.5, Archive.html): the archive's tree (years, sequences) with its availability, its
|
||||
/// figures and charts, mass operations on the selected set (analyse, proxies, thumbnails, verify, rename, move,
|
||||
/// retag, CSV), and the operations on the whole archive as jobs (scan, rebuild with its dialog, verify,
|
||||
/// maintenance), plus the maintenance view: index health, duplicates and orphans with safe fixes, recent runs.
|
||||
/// </summary>
|
||||
public sealed class ArchiveViewModel : SectionViewModel
|
||||
{
|
||||
public ShellViewModel Shell { get; } = shell;
|
||||
private const int RecentCount = 6;
|
||||
private const int PageSize = 1000;
|
||||
|
||||
private readonly HashSet<ArchiveTreeNode> _selection = [];
|
||||
private IReadOnlyList<Core.Model.Archive> _archives = [];
|
||||
private Core.Model.Archive? _archive;
|
||||
private ArchiveAvailability _availability = ArchiveAvailability.Offline;
|
||||
private ArchiveStats? _stats;
|
||||
private ArchiveTree? _tree;
|
||||
private int _viewIndex;
|
||||
private bool _loaded;
|
||||
private Task _load = Task.CompletedTask;
|
||||
private bool _jobEvents;
|
||||
private string _lastScanText = string.Empty;
|
||||
private ArchiveDialogViewModel? _dialog;
|
||||
private IReadOnlyList<ArchiveTile> _tiles = [];
|
||||
private IReadOnlyList<ChartRow> _months = [];
|
||||
private IReadOnlyList<ChartItem> _storage = [];
|
||||
private IReadOnlyList<ChartItem> _cameras = [];
|
||||
private IReadOnlyList<ChartItem> _formats = [];
|
||||
private IReadOnlyList<HealthLineViewModel> _health = [];
|
||||
private IReadOnlyList<MaintenanceRow> _recent = [];
|
||||
private IReadOnlyList<DuplicateRowViewModel>? _duplicates;
|
||||
private IReadOnlyList<OrphanRowViewModel>? _orphans;
|
||||
private bool _findingDuplicates;
|
||||
private bool _findingOrphans;
|
||||
|
||||
public ArchiveViewModel(ShellViewModel shell)
|
||||
: base(SectionKey.Archive, "Icon.Archive")
|
||||
{
|
||||
Shell = shell;
|
||||
ScanCommand = new AsyncRelayCommand(() => QueueAsync(a => ArchiveJobs.Scan(a)), IsOnline);
|
||||
RebuildCommand = new AsyncRelayCommand(() => OpenRebuildDialogAsync(), () => _archive is not null);
|
||||
VerifyCommand = new AsyncRelayCommand(() => QueueAsync(a => ArchiveJobs.Verify(a)), IsOnline);
|
||||
AdoptCommand = new AsyncRelayCommand(AdoptAsync);
|
||||
MaintenanceCommand = new AsyncRelayCommand(() => QueueAsync(a => ArchiveJobs.Maintenance(a)), IsOnline);
|
||||
MaintenanceDryRunCommand = new AsyncRelayCommand(() => QueueAsync(a => ArchiveJobs.Maintenance(a, dryRun: true)), () => _archive is not null);
|
||||
RebuildProxiesCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Proxies(ids, SetLabel(), force: true), All()), IsOnline);
|
||||
RelinkCommand = new AsyncRelayCommand(RelinkAsync);
|
||||
HistoryCommand = new RelayCommand(() => Shell.Navigate(SectionKey.Jobs));
|
||||
|
||||
AnalyseSetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ProcessingJobs.DeepAnalysis(ids, SetLabel()), Set()), HasSet);
|
||||
ProxiesSetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Proxies(ids, SetLabel()), Set()), HasSet);
|
||||
ThumbnailsSetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Thumbnails(ids, SetLabel()), Set()), HasSet);
|
||||
VerifySetCommand = new AsyncRelayCommand(() => QueueSetAsync(ids => ArchiveJobs.Verify(_archive!, ids), Set()), HasSet);
|
||||
RenameSetCommand = new RelayCommand(() => OpenRename(RenameMode.Titles), () => HasSet() && IsOnline());
|
||||
MoveSetCommand = new RelayCommand(() => OpenRename(RenameMode.Folders), () => HasSet() && IsOnline());
|
||||
RetagSetCommand = new RelayCommand(OpenRetag, () => HasSet() && IsOnline());
|
||||
ExportSetCommand = new AsyncRelayCommand(ExportAsync, HasSet);
|
||||
|
||||
FindDuplicatesCommand = new AsyncRelayCommand(FindDuplicatesAsync, () => _archive is not null && !_findingDuplicates);
|
||||
FindOrphansCommand = new AsyncRelayCommand(FindOrphansAsync, () => IsOnline() && !_findingOrphans);
|
||||
MarkDuplicatesCommand = new AsyncRelayCommand(() => QueueAsync(a => ArchiveJobs.Maintenance(a)), IsOnline);
|
||||
}
|
||||
|
||||
public ShellViewModel Shell { get; }
|
||||
|
||||
private AppServices Services => Shell.Services;
|
||||
|
||||
// ---------------- Toolbar ----------------
|
||||
|
||||
public IReadOnlyList<Core.Model.Archive> Archives { get => _archives; private set => Set(ref _archives, value); }
|
||||
|
||||
public Core.Model.Archive? SelectedArchive
|
||||
{
|
||||
get => _archive;
|
||||
set
|
||||
{
|
||||
if (value is null || value == _archive) return;
|
||||
_archive = value;
|
||||
_duplicates = null;
|
||||
_orphans = null;
|
||||
_ = LoadAsync();
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasArchive => _archive is not null;
|
||||
|
||||
public string ArchiveToolTip => _archive is null ? Loc.L("Tooltips.Archive.Pick") : Loc.L("Tooltips.Archive.PickRoot", _archive.RootPath);
|
||||
|
||||
/// <summary>0 = overview (tree and figures), 1 = maintenance.</summary>
|
||||
public int ViewIndex
|
||||
{
|
||||
get => _viewIndex;
|
||||
set
|
||||
{
|
||||
if (!Set(ref _viewIndex, value)) return;
|
||||
OnPropertyChanged(nameof(IsOverview));
|
||||
OnPropertyChanged(nameof(IsMaintenance));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsOverview => HasArchive && _viewIndex == 0;
|
||||
public bool IsMaintenance => HasArchive && _viewIndex == 1;
|
||||
|
||||
/// <summary>"Last scan 29/09/2026 07:12 · 14 min".</summary>
|
||||
public string LastScanText { get => _lastScanText; private set => Set(ref _lastScanText, value); }
|
||||
|
||||
public ICommand ScanCommand { get; }
|
||||
public ICommand RebuildCommand { get; }
|
||||
public ICommand VerifyCommand { get; }
|
||||
public ICommand AdoptCommand { get; }
|
||||
public ICommand MaintenanceCommand { get; }
|
||||
public ICommand MaintenanceDryRunCommand { get; }
|
||||
public ICommand RebuildProxiesCommand { get; }
|
||||
public ICommand RelinkCommand { get; }
|
||||
public ICommand HistoryCommand { get; }
|
||||
|
||||
// ---------------- Overview ----------------
|
||||
|
||||
public ObservableCollection<ArchiveTreeRowViewModel> TreeRows { get; } = [];
|
||||
|
||||
public IReadOnlyList<ArchiveTile> Tiles { get => _tiles; private set => Set(ref _tiles, value); }
|
||||
public IReadOnlyList<ChartRow> MonthRows { get => _months; private set => Set(ref _months, value); }
|
||||
public IReadOnlyList<string> MonthLabels => ArchiveFigures.MonthLabels();
|
||||
public IReadOnlyList<ChartItem> StorageBars { get => _storage; private set => Set(ref _storage, value); }
|
||||
public IReadOnlyList<ChartItem> CameraBars { get => _cameras; private set => Set(ref _cameras, value); }
|
||||
public IReadOnlyList<ChartItem> FormatBars { get => _formats; private set => Set(ref _formats, value); }
|
||||
|
||||
/// <summary>Photos per month in the culture's digits.</summary>
|
||||
public Func<double, string> CountFormatter { get; } = v => Formatting.Count((long)v);
|
||||
|
||||
/// <summary>"412 sequences · all", "36 sequences · 2025", "Harbour sunset".</summary>
|
||||
public string SetText
|
||||
{
|
||||
get
|
||||
{
|
||||
var set = Set();
|
||||
if (_selection.Count == 0 || _selection.Any(n => n.Kind == TreeNodeKind.Archive)) return Loc.Plural("Archive.Set.All", set.Count);
|
||||
return set.Count == 1 ? set[0].DisplayTitle : Loc.Plural("Shell.Status.Sequences", set.Count);
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand AnalyseSetCommand { get; }
|
||||
public ICommand ProxiesSetCommand { get; }
|
||||
public ICommand ThumbnailsSetCommand { get; }
|
||||
public ICommand VerifySetCommand { get; }
|
||||
public ICommand RenameSetCommand { get; }
|
||||
public ICommand MoveSetCommand { get; }
|
||||
public ICommand RetagSetCommand { get; }
|
||||
public ICommand ExportSetCommand { get; }
|
||||
|
||||
/// <summary>The view reports the selected tree rows.</summary>
|
||||
public void SetSelection(IEnumerable<ArchiveTreeRowViewModel> rows)
|
||||
{
|
||||
_selection.Clear();
|
||||
foreach (var row in rows) _selection.Add(row.Node);
|
||||
OnPropertyChanged(nameof(SetText));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
|
||||
// ---------------- Maintenance view ----------------
|
||||
|
||||
public IReadOnlyList<HealthLineViewModel> Health { get => _health; private set => Set(ref _health, value); }
|
||||
public IReadOnlyList<MaintenanceRow> Recent { get => _recent; private set => Set(ref _recent, value); }
|
||||
|
||||
public IReadOnlyList<DuplicateRowViewModel>? Duplicates
|
||||
{
|
||||
get => _duplicates;
|
||||
private set
|
||||
{
|
||||
if (Set(ref _duplicates, value)) OnPropertyChanged(nameof(DuplicatesText));
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<OrphanRowViewModel>? Orphans
|
||||
{
|
||||
get => _orphans;
|
||||
private set
|
||||
{
|
||||
if (Set(ref _orphans, value)) OnPropertyChanged(nameof(OrphansText));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>"3 groups", "None found", or empty before the first search.</summary>
|
||||
public string DuplicatesText => _findingDuplicates ? Loc.L("Archive.Find.Searching")
|
||||
: _duplicates is null ? string.Empty
|
||||
: _duplicates.Count == 0 ? Loc.L("Archive.Find.None")
|
||||
: Loc.Plural("Archive.Duplicates.Groups", _duplicates.Count);
|
||||
|
||||
public string OrphansText => _findingOrphans ? Loc.L("Archive.Find.Searching")
|
||||
: _orphans is null ? string.Empty
|
||||
: _orphans.Count == 0 ? Loc.L("Archive.Find.None")
|
||||
: Loc.Plural("Archive.Orphans.Count", _orphans.Count);
|
||||
|
||||
public ICommand FindDuplicatesCommand { get; }
|
||||
public ICommand FindOrphansCommand { get; }
|
||||
public ICommand MarkDuplicatesCommand { get; }
|
||||
|
||||
// ---------------- Dialogs ----------------
|
||||
|
||||
/// <summary>The open in-window dialog (rebuild, rename, retag); null when none.</summary>
|
||||
public ArchiveDialogViewModel? Dialog
|
||||
{
|
||||
get => _dialog;
|
||||
private set
|
||||
{
|
||||
if (Set(ref _dialog, value)) OnPropertyChanged(nameof(IsDialogOpen));
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDialogOpen => _dialog is not null;
|
||||
|
||||
public bool IsEmpty => _loaded && _archive is null;
|
||||
|
||||
// ---------------- Lifecycle ----------------
|
||||
|
||||
protected override void OnActivated()
|
||||
{
|
||||
if (_loaded) return;
|
||||
_ = LoadAsync();
|
||||
}
|
||||
|
||||
/// <summary>Reads archives, figures, tree, health and recent maintenance of the selected archive; joins a read in progress.</summary>
|
||||
public Task LoadAsync() => _load.IsCompleted ? _load = ReadAsync() : _load;
|
||||
|
||||
private async Task ReadAsync()
|
||||
{
|
||||
if (Services.Database is not { } db) return;
|
||||
try
|
||||
{
|
||||
AttachJobEvents();
|
||||
Archives = await db.Archives.ListAsync();
|
||||
_archive = _archive is { } current ? Archives.FirstOrDefault(a => a.Id == current.Id) : null;
|
||||
_archive ??= CurrentArchive.Pick(Archives, Services.Settings.LastArchivePath);
|
||||
if (_archive is not { } archive) return;
|
||||
var root = archive.RootPath;
|
||||
_availability = await Task.Run(() => ArchiveVolume.Probe(new ArchivePaths(root)));
|
||||
_stats = await db.Sequences.GetStatsAsync(archive.Id);
|
||||
var sequences = await ListSequencesAsync(db, archive.Id);
|
||||
var withoutProxies = await db.Sequences.CountAsync(new SequenceQuery { ArchiveId = archive.Id, WithoutStatus = SequenceStatus.ProxiesBuilt });
|
||||
ShowFigures(_stats, withoutProxies);
|
||||
ShowTree(ArchiveTree.Build(archive, _availability, sequences));
|
||||
await LoadRecentAsync(db, archive);
|
||||
}
|
||||
catch (DatabaseException ex)
|
||||
{
|
||||
Log.Warning("archive", "Archive figures unavailable", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_loaded = true;
|
||||
OnPropertyChanged(string.Empty);
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens the rebuild dialog (BRIEF §12.5) and counts, off the UI thread, the sidecars the rebuild will read.</summary>
|
||||
public async Task<RebuildDialogViewModel?> OpenRebuildDialogAsync()
|
||||
{
|
||||
if (_archive is not { } archive || Services.Engine is not { } engine) return null;
|
||||
var dialog = new RebuildDialogViewModel(archive, _availability, _stats?.Sequences ?? 0, async () =>
|
||||
{
|
||||
var request = ArchiveJobs.Rebuild(archive);
|
||||
await engine.EnqueueAsync(request);
|
||||
Queued(request.Kind, archive.Name);
|
||||
}, CloseDialog);
|
||||
Dialog = dialog;
|
||||
await dialog.CountAsync();
|
||||
return dialog;
|
||||
}
|
||||
|
||||
/// <summary>Shows reports computed elsewhere (capture).</summary>
|
||||
public void ShowReports(IReadOnlyList<DuplicateGroup> duplicates, OrphanReport orphans, IReadOnlyList<SequenceLocation> locations)
|
||||
{
|
||||
Duplicates = DuplicateRows(duplicates, locations);
|
||||
Orphans = OrphanRows(orphans, locations);
|
||||
}
|
||||
|
||||
public override void Dispose()
|
||||
{
|
||||
if (_jobEvents && Services.Jobs is { } jobs) jobs.JobChanged -= OnJobChanged;
|
||||
_dialog?.Dispose();
|
||||
base.Dispose();
|
||||
}
|
||||
|
||||
private static async Task<List<Sequence>> ListSequencesAsync(TitanoDatabase db, Guid archiveId)
|
||||
{
|
||||
var all = new List<Sequence>();
|
||||
string? cursor = null;
|
||||
do
|
||||
{
|
||||
var page = await db.Sequences.ListAsync(new SequenceQuery { ArchiveId = archiveId, Sort = SequenceSort.Newest, Limit = PageSize, Cursor = cursor });
|
||||
all.AddRange(page.Items);
|
||||
cursor = page.NextCursor;
|
||||
}
|
||||
while (cursor is not null);
|
||||
return all;
|
||||
}
|
||||
|
||||
private void ShowFigures(ArchiveStats stats, int withoutProxies)
|
||||
{
|
||||
Tiles = ArchiveFigures.Tiles(stats);
|
||||
MonthRows = [.. ArchiveFigures.PhotosPerMonth(stats, DateTime.Today).Select(r => new ChartRow(r.Label, r.Values, r.ToolTips))];
|
||||
StorageBars = Bars(ArchiveFigures.StorageByYear(stats));
|
||||
CameraBars = Bars(ArchiveFigures.ByCamera(stats));
|
||||
FormatBars = Bars(ArchiveFigures.ByFormat(stats));
|
||||
Health =
|
||||
[
|
||||
.. ArchiveFigures.Health(stats, withoutProxies).Select(line => new HealthLineViewModel(line, line.Action switch
|
||||
{
|
||||
HealthAction.Verify => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.Verified, ids => ArchiveJobs.Verify(_archive!, ids))),
|
||||
HealthAction.Proxies => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.ProxiesBuilt, ids => ArchiveJobs.Proxies(ids, CountLabel(ids)))),
|
||||
HealthAction.Analyse => new AsyncRelayCommand(() => QueueStatusAsync(SequenceStatus.AnalyzedLight, ids => ProcessingJobs.LightAnalysis(ids, CountLabel(ids)))),
|
||||
HealthAction.Duplicates => FindDuplicatesCommand,
|
||||
HealthAction.Orphans => FindOrphansCommand,
|
||||
_ => null,
|
||||
})),
|
||||
];
|
||||
}
|
||||
|
||||
private static IReadOnlyList<ChartItem> Bars(IReadOnlyList<BarValue> values) =>
|
||||
[.. values.Select(v => new ChartItem(v.Label, v.Value, v.ValueText, v.ToolTip))];
|
||||
|
||||
private void ShowTree(ArchiveTree tree)
|
||||
{
|
||||
var expanded = _tree?.ExpandedKeys();
|
||||
if (expanded is not null) tree.Expand(expanded);
|
||||
else if (tree.Root.Children.Count > 0) tree.Root.Children[0].IsExpanded = true;
|
||||
_tree = tree;
|
||||
_selection.Clear();
|
||||
RebuildRows();
|
||||
}
|
||||
|
||||
private void RebuildRows()
|
||||
{
|
||||
TreeRows.Clear();
|
||||
if (_tree is null) return;
|
||||
foreach (var node in _tree.Visible()) TreeRows.Add(new ArchiveTreeRowViewModel(node, _tree.Availability, Toggle));
|
||||
OnPropertyChanged(nameof(SetText));
|
||||
}
|
||||
|
||||
private void Toggle(ArchiveTreeNode node)
|
||||
{
|
||||
if (node.Kind == TreeNodeKind.Archive) return;
|
||||
node.IsExpanded = !node.IsExpanded;
|
||||
RebuildRows();
|
||||
}
|
||||
|
||||
private async Task LoadRecentAsync(TitanoDatabase db, Core.Model.Archive archive)
|
||||
{
|
||||
var jobs = new List<Job>();
|
||||
foreach (var kind in MaintenanceReports.MaintenanceKinds)
|
||||
jobs.AddRange((await db.Jobs.ListAsync(null, kind, RecentCount)).Items.Where(j => j.TargetIds.Contains(archive.Id)));
|
||||
Recent = MaintenanceReports.Recent(jobs, RecentCount);
|
||||
var scan = jobs.Where(j => j.Kind == JobKind.Scan && j is { State: JobState.Done, Finished: not null, Started: not null })
|
||||
.MaxBy(j => j.Finished);
|
||||
LastScanText = scan is { Started: { } started, Finished: { } finished }
|
||||
? Loc.L("Archive.LastScan", Formatting.Date(finished) + " " + Formatting.TimeOfDay(finished), Formatting.Duration(finished - started))
|
||||
: string.Empty;
|
||||
}
|
||||
|
||||
private void AttachJobEvents()
|
||||
{
|
||||
if (_jobEvents || Services.Jobs is not { } jobs) return;
|
||||
jobs.JobChanged += OnJobChanged;
|
||||
_jobEvents = true;
|
||||
}
|
||||
|
||||
/// <summary>A finished archive job changes the figures: read them again.</summary>
|
||||
private void OnJobChanged(Job job)
|
||||
{
|
||||
if (job.State is not (JobState.Done or JobState.Failed) || _archive is null) return;
|
||||
if (job.Kind is not (JobKind.Scan or JobKind.Rebuild or JobKind.Verify or JobKind.Maintenance or JobKind.Import or JobKind.Proxies or JobKind.Thumbs
|
||||
or JobKind.LightAnalyse or JobKind.DeepAnalyse)) return;
|
||||
System.Windows.Application.Current?.Dispatcher.BeginInvoke(() =>
|
||||
{
|
||||
if (IsSelected) _ = LoadAsync();
|
||||
else _loaded = false;
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------- Actions ----------------
|
||||
|
||||
private bool IsOnline() => _archive is not null && _availability == ArchiveAvailability.Online;
|
||||
|
||||
private bool HasSet() => _archive is not null && _tree is not null && Set().Count > 0;
|
||||
|
||||
private IReadOnlyList<Sequence> Set() => _tree is null ? [] : ArchiveTree.SetOf(_tree, _selection);
|
||||
|
||||
private IReadOnlyList<Sequence> All() => _tree is null ? [] : ArchiveTree.SetOf(_tree, []);
|
||||
|
||||
private string SetLabel() => SetText;
|
||||
|
||||
private async Task QueueAsync(Func<Core.Model.Archive, ArchiveJobRequest> build)
|
||||
{
|
||||
if (Services.Engine is not { } engine || _archive is not { } archive) return;
|
||||
var request = build(archive);
|
||||
await engine.EnqueueAsync(request);
|
||||
Queued(request.Kind, request.Label ?? archive.Name);
|
||||
}
|
||||
|
||||
private async Task QueueSetAsync(Func<IReadOnlyList<Guid>, ArchiveJobRequest> build, IReadOnlyList<Sequence> set)
|
||||
{
|
||||
if (Services.Engine is not { } engine || set.Count == 0) return;
|
||||
var request = build([.. set.Select(s => s.Id)]);
|
||||
await engine.EnqueueAsync(request);
|
||||
Queued(request.Kind, request.Label ?? SetLabel());
|
||||
}
|
||||
|
||||
/// <summary>Health fixes act on the sequences that miss a status (never verified, no proxies).</summary>
|
||||
private async Task QueueStatusAsync(SequenceStatus missing, Func<IReadOnlyList<Guid>, ArchiveJobRequest> build)
|
||||
{
|
||||
if (Services.Database is not { } db || _archive is not { } archive) return;
|
||||
var page = await db.Sequences.ListAsync(new SequenceQuery { ArchiveId = archive.Id, WithoutStatus = missing, Limit = PageSize });
|
||||
await QueueSetAsync(build, page.Items);
|
||||
}
|
||||
|
||||
private static string CountLabel(IReadOnlyList<Guid> ids) => Loc.Plural("Shell.Status.Sequences", ids.Count);
|
||||
|
||||
private void Queued(JobKind kind, string label) =>
|
||||
Shell.Notify(Loc.L("Library.Queued", JobText.Kind(kind), label), actionText: Loc.L("Shell.Nav.Jobs"), actionToolTip: Loc.L("Tooltips.Nav.Jobs"),
|
||||
action: () => Shell.Navigate(SectionKey.Jobs));
|
||||
|
||||
private void OpenRename(RenameMode mode)
|
||||
{
|
||||
if (Services.Archives is not { } archives || _archive is not { } archive) return;
|
||||
var dialog = new RenameDialogViewModel(mode, archives, archive, Set(), Applied, CloseDialog);
|
||||
Dialog = dialog;
|
||||
_ = dialog.PlanAsync();
|
||||
}
|
||||
|
||||
private void OpenRetag()
|
||||
{
|
||||
if (Services.Archives is not { } archives) return;
|
||||
Dialog = new RetagDialogViewModel(archives, Set(), Applied, CloseDialog);
|
||||
}
|
||||
|
||||
private async Task Applied(int changed)
|
||||
{
|
||||
Shell.Notify(Loc.Plural("Archive.Applied", changed));
|
||||
await LoadAsync();
|
||||
await Shell.Library.RefreshAsync();
|
||||
}
|
||||
|
||||
private void CloseDialog()
|
||||
{
|
||||
_dialog?.Dispose();
|
||||
Dialog = null;
|
||||
}
|
||||
|
||||
private async Task AdoptAsync()
|
||||
{
|
||||
var folder = Services.Dialogs.PickFolder(Loc.L("Library.Adopt.Title"));
|
||||
if (folder is null) return;
|
||||
if (await ArchiveActions.TryAsync(Shell, s => s.AdoptAsync(folder)))
|
||||
{
|
||||
_archive = null;
|
||||
await LoadAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A moved archive keeps its id: opening it at the new root relinks every sequence (BRIEF §12.5 Move archive).</summary>
|
||||
private async Task RelinkAsync()
|
||||
{
|
||||
if (Services.Archives is not { } archives) return;
|
||||
var folder = Services.Dialogs.PickFolder(Loc.L("Archive.Relink.Title"));
|
||||
if (folder is null) return;
|
||||
try
|
||||
{
|
||||
var archive = await Task.Run(() => archives.OpenAsync(folder));
|
||||
Services.Settings.LastArchivePath = archive.RootPath;
|
||||
Services.SaveSettings();
|
||||
_archive = archive;
|
||||
await Services.QueueScanAsync(archive, full: false);
|
||||
Shell.Notify(Loc.L("Archive.Relink.Done", archive.Name), archive.RootPath);
|
||||
await LoadAsync();
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or DatabaseException)
|
||||
{
|
||||
Log.Warning("archive", $"Relinking {folder} failed", ex);
|
||||
Shell.Notify(Loc.L("Archive.Relink.Failed"), ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ExportAsync()
|
||||
{
|
||||
var set = Set();
|
||||
var folder = Services.Dialogs.PickFolder(Loc.L("Library.Export.Title"));
|
||||
if (folder is null || set.Count == 0) return;
|
||||
var path = Path.Combine(folder, $"Titano sequences {DateTime.Now:yyyy-MM-dd HHmm}.csv");
|
||||
var csv = LibraryViewModel.Csv(set);
|
||||
await Task.Run(() => AtomicFile.WriteAllText(path, csv));
|
||||
Shell.Notify(Loc.L("Library.Export.Done"), Path.GetFileName(path), Loc.L("Library.Export.Show"), Loc.L("Tooltips.Library.ShowExport"),
|
||||
() => ShellActions.Reveal(path));
|
||||
}
|
||||
|
||||
private async Task FindDuplicatesAsync()
|
||||
{
|
||||
if (Services.Archives is not { } archives || Services.Database is not { } db || _archive is not { } archive) return;
|
||||
ViewIndex = 1;
|
||||
_findingDuplicates = true;
|
||||
OnPropertyChanged(nameof(DuplicatesText));
|
||||
try
|
||||
{
|
||||
var groups = await Task.Run(() => archives.FindDuplicatesAsync(archive.Id));
|
||||
Duplicates = DuplicateRows(groups, await db.Sequences.ListLocationsAsync(archive.Id));
|
||||
}
|
||||
catch (DatabaseException ex)
|
||||
{
|
||||
Shell.ReportError(ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_findingDuplicates = false;
|
||||
OnPropertyChanged(nameof(DuplicatesText));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task FindOrphansAsync()
|
||||
{
|
||||
if (Services.Archives is not { } archives || Services.Database is not { } db || _archive is not { } archive) return;
|
||||
ViewIndex = 1;
|
||||
_findingOrphans = true;
|
||||
OnPropertyChanged(nameof(OrphansText));
|
||||
try
|
||||
{
|
||||
var report = await Task.Run(() => archives.FindOrphansAsync(archive.Id));
|
||||
Orphans = OrphanRows(report, await db.Sequences.ListLocationsAsync(archive.Id));
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or ArchiveOfflineException or DatabaseException)
|
||||
{
|
||||
Log.Warning("archive", "Orphan search failed", ex);
|
||||
Shell.Notify(Loc.L("Archive.Orphans.Failed"), ex.Message);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_findingOrphans = false;
|
||||
OnPropertyChanged(nameof(OrphansText));
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
|
||||
private IReadOnlyList<DuplicateRowViewModel> DuplicateRows(IReadOnlyList<DuplicateGroup> groups, IReadOnlyList<SequenceLocation> locations) =>
|
||||
[
|
||||
.. MaintenanceReports.Duplicates(groups, locations).Select(row => new DuplicateRowViewModel(row,
|
||||
new RelayCommand(() => Shell.OpenSequence(row.SequenceId)),
|
||||
new RelayCommand(() =>
|
||||
{
|
||||
if (_archive is { } archive && locations.FirstOrDefault(l => l.Id == row.SequenceId) is { } location)
|
||||
ShellActions.Reveal(new ArchivePaths(archive.RootPath).Sequence(location.Folder).Folder);
|
||||
}))),
|
||||
];
|
||||
|
||||
private IReadOnlyList<OrphanRowViewModel> OrphanRows(OrphanReport report, IReadOnlyList<SequenceLocation> locations) =>
|
||||
[.. MaintenanceReports.Orphans(report, locations).Select(row => new OrphanRowViewModel(row, new AsyncRelayCommand(() => FixAsync(row))))];
|
||||
|
||||
/// <summary>The safe fix of an orphan line; removing an index row asks first (its sidecar is gone, its files are not touched).</summary>
|
||||
private async Task FixAsync(OrphanRow row)
|
||||
{
|
||||
if (Services.Archives is not { } archives || _archive is not { } archive) return;
|
||||
try
|
||||
{
|
||||
switch (row.Kind)
|
||||
{
|
||||
case OrphanKind.UnlistedFiles or OrphanKind.MissingFiles when row.SequenceId is { } id:
|
||||
await Task.Run(() => archives.ReconcileAsync(id));
|
||||
break;
|
||||
case OrphanKind.MissingSequence when row.SequenceId is { } id:
|
||||
var confirmed = Services.Dialogs.Confirm(new ConfirmRequest
|
||||
{
|
||||
Heading = Loc.L("Archive.Confirm.RemoveHeading", row.Title),
|
||||
Message = Loc.L("Archive.Confirm.RemoveMessage"),
|
||||
SafeText = Loc.L("Archive.Confirm.Keep"),
|
||||
SafeToolTip = Loc.L("Tooltips.Archive.KeepRow"),
|
||||
ActionText = Loc.L("Archive.Confirm.Remove"),
|
||||
ActionToolTip = Loc.L("Tooltips.Archive.Orphans.MissingSequence"),
|
||||
IsDestructive = true,
|
||||
});
|
||||
if (!confirmed) return;
|
||||
await Task.Run(() => archives.RemoveMissingSequencesAsync(archive.Id, [id]));
|
||||
break;
|
||||
case OrphanKind.NewFolder:
|
||||
await Services.QueueScanAsync(archive, full: false);
|
||||
Queued(JobKind.Scan, archive.Name);
|
||||
return;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
Orphans = Orphans?.Where(o => o.Row != row).ToList();
|
||||
await LoadAsync();
|
||||
}
|
||||
catch (Exception ex) when (ex is IOException or UnauthorizedAccessException or InvalidDataException or ArchiveOfflineException or DatabaseException
|
||||
or ArgumentException)
|
||||
{
|
||||
Log.Warning("archive", $"Fixing {row.Title} failed", ex);
|
||||
Shell.Notify(Loc.L("Archive.Orphans.FixFailed"), ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,524 @@
|
||||
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">
|
||||
<Grid Margin="20">
|
||||
<ui:EmptyState Message="{l:Loc Import.Empty}" />
|
||||
xmlns:l="clr-namespace:Titano.Ui.Localization;assembly=Titano.Ui"
|
||||
xmlns:imp="clr-namespace:Titano.App.Import"
|
||||
xmlns:shell="clr-namespace:Titano.App.Shell">
|
||||
<UserControl.InputBindings>
|
||||
<KeyBinding Key="Enter" Modifiers="Control" Command="{Binding StartCommand}" />
|
||||
</UserControl.InputBindings>
|
||||
<UserControl.Resources>
|
||||
<!-- Devices list entry (Import.html): 54 px, Surface fill, Stroke border; selected = accent border. -->
|
||||
<Style x:Key="ListBoxItem.Device" TargetType="ListBoxItem" BasedOn="{StaticResource {x:Type ListBoxItem}}">
|
||||
<Setter Property="Height" Value="54" />
|
||||
<Setter Property="Margin" Value="0,0,0,8" />
|
||||
<Setter Property="Padding" Value="12,0" />
|
||||
<Setter Property="Background" Value="{DynamicResource Brush.Surface}" />
|
||||
<Setter Property="ToolTip" Value="{Binding StateText}" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="ListBoxItem">
|
||||
<Border x:Name="Bd" Background="{DynamicResource Brush.Surface}" BorderThickness="1" BorderBrush="{DynamicResource Brush.Stroke}"
|
||||
CornerRadius="{StaticResource Radius.Control}" Padding="{TemplateBinding Padding}">
|
||||
<ContentPresenter VerticalAlignment="Center" />
|
||||
</Border>
|
||||
<ControlTemplate.Triggers>
|
||||
<Trigger Property="IsMouseOver" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
</Trigger>
|
||||
<Trigger Property="IsSelected" Value="True">
|
||||
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource Brush.Card}" />
|
||||
<Setter TargetName="Bd" Property="BorderBrush" Value="{DynamicResource Brush.Accent}" />
|
||||
</Trigger>
|
||||
</ControlTemplate.Triggers>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<!-- One form line: 116 px label column, then the controls (Import.html grid). -->
|
||||
<Style x:Key="Import.Row" TargetType="HeaderedContentControl">
|
||||
<Setter Property="Focusable" Value="False" />
|
||||
<Setter Property="Margin" Value="0,0,0,10" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="HeaderedContentControl">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="{StaticResource Grid.LabelColumn}" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{TemplateBinding Header}" Style="{StaticResource Text.Label}" VerticalAlignment="Top" Margin="0,6,12,0" />
|
||||
<ContentPresenter Grid.Column="1" VerticalAlignment="Center" />
|
||||
</Grid>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style x:Key="Import.Choice" TargetType="FrameworkElement">
|
||||
<Setter Property="Margin" Value="0,4,18,4" />
|
||||
<Setter Property="VerticalAlignment" Value="Center" />
|
||||
</Style>
|
||||
<Style TargetType="RadioButton" BasedOn="{StaticResource {x:Type RadioButton}}">
|
||||
<Setter Property="Margin" Value="0,4,18,4" />
|
||||
</Style>
|
||||
<Style TargetType="CheckBox" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||
<Setter Property="Margin" Value="0,4,18,4" />
|
||||
</Style>
|
||||
<Style x:Key="TextBox.Small" TargetType="TextBox" BasedOn="{StaticResource TextBox.Number}">
|
||||
<Setter Property="Width" Value="56" />
|
||||
<Setter Property="Height" Value="30" />
|
||||
<Setter Property="Margin" Value="6,0" />
|
||||
</Style>
|
||||
|
||||
<!-- Session table columns, shared by header and rows. -->
|
||||
<Style x:Key="Session.Grid" TargetType="Grid">
|
||||
<Setter Property="Height" Value="34" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
|
||||
<Grid Margin="20,16">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="0.36*" MinWidth="220" MaxWidth="300" />
|
||||
<ColumnDefinition Width="16" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<!-- ===================== Devices ===================== -->
|
||||
<DockPanel>
|
||||
<DockPanel DockPanel.Dock="Top" Height="32" Margin="0,0,0,8">
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Icon}" ui:ButtonIcon.Glyph="{StaticResource Icon.Refresh}" Command="{Binding RefreshCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Import.Refresh}" AutomationProperties.Name="{l:Loc Import.Devices.Refresh}" />
|
||||
<TextBlock Text="{l:Loc Import.Devices.Title}" Style="{StaticResource Text.Section}" VerticalAlignment="Center" />
|
||||
</DockPanel>
|
||||
<CheckBox DockPanel.Dock="Bottom" Margin="0,8,0,0" IsChecked="{Binding AutoImport}" IsEnabled="{Binding CanAutoImport}" ToolTip="{Binding AutoImportToolTip}"
|
||||
VerticalContentAlignment="Top">
|
||||
<TextBlock Text="{l:Loc Import.Devices.Auto}" TextWrapping="Wrap" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</CheckBox>
|
||||
<Button DockPanel.Dock="Bottom" Height="44" HorizontalContentAlignment="Left" Background="Transparent" Command="{Binding PickFolderCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Import.Folder}" Margin="0,0,0,8">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:Icon Glyph="{StaticResource Icon.Folder}" Margin="0,0,10,0" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
<TextBlock Text="{l:Loc Import.Devices.Folder}" Foreground="{DynamicResource Brush.TextMuted}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<ListBox ItemsSource="{Binding Sources}" SelectedItem="{Binding SelectedSource}" ItemContainerStyle="{StaticResource ListBoxItem.Device}"
|
||||
AutomationProperties.Name="{l:Loc Import.Devices.Title}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type imp:ImportSource}">
|
||||
<Grid x:Name="Root">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ui:Icon x:Name="Glyph" Glyph="{StaticResource Icon.Card}" Size="18" Margin="0,0,10,0" VerticalAlignment="Center" />
|
||||
<StackPanel Grid.Column="1" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding Title}" FontWeight="SemiBold" TextTrimming="CharacterEllipsis" />
|
||||
<TextBlock Text="{Binding Subtitle}" Style="{StaticResource Text.Secondary}" TextTrimming="CharacterEllipsis" Margin="0,2,0,0" />
|
||||
</StackPanel>
|
||||
<ui:StatusGlyph x:Name="State" Grid.Column="2" Kind="Online" Margin="8,0,0,0" VerticalAlignment="Center" ToolTip="{Binding StateText}" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="Drive">
|
||||
<Setter TargetName="Glyph" Property="Glyph" Value="{StaticResource Icon.Drive}" />
|
||||
<Setter TargetName="State" Property="Kind" Value="Offline" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="Folder">
|
||||
<Setter TargetName="Glyph" Property="Glyph" Value="{StaticResource Icon.Folder}" />
|
||||
<Setter TargetName="State" Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsKnown}" Value="False">
|
||||
<Setter TargetName="State" Property="Kind" Value="Offline" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsInserted}" Value="False">
|
||||
<Setter TargetName="Root" Property="Opacity" Value="0.6" />
|
||||
<Setter TargetName="State" Property="Kind" Value="Offline" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</DockPanel>
|
||||
|
||||
<!-- ===================== Profile, form and plan ===================== -->
|
||||
<Border Grid.Column="2" Style="{StaticResource Border.Panel}" Padding="20,16">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Profile header: nickname (or its field for a new card), identity, Edit ▾. -->
|
||||
<DockPanel Margin="0,0,0,14" MinHeight="32">
|
||||
<Button x:Name="EditButton" DockPanel.Dock="Right" Click="OnOpenMenu" IsEnabled="{Binding CanEditProfile}" ToolTip="{l:Loc Tooltips.Import.Edit}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{l:Loc Import.Profile.Edit}" VerticalAlignment="Center" />
|
||||
<ui:Icon Glyph="{StaticResource Icon.ChevronDown}" Margin="6,0,0,0" />
|
||||
</StackPanel>
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{l:Loc Import.Profile.Rename}" Command="{Binding RenameCommand}" ToolTip="{l:Loc Tooltips.Import.Rename}" />
|
||||
<MenuItem Header="{l:Loc Import.Profile.CopyFrom}" ItemsSource="{Binding OtherCards}" ToolTip="{l:Loc Tooltips.Import.CopyFrom}">
|
||||
<MenuItem.ItemContainerStyle>
|
||||
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
|
||||
<Setter Property="Header" Value="{Binding Name}" />
|
||||
<Setter Property="Command" Value="{Binding Command}" />
|
||||
<Setter Property="ToolTip" Value="{l:Loc Tooltips.Import.CopyFrom}" />
|
||||
</Style>
|
||||
</MenuItem.ItemContainerStyle>
|
||||
</MenuItem>
|
||||
<Separator />
|
||||
<MenuItem Header="{l:Loc Import.Profile.Forget}" Command="{Binding ForgetCommand}" ToolTip="{l:Loc Tooltips.Import.Forget}" />
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
<StackPanel Orientation="Horizontal" VerticalAlignment="Center">
|
||||
<TextBlock Text="{Binding SourceTitle}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" MaxWidth="320" TextTrimming="CharacterEllipsis"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<TextBox Width="240" Text="{Binding Nickname.Text, UpdateSourceTrigger=PropertyChanged}" shell:EditBehavior.Field="{Binding Nickname}"
|
||||
ui:Field.Placeholder="{l:Loc Import.Profile.Nickname}" ToolTip="{Binding Nickname.ToolTip}" AutomationProperties.Name="{l:Loc Import.Profile.Nickname}"
|
||||
Visibility="{Binding IsNicknameOpen, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
<TextBlock Text="{Binding IdentityText}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" Margin="12,0,12,0"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding IdentityText}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- The form (Import.html grid). -->
|
||||
<StackPanel Grid.Row="1" IsEnabled="{Binding IsFormEnabled}">
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Destination}">
|
||||
<WrapPanel>
|
||||
<RadioButton GroupName="Destination" Content="{l:Loc Import.Destination.Archive}" IsChecked="{Binding IsArchiveDestination}"
|
||||
IsEnabled="{Binding CanUseArchive}" ToolTip="{Binding ArchiveToolTip}" />
|
||||
<RadioButton GroupName="Destination" Content="{l:Loc Import.Destination.Folder}" IsChecked="{Binding IsFolderDestination}"
|
||||
ToolTip="{l:Loc Tooltips.Import.FolderDestination}" Margin="0,4,8,4" />
|
||||
<TextBox Width="190" Height="30" Text="{Binding FolderPath.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FolderPath}" ToolTip="{Binding FolderPath.ToolTip}" AutomationProperties.Name="{l:Loc Import.Destination.Folder}"
|
||||
ui:Field.Placeholder="{l:Loc Import.Destination.FolderPlaceholder}" />
|
||||
<Button Style="{StaticResource Button.Icon}" Width="30" MinWidth="30" Height="30" Margin="6,0,18,0" Content="…" Command="{Binding ChooseDestinationCommand}"
|
||||
ToolTip="{l:Loc Tooltips.Import.ChooseFolder}" AutomationProperties.Name="{l:Loc Import.Destination.Choose}" />
|
||||
<RadioButton GroupName="Destination" IsChecked="{Binding IsServerDestination}" IsEnabled="{Binding CanUseServer}" ToolTip="{Binding ServerToolTip}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{l:Loc Import.Destination.Server}" />
|
||||
<ui:Icon Glyph="{StaticResource Icon.Server}" Margin="10,0,6,0" Foreground="{DynamicResource Brush.Accent}" />
|
||||
<TextBlock Text="{Binding ServerName}" Foreground="{DynamicResource Brush.Accent}" />
|
||||
</StackPanel>
|
||||
</RadioButton>
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Scan}">
|
||||
<WrapPanel>
|
||||
<CheckBox Content="{l:Loc Import.Scan.Subfolders}" IsChecked="{Binding IncludeSubfolders}" ToolTip="{l:Loc Tooltips.Import.Subfolders}" />
|
||||
<CheckBox Content="{l:Loc Import.Scan.Sessions}" IsChecked="{Binding SplitSessions}" ToolTip="{l:Loc Tooltips.Import.Sessions}" />
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}" IsEnabled="{Binding SplitSessions}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Gap}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<TextBox Style="{StaticResource TextBox.Small}" Text="{Binding GapMinutes.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding GapMinutes}" ToolTip="{Binding GapMinutes.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.GapName}" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minutes}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<StackPanel Orientation="Horizontal" Style="{StaticResource Import.Choice}">
|
||||
<TextBlock Text="{l:Loc Import.Scan.Minimum}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
<TextBox Style="{StaticResource TextBox.Small}" Text="{Binding MinimumFrames.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding MinimumFrames}" ToolTip="{Binding MinimumFrames.ToolTip}" AutomationProperties.Name="{l:Loc Import.Scan.MinimumName}" />
|
||||
<TextBlock Text="{l:Loc Import.Scan.Frames}" Foreground="{DynamicResource Brush.TextMuted}" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<CheckBox Content="{l:Loc Import.Scan.Verify}" IsChecked="{Binding VerifyCopies}" ToolTip="{l:Loc Tooltips.Import.Verify}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Names}">
|
||||
<StackPanel>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" MinWidth="140" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" MinWidth="140" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBox Style="{StaticResource TextBox.Mono}" Height="30" Text="{Binding FolderTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}"
|
||||
shell:EditBehavior.Field="{Binding FolderTemplate}" ToolTip="{Binding FolderTemplate.ToolTip}" GotKeyboardFocus="OnFolderTemplateFocus"
|
||||
AutomationProperties.Name="{l:Loc Import.Names.Folder}" />
|
||||
<TextBlock Grid.Column="1" Text="/" Foreground="{DynamicResource Brush.TextFaint}" Margin="10,0" VerticalAlignment="Center" />
|
||||
<TextBox Grid.Column="2" Style="{StaticResource TextBox.Mono}" Height="30"
|
||||
Text="{Binding FileTemplate.Text, UpdateSourceTrigger=PropertyChanged, ValidatesOnNotifyDataErrors=True}" shell:EditBehavior.Field="{Binding FileTemplate}"
|
||||
ToolTip="{Binding FileTemplate.ToolTip}" GotKeyboardFocus="OnFileTemplateFocus" AutomationProperties.Name="{l:Loc Import.Names.File}" />
|
||||
<Button x:Name="TokensButton" Grid.Column="3" Style="{StaticResource Button.Icon}" Width="30" MinWidth="30" Height="30" Margin="10,0,0,0" Content="{}{ }"
|
||||
Click="OnOpenMenu" ToolTip="{l:Loc Tooltips.Import.Tokens}" AutomationProperties.Name="{l:Loc Import.Names.Tokens}">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu ItemsSource="{Binding Tokens}" MaxHeight="420">
|
||||
<ContextMenu.ItemContainerStyle>
|
||||
<Style TargetType="MenuItem" BasedOn="{StaticResource {x:Type MenuItem}}">
|
||||
<Setter Property="Header" Value="{Binding Text}" />
|
||||
<Setter Property="InputGestureText" Value="{Binding ToolTip}" />
|
||||
<Setter Property="ToolTip" Value="{Binding ToolTip}" />
|
||||
<Setter Property="Command" Value="{Binding DataContext.InsertTokenCommand, RelativeSource={RelativeSource AncestorType=ContextMenu}}" />
|
||||
<Setter Property="CommandParameter" Value="{Binding}" />
|
||||
</Style>
|
||||
</ContextMenu.ItemContainerStyle>
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
</Grid>
|
||||
<TextBlock Text="{Binding NamePreview}" Style="{StaticResource Text.Secondary}" Foreground="{DynamicResource Brush.TextFaint}" Margin="0,6,0,0"
|
||||
TextTrimming="CharacterEllipsis" ToolTip="{Binding NamePreview}" />
|
||||
</StackPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.Duplicates}">
|
||||
<WrapPanel>
|
||||
<RadioButton GroupName="Duplicates" Content="{l:Loc Import.Duplicates.Skip}" IsChecked="{Binding SkipDuplicates}" ToolTip="{l:Loc Tooltips.Import.Skip}" />
|
||||
<RadioButton GroupName="Duplicates" Content="{l:Loc Import.Duplicates.Again}" IsChecked="{Binding ImportDuplicatesAgain}" ToolTip="{l:Loc Tooltips.Import.Again}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
|
||||
<HeaderedContentControl Style="{StaticResource Import.Row}" Header="{l:Loc Import.Label.After}" Margin="0">
|
||||
<WrapPanel>
|
||||
<RadioButton GroupName="After" Content="{l:Loc Import.After.Keep}" IsChecked="{Binding KeepCard}" ToolTip="{l:Loc Tooltips.Import.Keep}" />
|
||||
<RadioButton GroupName="After" Content="{l:Loc Import.After.Delete}" IsChecked="{Binding DeleteImported}" IsEnabled="{Binding CardActionsApply}"
|
||||
ToolTip="{l:Loc Tooltips.Import.DeleteChoice}" />
|
||||
<RadioButton GroupName="After" Content="{l:Loc Import.After.Format}" IsChecked="{Binding FormatCard}" IsEnabled="{Binding CardActionsApply}"
|
||||
ToolTip="{l:Loc Tooltips.Import.FormatChoice}" />
|
||||
<Border Width="1" Height="20" Background="{DynamicResource Brush.Stroke}" Margin="0,0,18,0" VerticalAlignment="Center" />
|
||||
<CheckBox Content="{l:Loc Import.After.Eject}" IsChecked="{Binding Eject}" ToolTip="{l:Loc Tooltips.Import.EjectChoice}" />
|
||||
<CheckBox Content="{l:Loc Import.After.Deep}" IsChecked="{Binding DeepAnalysis}" IsEnabled="{Binding IsArchiveDestination}" ToolTip="{l:Loc Tooltips.Import.Deep}" />
|
||||
</WrapPanel>
|
||||
</HeaderedContentControl>
|
||||
</StackPanel>
|
||||
|
||||
<!-- ===================== Plan panel ===================== -->
|
||||
<Border Grid.Row="2" Style="{StaticResource Border.Card}" Padding="16,14" Margin="0,14,0,0">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<DockPanel Margin="0,0,0,10">
|
||||
<TextBlock DockPanel.Dock="Left" Text="{l:Loc Import.Plan.Title}" Style="{StaticResource Text.Section}" VerticalAlignment="Center" />
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding SpaceText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0" VerticalAlignment="Center"
|
||||
ToolTip="{l:Loc Tooltips.Import.Space}" Visibility="{Binding IsSpaceShort, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<ui:StatusGlyph DockPanel.Dock="Right" Kind="Warning" Text="{Binding SpaceText}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center"
|
||||
ToolTip="{l:Loc Tooltips.Import.Space}" Visibility="{Binding IsSpaceShort, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock DockPanel.Dock="Right" Text="{Binding ImportedBeforeText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0" VerticalAlignment="Center"
|
||||
ToolTip="{l:Loc Tooltips.Import.ImportedBefore}" />
|
||||
<ui:StatusGlyph DockPanel.Dock="Right" Kind="{Binding DuplicatesKind}" Text="{Binding DuplicatesText}" FontSize="13" Margin="12,0,0,0" VerticalAlignment="Center"
|
||||
ToolTip="{l:Loc Tooltips.Import.Duplicates}" Visibility="{Binding HasPlan, Converter={StaticResource BoolToVisibility}}" />
|
||||
<TextBlock Text="{Binding TotalsText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0" VerticalAlignment="Center"
|
||||
Typography.NumeralAlignment="Tabular" TextTrimming="CharacterEllipsis" ToolTip="{Binding TotalsText}" />
|
||||
</DockPanel>
|
||||
|
||||
<!-- No source, reading the card, or the reason no plan can be made. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding ShowsStatus, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding StatusText}" Foreground="{DynamicResource Brush.TextMuted}" TextAlignment="Center" TextWrapping="Wrap" MaxWidth="420" />
|
||||
<ProgressBar IsIndeterminate="{Binding IsBusyPlanning}" Width="240" Margin="0,12,0,0"
|
||||
Visibility="{Binding IsBusyPlanning, Converter={StaticResource BoolToVisibility}}" />
|
||||
</StackPanel>
|
||||
|
||||
<!-- Sessions of the plan with editable titles. -->
|
||||
<Grid Grid.Row="1" Visibility="{Binding HasPlan, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid TextElement.FontSize="12" Margin="0,0,0,4">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.35*" MinWidth="110" />
|
||||
<ColumnDefinition Width="0.85*" MinWidth="70" />
|
||||
<ColumnDefinition Width="0.6*" MinWidth="56" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.9*" MinWidth="150" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Session}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Frames}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Camera}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="4" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Sequence}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Sessions}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}" AutomationProperties.Name="{l:Loc Import.Plan.Title}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type imp:ImportSessionRowViewModel}">
|
||||
<Grid Style="{StaticResource Session.Grid}" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.35*" MinWidth="110" />
|
||||
<ColumnDefinition Width="0.85*" MinWidth="70" />
|
||||
<ColumnDefinition Width="0.6*" MinWidth="56" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="64" />
|
||||
<ColumnDefinition Width="1.9*" MinWidth="150" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Cell}" Text="{Binding Row.TimeText}" ToolTip="{Binding Row.TimeText}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Row.FramesText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.CellNumber}" Text="{Binding Row.SizeText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Cell}" Text="{Binding Row.CameraText}" Margin="10,0,0,0" ToolTip="{Binding Row.CameraText}" />
|
||||
<DockPanel Grid.Column="4" Margin="10,0,0,0">
|
||||
<TextBlock x:Name="Target" DockPanel.Dock="Right" Text="{l:Loc Import.Session.NewShort}" Foreground="{DynamicResource Brush.Accent}"
|
||||
VerticalAlignment="Center" Margin="8,0,0,0" ToolTip="{Binding Row.TargetText}" />
|
||||
<TextBox Height="26" Padding="8,0" Text="{Binding Title.Text, UpdateSourceTrigger=PropertyChanged}" shell:EditBehavior.Field="{Binding Title}"
|
||||
ui:Field.Placeholder="{Binding Placeholder}" ToolTip="{Binding Title.ToolTip}" AutomationProperties.Name="{l:Loc Import.Session.Column.Sequence}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Row.IsNew}" Value="False">
|
||||
<Setter TargetName="Target" Property="Text" Value="{l:Loc Import.Session.AddsShort}" />
|
||||
<Setter TargetName="Target" Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
|
||||
<!-- The verification result and the after-import actions. -->
|
||||
<Grid Grid.Row="1" Grid.RowSpan="2" DataContext="{Binding Result}" Visibility="{Binding DataContext.IsDone, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:StatusGlyph Kind="{Binding ResultKind}" Text="{Binding ResultText}" FontSize="16" FontWeight="SemiBold" ToolTip="{l:Loc Tooltips.Import.Result}" />
|
||||
<TextBlock Text="{Binding DetailText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="14,0,0,0" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<ListBox Grid.Row="1" ItemsSource="{Binding Failures}" Margin="0,8,0,0" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}"
|
||||
Visibility="{Binding HasFailures, Converter={StaticResource BoolToVisibility}}" AutomationProperties.Name="{l:Loc Import.Result.FailuresName}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Style="{StaticResource Text.Cell}" Foreground="{DynamicResource Brush.Error}" Height="28" Padding="0,6,0,0" ToolTip="{Binding}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="2" Margin="0,10,0,0" Visibility="{Binding OffersCheck, Converter={StaticResource BoolToVisibility}}">
|
||||
<TextBlock Text="{Binding EraseText}" Typography.NumeralAlignment="Tabular" />
|
||||
<TextBlock Text="{Binding BusyText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="0,4,0,0"
|
||||
Visibility="{Binding BusyText, Converter={x:Static ui:NullToCollapsedConverter.Instance}}" />
|
||||
<ItemsControl ItemsSource="{Binding KeptReasons}" Focusable="False" MaxHeight="80" Margin="0,4,0,0">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ui:StatusGlyph Kind="Warning" Text="{Binding}" FontSize="12" ToolTip="{l:Loc Tooltips.Import.Kept}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</StackPanel>
|
||||
<WrapPanel Grid.Row="3" Margin="0,12,0,0">
|
||||
<Button Content="{l:Loc Import.Result.Check}" Command="{Binding CheckCommand}" ToolTip="{Binding CheckToolTip}" Margin="0,0,8,0"
|
||||
Visibility="{Binding OffersCheck, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Destructive}" Content="{Binding DeleteText}" Command="{Binding DeleteCommand}" ToolTip="{Binding DeleteToolTip}"
|
||||
Margin="0,0,8,0" Visibility="{Binding OffersDelete, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Style="{StaticResource Button.Destructive}" Content="{l:Loc Import.Result.Format}" Command="{Binding FormatCommand}" ToolTip="{Binding FormatToolTip}"
|
||||
Margin="0,0,8,0" Visibility="{Binding OffersFormat, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Button Command="{Binding EjectCommand}" ToolTip="{Binding EjectToolTip}" Margin="0,0,8,0">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<ui:Icon Glyph="{StaticResource Icon.Eject}" Margin="0,0,6,0" />
|
||||
<TextBlock Text="{l:Loc Import.Result.Eject}" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Content="{l:Loc Import.Result.Library}" Command="{Binding OpenLibraryCommand}" ToolTip="{l:Loc Tooltips.Import.Library}" Margin="0,0,8,0" />
|
||||
<Button Content="{l:Loc Import.Result.New}" Command="{Binding DataContext.NewImportCommand, RelativeSource={RelativeSource AncestorType=UserControl}}"
|
||||
ToolTip="{l:Loc Tooltips.Import.New}" />
|
||||
</WrapPanel>
|
||||
</Grid>
|
||||
|
||||
<!-- The import failed or was cancelled. -->
|
||||
<StackPanel Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Center" Visibility="{Binding IsFailed, Converter={StaticResource BoolToVisibility}}">
|
||||
<ui:StatusGlyph Kind="Failed" Text="{Binding ErrorText}" FontSize="13" HorizontalAlignment="Center" ToolTip="{l:Loc Tooltips.Import.Failed}" />
|
||||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0,12,0,0">
|
||||
<Button Content="{l:Loc Import.Failed.Retry}" Command="{Binding RetryCommand}" ToolTip="{l:Loc Tooltips.Import.Retry}" Margin="0,0,8,0" />
|
||||
<Button Content="{l:Loc Shell.Nav.Jobs}" Command="{Binding Shell.NavigateCommand}" CommandParameter="Jobs" ToolTip="{l:Loc Tooltips.Nav.Jobs}" />
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<!-- Footer: Show plan and Import, or the progress while copying. -->
|
||||
<DockPanel Grid.Row="2" Margin="0,10,0,0" Visibility="{Binding HasPlan, Converter={StaticResource BoolToVisibility}}">
|
||||
<Button DockPanel.Dock="Left" Content="{l:Loc Import.Plan.Show}" Command="{Binding ShowPlanCommand}" ToolTip="{l:Loc Tooltips.Import.ShowPlan}"
|
||||
Visibility="{Binding IsRunning, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.Primary}" Height="36" Padding="22,0" Content="{Binding StartText}" Command="{Binding StartCommand}"
|
||||
ToolTip="{Binding StartToolTip}" Visibility="{Binding IsRunning, Converter={x:Static ui:InverseBoolToVisibilityConverter.Instance}}" />
|
||||
<Button DockPanel.Dock="Right" Content="{l:Loc Import.Progress.Cancel}" Command="{Binding CancelCommand}" ToolTip="{l:Loc Tooltips.Import.Cancel}" Margin="12,0,0,0"
|
||||
Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisibility}}" />
|
||||
<Grid Visibility="{Binding IsRunning, Converter={StaticResource BoolToVisibility}}" VerticalAlignment="Center">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar Maximum="1" Value="{Binding Progress, Mode=OneWay}" VerticalAlignment="Center" />
|
||||
<TextBlock Grid.Column="1" Text="{Binding ProgressText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="12,0,0,0" Typography.NumeralAlignment="Tabular" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</Border>
|
||||
|
||||
<!-- ===================== Show plan ===================== -->
|
||||
<Border Grid.RowSpan="3" Style="{StaticResource Border.Panel}" Background="{DynamicResource Brush.Surface}" Padding="0" Margin="-8"
|
||||
Visibility="{Binding IsDetailsOpen, Converter={StaticResource BoolToVisibility}}">
|
||||
<Grid DataContext="{Binding Details}" Margin="16,12">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel>
|
||||
<Button DockPanel.Dock="Right" Style="{StaticResource Button.IconSubtle}" ui:ButtonIcon.Glyph="{StaticResource Icon.Close}"
|
||||
Command="{Binding DataContext.CloseDetailsCommand, RelativeSource={RelativeSource AncestorType=UserControl}}" ToolTip="{l:Loc Tooltips.Import.ClosePlan}"
|
||||
AutomationProperties.Name="{l:Loc Import.Details.Close}" />
|
||||
<TextBlock Text="{l:Loc Import.Details.Title}" Style="{StaticResource Text.Title}" VerticalAlignment="Center" />
|
||||
<TextBlock Text="{Binding TotalsText}" Foreground="{DynamicResource Brush.TextMuted}" Margin="14,0,0,0" VerticalAlignment="Center" TextTrimming="CharacterEllipsis"
|
||||
Typography.NumeralAlignment="Tabular" />
|
||||
</DockPanel>
|
||||
<ItemsControl Grid.Row="1" ItemsSource="{Binding Conflicts}" Focusable="False" Margin="0,8,0,0" MaxHeight="96">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<ui:StatusGlyph Kind="Warning" Text="{Binding}" FontSize="12" Margin="0,2" ToolTip="{l:Loc Tooltips.Import.Conflict}" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
<Grid Grid.Row="2" Margin="0,10,0,4" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="1.8*" MinWidth="180" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="90" />
|
||||
<ColumnDefinition Width="0.5*" MinWidth="64" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Source}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Destination}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="2" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Details.Column.Action}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.Header}" Text="{l:Loc Import.Session.Column.Size}" Margin="10,0,0,0" TextAlignment="Right" />
|
||||
</Grid>
|
||||
<ListBox Grid.Row="3" ItemsSource="{Binding Rows}" ItemContainerStyle="{StaticResource ListBoxItem.PlainRow}" AutomationProperties.Name="{l:Loc Import.Details.Title}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate DataType="{x:Type imp:PlanDetailRow}">
|
||||
<Grid x:Name="Row" Height="30" TextElement.FontSize="12">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1.2*" MinWidth="140" />
|
||||
<ColumnDefinition Width="1.8*" MinWidth="180" />
|
||||
<ColumnDefinition Width="0.8*" MinWidth="90" />
|
||||
<ColumnDefinition Width="0.5*" MinWidth="64" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock x:Name="Source" Style="{StaticResource Text.Cell}" Text="{Binding Source}" ToolTip="{Binding Source}" />
|
||||
<TextBlock Grid.Column="1" Style="{StaticResource Text.Cell}" Text="{Binding Destination}" Margin="10,0,0,0" ToolTip="{Binding Destination}" />
|
||||
<TextBlock x:Name="Action" Grid.Column="2" Style="{StaticResource Text.Cell}" Text="{Binding ActionText}" Margin="10,0,0,0" />
|
||||
<TextBlock Grid.Column="3" Style="{StaticResource Text.CellNumber}" Text="{Binding SizeText}" Margin="10,0,0,0" />
|
||||
</Grid>
|
||||
<DataTemplate.Triggers>
|
||||
<DataTrigger Binding="{Binding Kind}" Value="Session">
|
||||
<Setter TargetName="Source" Property="FontWeight" Value="SemiBold" />
|
||||
<Setter TargetName="Row" Property="Height" Value="34" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding IsSkipped}" Value="True">
|
||||
<Setter TargetName="Row" Property="Opacity" Value="0.6" />
|
||||
<Setter TargetName="Action" Property="Foreground" Value="{DynamicResource Brush.TextMuted}" />
|
||||
</DataTrigger>
|
||||
</DataTemplate.Triggers>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,8 +1,28 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Controls.Primitives;
|
||||
using System.Windows.Input;
|
||||
|
||||
namespace Titano.App.Sections;
|
||||
|
||||
public partial class ImportView : UserControl
|
||||
{
|
||||
public ImportView() => InitializeComponent();
|
||||
|
||||
private ImportViewModel? Model => DataContext as ImportViewModel;
|
||||
|
||||
/// <summary>"Edit ▾" and "{ }" open their menu under themselves.</summary>
|
||||
private void OnOpenMenu(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (sender is not Button { ContextMenu: { } menu } button) return;
|
||||
menu.DataContext = DataContext;
|
||||
menu.PlacementTarget = button;
|
||||
menu.Placement = PlacementMode.Bottom;
|
||||
menu.IsOpen = true;
|
||||
}
|
||||
|
||||
/// <summary>The "{ }" menu writes into the template field used last.</summary>
|
||||
private void OnFolderTemplateFocus(object sender, KeyboardFocusChangedEventArgs e) => Model?.SetActiveTemplate(folder: true);
|
||||
|
||||
private void OnFileTemplateFocus(object sender, KeyboardFocusChangedEventArgs e) => Model?.SetActiveTemplate(folder: false);
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user