Skip to content

Commit

Permalink
Fix drag drop folders and add a note to UI
Browse files Browse the repository at this point in the history
  • Loading branch information
0x90d committed Oct 6, 2023
1 parent 76628f3 commit 313d89a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
12 changes: 10 additions & 2 deletions VDF.GUI/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -1529,7 +1529,7 @@
Margin="5,0,0,2"
FontWeight="Bold"
Text="Search Directories" />
<Grid Grid.Row="1" RowDefinitions="Auto, *">
<Grid Grid.Row="1" RowDefinitions="Auto, *, Auto">
<Menu Grid.Row="0" MinHeight="30">
<MenuItem Command="{Binding AddIncludesToListCommand}">
<MenuItem.Header>
Expand Down Expand Up @@ -1583,6 +1583,10 @@
BorderThickness="1"
DragDrop.AllowDrop="True"
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Includes}" />
<TextBlock
Grid.Row="2"
Margin="5"
Text="Hint: You can also add folders with drag &amp; drop" />
</Grid>
<TextBlock
Grid.Row="0"
Expand All @@ -1594,7 +1598,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="10,0,0,0"
RowDefinitions="Auto, *">
RowDefinitions="Auto, *, Auto">
<Menu Grid.Row="0" MinHeight="30">
<MenuItem Command="{Binding AddBlacklistToListCommand}">
<MenuItem.Header>
Expand Down Expand Up @@ -1648,6 +1652,10 @@
BorderThickness="1"
DragDrop.AllowDrop="True"
ItemsSource="{Binding Source={x:Static Settings:SettingsFile.Instance}, Path=Blacklists}" />
<TextBlock
Grid.Row="2"
Margin="5"
Text="Hint: You can also add folders with drag &amp; drop" />
</Grid>
</Grid>
</Grid>
Expand Down
14 changes: 8 additions & 6 deletions VDF.GUI/Views/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,20 @@ private void DropInclude(object? sender, DragEventArgs e) {

foreach (var path in e.Data.GetFiles() ?? Array.Empty<IStorageFolder>()) {
if (path is not IStorageFolder) continue;
if (!SettingsFile.Instance.Includes.Contains(path.Name))
SettingsFile.Instance.Includes.Add(path.Name);
}
string? localPath = path.TryGetLocalPath();
if (!string.IsNullOrEmpty(localPath) && !SettingsFile.Instance.Includes.Contains(localPath))
SettingsFile.Instance.Includes.Add(localPath);
}
}
private void DropBlacklist(object? sender, DragEventArgs e) {
if (!e.Data.Contains(DataFormats.Files)) return;

foreach (var path in e.Data.GetFiles() ?? Array.Empty<IStorageFolder>()) {
if (path is not IStorageFolder) continue;
if (!SettingsFile.Instance.Includes.Contains(path.Name))
SettingsFile.Instance.Includes.Add(path.Name);
}
string? localPath = path.TryGetLocalPath();
if (!string.IsNullOrEmpty(localPath) && !SettingsFile.Instance.Includes.Contains(localPath))
SettingsFile.Instance.Includes.Add(localPath);
}
}

void Thumbnails_ValueChanged(object? sender, NumericUpDownValueChangedEventArgs e) {
Expand Down

0 comments on commit 313d89a

Please sign in to comment.