mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 04:07:40 +02:00
fix directory drag drop
This commit is contained in:
@@ -116,22 +116,34 @@ namespace Wox.Plugin.Program.Views
|
|||||||
|
|
||||||
private void programSourceView_Drop(object sender, DragEventArgs e)
|
private void programSourceView_Drop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
|
var directories = (string[])e.Data.GetData(DataFormats.FileDrop);
|
||||||
|
|
||||||
if (files != null && files.Length > 0)
|
var directoriesToAdd = new List<ProgramSource>();
|
||||||
|
|
||||||
|
if (directories != null && directories.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (string s in files)
|
foreach (string directory in directories)
|
||||||
{
|
{
|
||||||
if (Directory.Exists(s))
|
if (Directory.Exists(directory) && !ProgramSettingDisplayList.Any(x => x.UniqueIdentifier == directory))
|
||||||
{
|
{
|
||||||
_settings.ProgramSources.Add(new Settings.ProgramSource
|
var source = new ProgramSource
|
||||||
{
|
{
|
||||||
Location = s
|
Location = directory,
|
||||||
});
|
UniqueIdentifier = directory
|
||||||
|
};
|
||||||
|
|
||||||
ReIndexing();
|
directoriesToAdd.Add(source);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (directoriesToAdd.Count() > 0)
|
||||||
|
{
|
||||||
|
directoriesToAdd.ForEach(x => _settings.ProgramSources.Add(x));
|
||||||
|
directoriesToAdd.ForEach(x => ProgramSettingDisplayList.Add(x));
|
||||||
|
|
||||||
|
programSourceView.Items.Refresh();
|
||||||
|
ReIndexing();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user