-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
executable file
·92 lines (91 loc) · 6.15 KB
/
MainWindow.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<Window x:Class="DiskSnapshot.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DiskSnapshot"
Icon="App.ico" Title="DiskSnapshot" Height="500" Width="525" x:Name="Window">
<Window.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="TreeListView/themes/classic.xaml"/>
</ResourceDictionary.MergedDictionaries>
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter"/>
<local:BooleanToVisibilityNegatedConverter x:Key="BooleanToVisibilityNegatedConverter"/>
<local:BooleanNotConverter x:Key="BooleanNotConverter"/>
<DataTemplate x:Key="CellTemplate_Name">
<Grid>
<DockPanel LastChildFill="True">
<Image x:Name="ImgNormal" DockPanel.Dock="Left" Source="Images/folder.png" Width="16" Height="16" Margin="0,0,4,0" VerticalAlignment="Center" Visibility="Visible" />
<Image x:Name="ImgAdded" DockPanel.Dock="Left" Source="Images/folder_added.png" Width="16" Height="16" Margin="0,0,4,0" VerticalAlignment="Center" Visibility="Collapsed"/>
<Image x:Name="ImgDeleted" DockPanel.Dock="Left" Source="Images/folder_deleted.png" Width="16" Height="16" Margin="0,0,4,0" VerticalAlignment="Center" Visibility="Collapsed"/>
<Grid>
<TextBlock x:Name="Txt" Text="{Binding Path=DirectoryName}"/>
</Grid>
</DockPanel>
</Grid>
<DataTemplate.Triggers>
<DataTrigger Binding="{Binding Path=State}" Value="Added">
<Setter TargetName="ImgNormal" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="ImgAdded" Property="Visibility" Value="Visible"/>
<Setter TargetName="Txt" Property="Foreground" Value="DarkGreen"/>
</DataTrigger>
<DataTrigger Binding="{Binding Path=State}" Value="Deleted">
<Setter TargetName="ImgNormal" Property="Visibility" Value="Collapsed"/>
<Setter TargetName="ImgDeleted" Property="Visibility" Value="Visible"/>
<Setter TargetName="Txt" Property="Foreground" Value="DarkRed"/>
</DataTrigger>
</DataTemplate.Triggers>
</DataTemplate>
<DataTemplate x:Key="CellTemplate_Size">
<TextBlock Text="{Binding Path=CurrentSizeString}"/>
</DataTemplate>
<DataTemplate x:Key="CellTemplate_Delta">
<TextBlock Text="{Binding Path=DeltaString}"/>
</DataTemplate>
</ResourceDictionary>
</Window.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" Margin="0,4" Grid.Row="0" Grid.Column="0">
<TextBlock VerticalAlignment="Center" Margin="8,0" FontWeight="Bold" FontSize="16" Text="{Binding ElementName=Window, Path=DirectoryStructure.Root.DirectoryName}"/>
<Button x:Name="BtnScan" Click="BtnScan_Click" MinWidth="80" Margin="3,0" IsEnabled="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanNotConverter}}">Scan</Button>
<TextBlock VerticalAlignment="Center" Margin="3,0" Visibility="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanToVisibilityConverter}}">Working...</TextBlock>
<Button x:Name="BtnSave" Click="BtnSave_Click" MinWidth="80" Margin="3,0"
Visibility="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanToVisibilityNegatedConverter}}">Save</Button>
<Button x:Name="BtnSelectDrive" Click="BtnSelectDrive_Click" MinWidth="80" Margin="3,0"
Visibility="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanToVisibilityNegatedConverter}}">Select Drive</Button>
<StackPanel Orientation="Horizontal" Visibility="{Binding ElementName=Window, Path=IsSelectingDrive, Converter={StaticResource BooleanToVisibilityConverter}}">
<ComboBox x:Name="CbxDrives" ItemsSource="{Binding ElementName=Window, Path=AvailableDrives}" DisplayMemberPath="Name" Margin="3,0"/>
<Button x:Name="BtnOKDrive" Click="BtnOKDrive_Click" Margin="3,0">Select</Button>
<Button x:Name="BtnCancelDrive" Click="BtnCancelDrive_Click" Margin="3,0">Cancel</Button>
</StackPanel>
<TextBlock Text="{Binding ElementName=Window, Path=ProgressDirectory}" Margin="4,0" VerticalAlignment="Center"
Visibility="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanToVisibilityConverter}}"/>
</StackPanel>
<TextBlock Grid.Row="0" Grid.Column="1" Text="{Binding ElementName=Window, Path=Progress}" Margin="4,0" VerticalAlignment="Center" HorizontalAlignment="Right"
Visibility="{Binding ElementName=Window, Path=Working, Converter={StaticResource BooleanToVisibilityConverter}}"/>
<local:TreeListView Grid.Row="1" Grid.ColumnSpan="2" ItemsSource="{Binding ElementName=Window, Path=DirectoryStructure.Root.Children}"
Style="{StaticResource TreeListViewStyle}">
<local:TreeListView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Path=Children}">
<TextBlock Text="{Binding Path=DirectoryName}"/>
</HierarchicalDataTemplate>
</local:TreeListView.ItemTemplate>
<local:TreeListView.Columns>
<GridViewColumn Header="Name" CellTemplate="{StaticResource CellTemplate_Name}" Width="200"/>
<GridViewColumn Header="Size" CellTemplate="{StaticResource CellTemplate_Size}" Width="120"/>
<GridViewColumn Header="Delta" CellTemplate="{StaticResource CellTemplate_Delta}" Width="120"/>
</local:TreeListView.Columns>
<local:TreeListView.ItemContainerStyle>
<Style TargetType="{x:Type local:TreeListViewItem}" BasedOn="{StaticResource TreeListViewItemStyle}">
</Style>
</local:TreeListView.ItemContainerStyle>
</local:TreeListView>
</Grid>
</Window>