1,fix ImageLoader GetIcon() trigger FileNotFoundException when file not exist;

2,In FolderPluginSettings when trigger Delete Action need confirm;
3,Add drag and drop functionality in ProgramSetting and FileSystemSettings.

Signed-off-by: 716 <525223688@qq.com>
This commit is contained in:
716
2015-01-09 10:23:48 +08:00
parent 288be8dd71
commit 6e3ca5391a
8 changed files with 97 additions and 6 deletions

View File

@@ -16,7 +16,9 @@
<Button Height="30" HorizontalAlignment="Right" x:Name="btnProgramSuffixes" Width="130" Click="BtnProgramSuffixes_OnClick" Content="{DynamicResource wox_plugin_program_suffixes}"></Button>
<Button Height="30" HorizontalAlignment="Right" Margin="10 0 0 0" x:Name="btnReindex" Width="100" Click="btnReindex_Click" Content="{DynamicResource wox_plugin_program_reindex}"></Button>
</StackPanel>
<ListView x:Name="programSourceView" Grid.Row="1">
<ListView x:Name="programSourceView" Grid.Row="1" AllowDrop="True"
DragEnter="programSourceView_DragEnter"
Drop="programSourceView_Drop" >
<ListView.View>
<GridView>
<GridViewColumn Header="{DynamicResource wox_plugin_program_location}" Width="400">

View File

@@ -106,5 +106,41 @@ namespace Wox.Plugin.Program
ProgramSuffixes p = new ProgramSuffixes(context);
p.ShowDialog();
}
private void programSourceView_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effects = DragDropEffects.Link;
}
else
{
e.Effects = DragDropEffects.None;
}
}
private void programSourceView_Drop(object sender, DragEventArgs e)
{
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
if (files != null && files.Length > 0)
{
foreach (string s in files)
{
if (System.IO.Directory.Exists(s) == true)
{
ProgramStorage.Instance.ProgramSources.Add(new ProgramSource()
{
Location = s,
Type = "FileSystemProgramSource",
Enabled = true
});
ProgramStorage.Instance.Save();
ReIndexing();
}
}
}
}
}
}