-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml
216 lines (202 loc) · 13.8 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<Window x:Class="Dateien_Sortierprogramm.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:Dateien_Sortierprogramm"
xmlns:vm="clr-namespace:Dateien_Sortierprogramm.ViewModels"
mc:Ignorable="d"
Title="MainWindow" Height="700" Width="800"
WindowStartupLocation="CenterScreen">
<Window.DataContext>
<vm:MainWindowViewModel/>
</Window.DataContext>
<Window.Resources>
<Style TargetType="TextBox">
<Setter Property="Height" Value="30"/>
</Style>
<Style TargetType="Button">
<Setter Property="Height" Value="25"/>
</Style>
<!--Image Basic Style-->
<Style TargetType="Image" x:Key="ImageStyle" >
<Setter Property="Width" Value="20"/>
<!--<Setter Property="Height" Value="20"/>-->
<Setter Property="ToolTipService.InitialShowDelay" Value="100" />
</Style>
<!--Info Image with ToolTip-->
<Style TargetType="Image" x:Key="InfoImage" BasedOn="{StaticResource ImageStyle}">
<Setter Property="Source" Value="/Resources/icons8-information-48.png" />
<Setter Property="Cursor" Value="Help"/>
<Setter Property="Margin" Value="10,0,0,0"/>
<Setter Property="VerticalAlignment" Value="Top" />
</Style>
<!--DeleteButton Style-->
<Style TargetType="Button" x:Key="DeleteButtonStyle">
<Setter Property="Background" Value="{x:Null}" />
<Setter Property="Foreground" Value="{x:Null}" />
<Setter Property="BorderBrush" Value="{x:Null}" />
<Setter Property="OpacityMask" Value="{x:Null}" />
<Setter Property="Width" Value="Auto"/>
<Setter Property="Height" Value="Auto"/>
</Style>
</Window.Resources>
<Grid>
<!--GridDefinition-->
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"></ColumnDefinition>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="2*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="*"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<!--DataGrid oben: Ordner in denen gesucht werden soll-->
<DataGrid Margin="5" Grid.ColumnSpan="3" SelectedItem="{Binding SelectedItemFolder}" x:Name="dglstSourceFolders" ItemsSource="{Binding lstSourceFolders}" AutoGenerateColumns="False" Focusable="False" CanUserAddRows="False">
<DataGrid.Columns>
<DataGridTextColumn Width="*" Binding="{Binding FolderPath}">
<DataGridTextColumn.Header>
<StackPanel Orientation="Horizontal">
<TextBlock Grid.Column="0" Text="Quellordner"/>
<Image Style="{StaticResource InfoImage}">
<Image.ToolTip>
<StackPanel>
<TextBlock Text="Ordner, in dem nach Dateien gesucht wird" />
<TextBlock Text="und dann anhand von einem Suchwort in einen" />
<TextBlock Text="sogenannten Zielordner einsortiert wird." />
</StackPanel>
</Image.ToolTip>
</Image>
<Button x:Name="btn_SourceFolder" Grid.Column="2" Content="Quellordner hinzufügen" Margin="20,0,0,0" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type Window}}}" Command="{Binding SelectSourceFolderCommand}"/>
</StackPanel>
</DataGridTextColumn.Header>
</DataGridTextColumn>
<DataGridTemplateColumn Width="30">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Style="{StaticResource DeleteButtonStyle}" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
Command="{Binding DeleteDataGridRowFolderCommand}" >
<Image ToolTip="Löschen" Style="{StaticResource ImageStyle}" Source="/Resources/icons8-x-48(2).png"/>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
<!--<DataGridTextColumn Header="Quellordner (Ordner, in denen nach Dateien gesucht werden soll)" Width="*">-->
<!--<TextBlock Grid.Column="0" Text="Quellordner (Ordner, in denen nach Dateien gesucht werden soll)"/>
<Button Grid.Column="2" Content="Quellordner hinzufügen"/>-->
</DataGrid>
<!--Suchwort und Zielordner-->
<Label x:Name="lbl_Searchterm" Grid.Row="1" Grid.Column="0" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,35,0,0">
<Label.Content>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Suchwort"/>
<Image Style="{StaticResource InfoImage}" >
<Image.ToolTip>
<StackPanel>
<TextBlock Text="In einem Quellordner werden alle Dateien nach Suchwörtern durchsucht." />
<TextBlock Text="Wird ein Suchwort gefunden, dann wird die Datei in den entsprechenden Zielordner einsortiert." />
<TextBlock Text="Beispiel: In einer Datei mit dem Namen 2023_11_01_Freizeit_Gitarre ist das Suchwort Freizeit enthalten." />
<TextBlock Text="Für dieses Suchwort existiert ein Zielordner namens Freizeit. In diesen wird die gefundene Datei dann verschoben."/>
</StackPanel>
</Image.ToolTip>
</Image>
</StackPanel>
</Label.Content>
</Label>
<TextBox x:Name="txt_Keyword" Margin="10,70,10,10" Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Text="{Binding SearchTermUI}" />
<Label x:Name="lbl_TargetFolder" HorizontalAlignment="Left" Grid.Row="1" Grid.Column ="1" VerticalAlignment="Top" Margin="10,35,0,0">
<Label.Content>
<StackPanel Orientation="Horizontal">
<TextBlock Text="Zielordner"/>
<Image x:Name="img_Tooltip" Style="{StaticResource InfoImage}">
<Image.ToolTip>
<StackPanel>
<TextBlock Text="Ein Ordner in den eine Datei einsortiert wird," />
<TextBlock Text="wenn zum entsprechenden Suchwort eine Datei im " />
<TextBlock Text="Quellordner gefunden wurde" />
</StackPanel>
</Image.ToolTip>
</Image>
</StackPanel>
</Label.Content>
</Label>
<TextBox x:Name="txt_TargetFolder" Width="200" Margin="10,70,50,10" Grid.Row="1" Grid.Column="1" VerticalAlignment="Bottom" Text="{Binding TargetFolderUI}" />
<Button x:Name="btn_AddTargetFolder" VerticalAlignment ="Bottom" Margin="214,10,10,10" Width="30" Grid.Row="1" Grid.Column="1" Content="..." Command="{Binding SelectTargetFolderCommand}" />
<Button x:Name="btn_AddOrderElementsToGrid" VerticalAlignment="Bottom" Margin="10" Grid.Row="1" Grid.Column="2" Content="Hinzufügen" Command="{Binding CreateOrderElementCommand}" />
<!--DataGrid Mitte: Suchdefinition-->
<Grid Margin="5" Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="3">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Content="In Quellordner wird nach Suchbegriffen gesucht und in die Zielordner einsortiert" />
<DataGrid x:Name="dg_Sorting" Grid.Row="1" SelectedItem="{Binding SelectedItemOrderElements}" ItemsSource="{Binding lstOrderElements, UpdateSourceTrigger=PropertyChanged}" CanUserAddRows="False" AutoGenerateColumns="False" Focusable="False">
<DataGrid.Columns>
<DataGridTextColumn Header="Suchwort" Width="*" Binding="{Binding SearchTerm}" />
<DataGridTextColumn Header="Zielordner" Width="2*" Binding="{Binding TargetFolderPath}"/>
<DataGridTemplateColumn Width="30">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button Style="{StaticResource DeleteButtonStyle}" DataContext="{Binding DataContext, RelativeSource={RelativeSource AncestorType={x:Type Window}}}"
Command="{Binding DeleteDataGridRowOrderElementsCommand}">
<Image ToolTip="Löschen" Style="{StaticResource ImageStyle}" Source="/Resources/icons8-x-48(2).png"/>
</Button>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
</Grid>
<!--Dateien, die gesucht werden sollen Auswahl-->
<Label Grid.Row="3" Grid.ColumnSpan="3" Margin="5,0,0,0" Content="Nach welchen Dateiformaten soll gesucht werden?" />
<StackPanel Margin="5,0,0,0" Grid.Row="4" >
<CheckBox x:Name="chb_PDF" Content=".pdf" IsChecked="{Binding CheckBox_PDF}"/>
<CheckBox x:Name="chb_Excel" Content=".xls, .xlsx" IsChecked="{Binding CheckBox_Excel}"/>
<CheckBox x:Name="chb_Word" Content=".doc, .docx, .odt" IsChecked="{Binding CheckBox_Word}"/>
<CheckBox x:Name="chb_Powerpoint" Content=".ppt, .pptx" IsChecked="{Binding CheckBox_Powerpoint}"/>
<CheckBox x:Name="chb_Text" Content=".txt" IsChecked="{Binding CheckBox_Text}"/>
<CheckBox x:Name="chb_CSV" Content=".csv" IsChecked="{Binding CheckBox_CSV}"/>
<CheckBox x:Name="chb_ZIP" Content=".zip" IsChecked="{Binding CheckBox_ZIP}"/>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="1">
<CheckBox x:Name="chb_JPG" Content=".jpg, .jpeg" IsChecked="{Binding CheckBox_JPG}"/>
<CheckBox x:Name="chb_PNG" Content=".png" IsChecked="{Binding CheckBox_PNG}"/>
<CheckBox x:Name="chb_GIF" Content=".gif" IsChecked="{Binding CheckBox_GIF}"/>
<CheckBox x:Name="chb_BMP" Content=".bmp" IsChecked="{Binding CheckBox_BMP}"/>
<CheckBox x:Name="chb_MP3" Content=".mp3" IsChecked="{Binding CheckBox_MP3}"/>
<CheckBox x:Name="chb_WAV" Content=".wav" IsChecked="{Binding CheckBox_WAV}"/>
<CheckBox x:Name="chb_MP4" Content=".mp4" IsChecked="{Binding CheckBox_MP4}"/>
</StackPanel>
<StackPanel Grid.Row="4" Grid.Column="2">
<StackPanel Orientation="Horizontal">
<CheckBox x:Name="chb_AVI" Content=".avi" IsChecked="{Binding CheckBox_AVI}" Margin="0,0,100,0"/>
<CheckBox x:Name="chb_All" Content="Alle Formate" IsChecked="{Binding CheckBox_All}"/>
</StackPanel>
<CheckBox x:Name="chb_MOV" Content=".mov" IsChecked="{Binding CheckBox_MOV}"/>
<CheckBox x:Name="chb_MKV" Content=".mkv" IsChecked="{Binding CheckBox_MKV}"/>
<CheckBox x:Name="chb_WMV" Content=".wmv" IsChecked="{Binding CheckBox_WMV}"/>
<CheckBox x:Name="chb_RAR" Content=".rar" IsChecked="{Binding CheckBox_RAR}"/>
<CheckBox x:Name="chb_XML" Content=".xml" IsChecked="{Binding CheckBox_XML}"/>
<CheckBox x:Name="chb_JSON" Content=".json" IsChecked="{Binding CheckBox_JSON}"/>
</StackPanel>
<!--Pfad für das Laden der Sortiertdatei, wichtig, damit das dann als Service laufen kann-->
<StackPanel Grid.Row="5" Grid.ColumnSpan="3" Orientation="Horizontal" Margin="10,20,0,20">
<TextBlock Text="Pfad für das Laden der Sortierdatei:" Margin="0,0,5,0" Visibility="Collapsed"/>
<TextBox Width="200" Height="20" Text="{Binding SortingFilePath, UpdateSourceTrigger=PropertyChanged}" Visibility="Collapsed"/>
<Button Content="..." Command="{Binding SelectSortingFilePathCommand}" Width="30" Height="20" Margin="5,0,0,0" Visibility="Collapsed" />
<Button Content="Update Pfade mit Jahreszahlen" Command="{Binding UpdateYearOfPathCommand}" />
<Button Content="Neuer Button" Margin="10" />
</StackPanel>
<!-->Unten: Laden, Speichern, Sortiervorgang starten-->
<Button x:Name ="btn_Load" Margin="10" Grid.Row="6" Grid.Column="0" Content="Profil Laden" Command="{Binding LoadDataCommand}" />
<Button x:Name="btn_Save" Margin="10" Grid.Row="6" Grid.Column="1" Content="Profil Speichern" Command="{Binding SaveDataCommand}" />
<Button x:Name ="btn_Start" Margin="10" Grid.Row="6" Grid.Column="2" Content="Sortiervorgang starten" Command="{Binding StartSortingServiceCommand}" />
</Grid>
</Window>