|
4 | 4 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
5 | 5 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
6 | 6 | xmlns:local="clr-namespace:LibVideo" |
| 7 | + xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" |
7 | 8 | mc:Ignorable="d" |
8 | | - Title="我家视频" Height="527.371" Width="800" |
9 | | - WindowState="Normal" ResizeMode="NoResize" > |
10 | | - |
| 9 | + TextElement.Foreground="{DynamicResource MaterialDesignBody}" |
| 10 | + TextElement.FontWeight="Regular" |
| 11 | + TextElement.FontSize="13" |
| 12 | + TextOptions.TextFormattingMode="Ideal" |
| 13 | + TextOptions.TextRenderingMode="Auto" |
| 14 | + Background="{DynamicResource MaterialDesignPaper}" |
| 15 | + Title="我家视频" Height="600" Width="1000" |
| 16 | + WindowState="Normal" WindowStartupLocation="CenterScreen"> |
| 17 | + |
| 18 | + <Window.DataContext> |
| 19 | + <localViewModels:MainViewModel xmlns:localViewModels="clr-namespace:LibVideo.ViewModels"/> |
| 20 | + </Window.DataContext> |
11 | 21 |
|
| 22 | + <Window.Resources> |
| 23 | + <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> |
| 24 | + </Window.Resources> |
12 | 25 |
|
13 | 26 | <Grid> |
14 | | - <ListBox x:Name="dirListUI" HorizontalAlignment="Left" Height="113" Margin="630,10,0,0" VerticalAlignment="Top" Width="147" Panel.ZIndex="1" /> |
15 | | - <Button Content="添加视频目录" HorizontalAlignment="Left" Height="27" Margin="630,128,0,0" VerticalAlignment="Top" Width="70" Click="dirButton_Click" IsEnabled="True" IsHitTestVisible="True" Panel.ZIndex="1" Background="LightBlue"/> |
16 | | - <Button x:Name="btnDeleteDir" Content="删除选中" HorizontalAlignment="Left" Height="27" Margin="705,128,0,0" VerticalAlignment="Top" Width="70" Click="btnDeleteDir_Click" Background="#FFFF9999" Panel.ZIndex="1"/> |
17 | | - |
| 27 | + <Grid.RowDefinitions> |
| 28 | + <RowDefinition Height="Auto" /> |
| 29 | + <RowDefinition Height="*" /> |
| 30 | + <RowDefinition Height="Auto" /> |
| 31 | + </Grid.RowDefinitions> |
18 | 32 |
|
19 | | - <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"> |
20 | | - <DataGrid x:Name="outputGrid" Height="402" Margin="10,43,0,0" Width="611" |
21 | | - AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="Cell" IsReadOnly="true" HorizontalAlignment="Left"> |
22 | | - <DataGrid.Columns> |
23 | | - <DataGridTextColumn Header="编号" Binding="{Binding Id}" /> |
24 | | - <DataGridTextColumn Header="视频" Binding="{Binding FullName}"> |
25 | | - <DataGridTextColumn.ElementStyle> |
26 | | - <Style TargetType="TextBlock"> |
27 | | - <Setter Property="ToolTip" Value="{Binding FullName}" /> |
28 | | - </Style> |
29 | | - </DataGridTextColumn.ElementStyle> |
30 | | - </DataGridTextColumn> |
31 | | - </DataGrid.Columns> |
| 33 | + <!-- Top Header --> |
| 34 | + <Grid Grid.Row="0" Margin="16,10,16,10"> |
| 35 | + <Grid.ColumnDefinitions> |
| 36 | + <ColumnDefinition Width="*" /> |
| 37 | + <ColumnDefinition Width="Auto" /> |
| 38 | + </Grid.ColumnDefinitions> |
32 | 39 |
|
33 | | - <DataGrid.Resources> |
34 | | - <Style TargetType="DataGridRow"> |
35 | | - <EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick"/> |
36 | | - </Style> |
37 | | - </DataGrid.Resources> |
| 40 | + <StackPanel Orientation="Horizontal" Grid.Column="0"> |
| 41 | + <ComboBox x:Name="keywords" Style="{StaticResource MaterialDesignFloatingHintComboBox}" materialDesign:HintAssist.Hint="搜索视频文件..." materialDesign:TextFieldAssist.HasClearButton="True" ItemsSource="{Binding SearchHistory}" Text="{Binding SearchKeyword, UpdateSourceTrigger=PropertyChanged}" IsEditable="True" Height="45" Width="300" VerticalAlignment="Center" Margin="0,0,10,0"> |
| 42 | + <ComboBox.InputBindings> |
| 43 | + <KeyBinding Key="Enter" Command="{Binding CommitSearchCommand}"/> |
| 44 | + </ComboBox.InputBindings> |
| 45 | + </ComboBox> |
| 46 | + <Button x:Name="btnPrevSearch" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Command="{Binding PrevSearchCommand}" Height="30" Width="30" ToolTip="上一个搜索" VerticalAlignment="Center" Margin="0,0,10,0"> |
| 47 | + <materialDesign:PackIcon Kind="ChevronLeft" /> |
| 48 | + </Button> |
| 49 | + <Button x:Name="btnNextSearch" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Command="{Binding NextSearchCommand}" Height="30" Width="30" ToolTip="下一个搜索" VerticalAlignment="Center" Margin="0,0,10,0"> |
| 50 | + <materialDesign:PackIcon Kind="ChevronRight" /> |
| 51 | + </Button> |
| 52 | + </StackPanel> |
38 | 53 |
|
39 | | - <DataGrid.ContextMenu> |
40 | | - <ContextMenu> |
41 | | - <MenuItem Header="播放" Click="PlayOrOpenItem" /> |
42 | | - <MenuItem Header="打开文件夹" Click="OpenContainingFolder" /> |
43 | | - </ContextMenu> |
44 | | - </DataGrid.ContextMenu> |
45 | | - </DataGrid> |
| 54 | + <Button Grid.Column="1" x:Name="btnSettings" Style="{StaticResource MaterialDesignFloatingActionMiniButton}" Click="btnSettings_Click" Height="40" Width="40" ToolTip="管理视频目录" VerticalAlignment="Center"> |
| 55 | + <materialDesign:PackIcon Kind="Settings" Height="24" Width="24" /> |
| 56 | + </Button> |
| 57 | + </Grid> |
46 | 58 |
|
47 | | - </ScrollViewer> |
| 59 | + <!-- Main DataGrid --> |
| 60 | + <DataGrid Grid.Row="1" x:Name="outputGrid" Style="{StaticResource MaterialDesignDataGrid}" ItemsSource="{Binding VideoItems}" Margin="16,0,16,0" AutoGenerateColumns="False" SelectionMode="Single" SelectionUnit="FullRow" IsReadOnly="true" VirtualizingPanel.IsVirtualizing="True"> |
| 61 | + <DataGrid.CellStyle> |
| 62 | + <Style TargetType="DataGridCell" BasedOn="{StaticResource MaterialDesignDataGridCell}"> |
| 63 | + <Setter Property="FocusVisualStyle" Value="{x:Null}" /> |
| 64 | + <Setter Property="BorderThickness" Value="0" /> |
| 65 | + </Style> |
| 66 | + </DataGrid.CellStyle> |
| 67 | + <DataGrid.RowStyle> |
| 68 | + <Style TargetType="DataGridRow" BasedOn="{StaticResource MaterialDesignDataGridRow}"> |
| 69 | + <EventSetter Event="MouseDoubleClick" Handler="Row_DoubleClick" /> |
| 70 | + </Style> |
| 71 | + </DataGrid.RowStyle> |
| 72 | + <DataGrid.Columns> |
| 73 | + <DataGridTextColumn Header="编号" Binding="{Binding Id}" /> |
| 74 | + <DataGridTextColumn Header="录入日期" Binding="{Binding CreationTime, StringFormat=\{0:yyyy-MM-dd HH:mm\}}" /> |
| 75 | + <DataGridTextColumn Header="路径" Binding="{Binding FolderName}" Width="*" /> |
| 76 | + <DataGridTextColumn Header="文件名" Binding="{Binding FileName}" Width="*" /> |
| 77 | + </DataGrid.Columns> |
48 | 78 |
|
49 | | - <ComboBox x:Name="keywords" IsEditable="True" HorizontalAlignment="Left" Height="28" Margin="190,10,0,0" VerticalAlignment="Top" Width="221" TextBoxBase.TextChanged="keywords_TextChanged" KeyDown="keywords_KeyDown" Panel.ZIndex="1"/> |
50 | | - <Button x:Name="btnPrevSearch" Content="<" HorizontalAlignment="Left" Height="28" Margin="415,10,0,0" VerticalAlignment="Top" Width="25" Click="btnPrevSearch_Click" ToolTip="上一个搜索" Panel.ZIndex="1"/> |
51 | | - <Button x:Name="btnNextSearch" Content=">" HorizontalAlignment="Left" Height="28" Margin="445,10,0,0" VerticalAlignment="Top" Width="25" Click="btnNextSearch_Click" ToolTip="下一个搜索" Panel.ZIndex="1"/> |
52 | | - <Image Grid.Column="2" HorizontalAlignment="Left" Height="26" Margin="62.667,297,0,0" VerticalAlignment="Top" Width="113"/> |
53 | | - <Label Content="搜索:" HorizontalAlignment="Left" Height="37" Margin="143,10,0,0" VerticalAlignment="Top" Width="63"/> |
| 79 | + <DataGrid.ContextMenu> |
| 80 | + <ContextMenu> |
| 81 | + <MenuItem Header="播放" Click="PlayOrOpenItem" /> |
| 82 | + <MenuItem Header="打开文件夹" Click="OpenContainingFolder" /> |
| 83 | + </ContextMenu> |
| 84 | + </DataGrid.ContextMenu> |
| 85 | + </DataGrid> |
54 | 86 |
|
55 | | - <!-- 状态栏 --> |
56 | | - <StatusBar VerticalAlignment="Bottom"> |
| 87 | + <!-- Status Bar --> |
| 88 | + <StatusBar Grid.Row="2" Margin="0,5,0,0"> |
57 | 89 | <StatusBarItem> |
58 | | - <TextBlock x:Name="totalItemsText"/> |
| 90 | + <TextBlock x:Name="totalItemsText" Text="{Binding TotalItemsText}"/> |
59 | 91 | </StatusBarItem> |
60 | 92 | <StatusBarItem> |
61 | | - <TextBlock x:Name="itemsAddedLast24HoursText"/> |
| 93 | + <TextBlock x:Name="itemsAddedLast24HoursText" Text="{Binding ItemsAddedLast24HoursText}"/> |
62 | 94 | </StatusBarItem> |
63 | 95 | </StatusBar> |
64 | | - |
| 96 | + |
65 | 97 | <!-- Loading Overlay --> |
66 | | - <Grid x:Name="LoadingOverlay" Background="#99000000" Panel.ZIndex="100" Visibility="Collapsed"> |
67 | | - <TextBlock Text="正在加载文件,请稍候..." Foreground="White" FontSize="20" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
| 98 | + <Grid Grid.RowSpan="3" x:Name="LoadingOverlay" Background="#99000000" Panel.ZIndex="100" Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}"> |
| 99 | + <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center"> |
| 100 | + <ProgressBar Style="{StaticResource MaterialDesignCircularProgressBar}" Value="0" IsIndeterminate="True" Width="50" Height="50" Margin="0,0,0,16" Foreground="White" /> |
| 101 | + <TextBlock Text="正在加载文件,请稍候..." Foreground="White" FontSize="20"/> |
| 102 | + </StackPanel> |
68 | 103 | </Grid> |
69 | 104 | </Grid> |
70 | | - |
71 | 105 | </Window> |
0 commit comments