mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-07 03:36:44 +02:00
Add Context menu
This commit is contained in:
BIN
Plugins/Wox.Plugin.FindFile/Images/edit.png
Normal file
BIN
Plugins/Wox.Plugin.FindFile/Images/edit.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
@@ -36,7 +36,7 @@ namespace Wox.Plugin.FindFile
|
||||
MFTSearcher.IndexAllVolumes();
|
||||
initial = true;
|
||||
var searchtimeend = DateTime.Now;
|
||||
Debug.WriteLine(string.Format("{0} file, {1} folder indexed, {2}ms has spent.", MFTSearcher.IndexedFileCount, MFTSearcher.IndexedFolderCount, searchtimeend.Subtract(searchtimestart).TotalMilliseconds));
|
||||
Debug.WriteLine(string.Format("{0} file, indexed, {1}ms has spent.", MFTSearcher.IndexedRecordsCount, searchtimeend.Subtract(searchtimestart).TotalMilliseconds));
|
||||
}
|
||||
|
||||
private Result ConvertMFTSearch(MFTSearchRecord record, string query)
|
||||
@@ -67,8 +67,57 @@ namespace Wox.Plugin.FindFile
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
},
|
||||
ContextMenu = GetContextMenu(record)
|
||||
};
|
||||
}
|
||||
|
||||
private List<Result> GetContextMenu(MFTSearchRecord record)
|
||||
{
|
||||
List<Result> contextMenus = new List<Result>();
|
||||
|
||||
contextMenus.Add(new Result()
|
||||
{
|
||||
Title = "Open",
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start(record.FullPath);
|
||||
}
|
||||
catch
|
||||
{
|
||||
context.API.ShowMsg("Can't open " + record.FullPath, string.Empty, string.Empty);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/edit.png"
|
||||
});
|
||||
|
||||
if (!record.IsFolder)
|
||||
{
|
||||
contextMenus.Add(new Result()
|
||||
{
|
||||
Title = "Open Containing Folder",
|
||||
Action = _ =>
|
||||
{
|
||||
try
|
||||
{
|
||||
Process.Start("explorer.exe", string.Format("/select, \"{0}\"", record.FullPath));
|
||||
}
|
||||
catch
|
||||
{
|
||||
context.API.ShowMsg("Can't open " + record.FullPath, string.Empty, string.Empty);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
IcoPath = "Images/folder.png"
|
||||
});
|
||||
}
|
||||
|
||||
return contextMenus;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,12 @@
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Images\find.png" />
|
||||
<Content Include="Images\edit.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\find.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="Images\folder.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
|
||||
Reference in New Issue
Block a user