mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-06 11:16:51 +02:00
Merge pull request #232 from allanpk716/V1.2.0
1,fix ImageLoader GetIcon() trigger FileNotFoundException when file not ...
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user