|
1 |
| -using System; |
| 1 | +using System; |
2 | 2 | using System.Collections.Generic;
|
3 | 3 | using System.Diagnostics;
|
4 | 4 | using System.IO;
|
|
9 | 9 | using Flow.Launcher.Plugin.Explorer.Search;
|
10 | 10 | using Flow.Launcher.Plugin.Explorer.Search.FolderLinks;
|
11 | 11 | using System.Linq;
|
12 |
| -using System.Reflection; |
| 12 | +using MessageBox = System.Windows.Forms.MessageBox; |
| 13 | +using MessageBoxIcon = System.Windows.Forms.MessageBoxIcon; |
| 14 | +using MessageBoxButton = System.Windows.Forms.MessageBoxButtons; |
| 15 | +using DialogResult = System.Windows.Forms.DialogResult; |
13 | 16 |
|
14 | 17 | namespace Flow.Launcher.Plugin.Explorer
|
15 | 18 | {
|
@@ -101,10 +104,25 @@ public List<Result> LoadContextMenus(Result selectedResult)
|
101 | 104 | {
|
102 | 105 | try
|
103 | 106 | {
|
| 107 | + if (MessageBox.Show( |
| 108 | + string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefolderconfirm"),fileOrFolder), |
| 109 | + string.Empty, |
| 110 | + MessageBoxButton.YesNo, |
| 111 | + MessageBoxIcon.Warning) |
| 112 | + == DialogResult.No) |
| 113 | + return false; |
| 114 | + |
104 | 115 | if (record.Type == ResultType.File)
|
105 | 116 | File.Delete(record.FullPath);
|
106 | 117 | else
|
107 | 118 | Directory.Delete(record.FullPath, true);
|
| 119 | + |
| 120 | + Task.Run(() => |
| 121 | + { |
| 122 | + Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess"), |
| 123 | + string.Format(Context.API.GetTranslation("plugin_explorer_deletefilefoldersuccess_detail"), fileOrFolder), |
| 124 | + Constants.ExplorerIconImageFullPath); |
| 125 | + }); |
108 | 126 | }
|
109 | 127 | catch (Exception e)
|
110 | 128 | {
|
@@ -212,15 +230,11 @@ private Result CreateAddToIndexSearchExclusionListResult(SearchResult record)
|
212 | 230 | if(!Settings.IndexSearchExcludedSubdirectoryPaths.Any(x => x.Path == record.FullPath))
|
213 | 231 | Settings.IndexSearchExcludedSubdirectoryPaths.Add(new FolderLink { Path = record.FullPath });
|
214 | 232 |
|
215 |
| - var pluginDirectory = Directory.GetParent(Assembly.GetExecutingAssembly().Location.ToString()); |
216 |
| - |
217 |
| - var iconPath = pluginDirectory + "\\" + Constants.ExplorerIconImagePath; |
218 |
| - |
219 | 233 | Task.Run(() =>
|
220 | 234 | {
|
221 | 235 | Context.API.ShowMsg(Context.API.GetTranslation("plugin_explorer_excludedfromindexsearch_msg"),
|
222 | 236 | Context.API.GetTranslation("plugin_explorer_path") +
|
223 |
| - " " + record.FullPath, iconPath); |
| 237 | + " " + record.FullPath, Constants.ExplorerIconImageFullPath); |
224 | 238 |
|
225 | 239 | // so the new path can be persisted to storage and not wait till next ViewModel save.
|
226 | 240 | Context.API.SaveAppAllSettings();
|
|
0 commit comments