mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Merge pull request #3848 from Flow-Launcher/sys_plugin_improvement
Improve Sys plugin
This commit is contained in:
commit
2b4010720a
5 changed files with 34 additions and 17 deletions
|
|
@ -613,5 +613,17 @@ namespace Flow.Launcher.Plugin
|
|||
/// Invoked when the actual theme of the application has changed. Currently, the plugin will continue to be subscribed even if it is turned off.
|
||||
/// </summary>
|
||||
event ActualApplicationThemeChangedEventHandler ActualApplicationThemeChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Get the user data directory of Flow Launcher.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string GetDataDirectory();
|
||||
|
||||
/// <summary>
|
||||
/// Get the log directory of Flow Launcher.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
string GetLogDirectory();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -599,6 +599,10 @@ namespace Flow.Launcher
|
|||
remove => _mainVM.ActualApplicationThemeChanged -= value;
|
||||
}
|
||||
|
||||
public string GetDataDirectory() => DataLocation.DataDirectory();
|
||||
|
||||
public string GetLogDirectory() => DataLocation.VersionLogDirectory;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\Flow.Launcher.Infrastructure\Flow.Launcher.Infrastructure.csproj" />
|
||||
<ProjectReference Include="..\..\Flow.Launcher.Plugin\Flow.Launcher.Plugin.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@
|
|||
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_restart_computer">Are you sure you want to restart the computer?</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_restart_computer_advanced">Are you sure you want to restart the computer with Advanced Boot Options?</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_logoff_computer">Are you sure you want to log off?</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_sys_dlgtitle_error">Error</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_sys_dlgtext_empty_recycle_bin_failed">Failed to empty the recycle bin. This might happen if:{0}- Some items are currently in use{0}- Some items can't be deleted due to permissions{0}Please close any applications that might be using these files and try again.</system:String>
|
||||
|
||||
<system:String x:Key="flowlauncher_plugin_sys_command_keyword_setting_window_title">Command Keyword Setting</system:String>
|
||||
<system:String x:Key="flowlauncher_plugin_sys_custom_command_keyword">Custom Command Keyword</system:String>
|
||||
|
|
|
|||
|
|
@ -5,8 +5,6 @@ using System.Globalization;
|
|||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows;
|
||||
using Flow.Launcher.Infrastructure;
|
||||
using Flow.Launcher.Infrastructure.UserSettings;
|
||||
using Windows.Win32;
|
||||
using Windows.Win32.Foundation;
|
||||
using Windows.Win32.Security;
|
||||
|
|
@ -52,6 +50,8 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
private const SHUTDOWN_REASON REASON = SHUTDOWN_REASON.SHTDN_REASON_MAJOR_OTHER |
|
||||
SHUTDOWN_REASON.SHTDN_REASON_FLAG_PLANNED;
|
||||
|
||||
private const string Documentation = "https://flowlauncher.com/docs/#/usage-tips";
|
||||
|
||||
private PluginInitContext _context;
|
||||
private Settings _settings;
|
||||
private ThemeSelector _themeSelector;
|
||||
|
|
@ -338,11 +338,9 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
var result = PInvoke.SHEmptyRecycleBin(new(), string.Empty, 0);
|
||||
if (result != HRESULT.S_OK && result != HRESULT.E_UNEXPECTED)
|
||||
{
|
||||
_context.API.ShowMsgBox("Failed to empty the recycle bin. This might happen if:\n" +
|
||||
"- A file in the recycle bin is in use\n" +
|
||||
"- You don't have permission to delete some items\n" +
|
||||
"Please close any applications that might be using these files and try again.",
|
||||
"Error",
|
||||
_context.API.ShowMsgBox(
|
||||
string.Format(_context.API.GetTranslation("flowlauncher_plugin_sys_dlgtext_empty_recycle_bin_failed"), Environment.NewLine),
|
||||
_context.API.GetTranslation("flowlauncher_plugin_sys_dlgtitle_error"),
|
||||
MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
|
|
@ -404,6 +402,8 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
IcoPath = "Images\\app.png",
|
||||
Action = c =>
|
||||
{
|
||||
// Hide the window first then open setting dialog because main window can be topmost window which will still display on top of the setting dialog for a while
|
||||
_context.API.HideMainWindow();
|
||||
_context.API.OpenSettingDialog();
|
||||
return true;
|
||||
}
|
||||
|
|
@ -445,11 +445,11 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xf12b"),
|
||||
Title = "Open Log Location",
|
||||
IcoPath = "Images\\app.png",
|
||||
CopyText = DataLocation.VersionLogDirectory,
|
||||
AutoCompleteText = DataLocation.VersionLogDirectory,
|
||||
CopyText = _context.API.GetLogDirectory(),
|
||||
AutoCompleteText = _context.API.GetLogDirectory(),
|
||||
Action = c =>
|
||||
{
|
||||
_context.API.OpenDirectory(DataLocation.VersionLogDirectory);
|
||||
_context.API.OpenDirectory(_context.API.GetLogDirectory());
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
@ -458,11 +458,11 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Title = "Flow Launcher Tips",
|
||||
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xe897"),
|
||||
IcoPath = "Images\\app.png",
|
||||
CopyText = Constant.Documentation,
|
||||
AutoCompleteText = Constant.Documentation,
|
||||
CopyText = Documentation,
|
||||
AutoCompleteText = Documentation,
|
||||
Action = c =>
|
||||
{
|
||||
_context.API.OpenUrl(Constant.Documentation);
|
||||
_context.API.OpenUrl(Documentation);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
@ -471,11 +471,11 @@ namespace Flow.Launcher.Plugin.Sys
|
|||
Title = "Flow Launcher UserData Folder",
|
||||
Glyph = new GlyphInfo (FontFamily:"/Resources/#Segoe Fluent Icons", Glyph:"\xf12b"),
|
||||
IcoPath = "Images\\app.png",
|
||||
CopyText = DataLocation.DataDirectory(),
|
||||
AutoCompleteText = DataLocation.DataDirectory(),
|
||||
CopyText = _context.API.GetDataDirectory(),
|
||||
AutoCompleteText = _context.API.GetDataDirectory(),
|
||||
Action = c =>
|
||||
{
|
||||
_context.API.OpenDirectory(DataLocation.DataDirectory());
|
||||
_context.API.OpenDirectory(_context.API.GetDataDirectory());
|
||||
return true;
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue