diff --git a/Helper/ContextMenuHelper.cs b/Helper/ContextMenuHelper.cs
index b5cbe173c..15b9f0d3e 100644
--- a/Helper/ContextMenuHelper.cs
+++ b/Helper/ContextMenuHelper.cs
@@ -5,10 +5,8 @@
using System;
using System.Collections.Generic;
using System.Windows;
-using System.Windows.Input;
+using Flow.Launcher.Plugin;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
-using Wox.Plugin;
-using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
@@ -24,23 +22,18 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
/// The result for the context menu entires
/// The name of the this assembly
/// A list with context menu entries
- internal static List GetContextMenu(in Result result, in string assemblyName)
+ internal static List GetContextMenu(in Result result, in string assemblyName)
{
- if (!(result?.ContextData is WindowsSetting entry))
+ if (result?.ContextData is not WindowsSetting entry)
{
- return new List(0);
+ return new List(0);
}
- var list = new List(1)
+ var list = new List(1)
{
- new ContextMenuResult
+ new()
{
- AcceleratorKey = Key.C,
- AcceleratorModifiers = ModifierKeys.Control,
Action = _ => TryToCopyToClipBoard(entry.Command),
- FontFamily = "Segoe MDL2 Assets",
- Glyph = "\xE8C8", // E8C8 => Symbol: Copy
- PluginName = assemblyName,
Title = $"{Resources.CopyCommand} (Ctrl+C)",
},
};
diff --git a/Helper/JsonSettingsListHelper.cs b/Helper/JsonSettingsListHelper.cs
index 0ec818589..bff041864 100644
--- a/Helper/JsonSettingsListHelper.cs
+++ b/Helper/JsonSettingsListHelper.cs
@@ -9,7 +9,6 @@ using System.Linq;
using System.Reflection;
using System.Text.Json;
using System.Text.Json.Serialization;
-using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
diff --git a/Helper/ResultHelper.cs b/Helper/ResultHelper.cs
index fbea9bab1..4fd27f9d3 100644
--- a/Helper/ResultHelper.cs
+++ b/Helper/ResultHelper.cs
@@ -7,9 +7,8 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
+using Flow.Launcher.Plugin;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
-using Wox.Plugin;
-using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
@@ -80,7 +79,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
toolTipText.Append($"{Resources.Note}: {entry.Note}");
}
- result.ToolTipData = new ToolTipData(entry.Name, toolTipText.ToString());
+ result.TitleToolTip = toolTipText.ToString();
}
///
diff --git a/Helper/TranslationHelper.cs b/Helper/TranslationHelper.cs
index ee3d92c36..4e8fa40ed 100644
--- a/Helper/TranslationHelper.cs
+++ b/Helper/TranslationHelper.cs
@@ -6,7 +6,6 @@ using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
-using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
diff --git a/Helper/UnsupportedSettingsHelper.cs b/Helper/UnsupportedSettingsHelper.cs
index d455067f4..30f28a1db 100644
--- a/Helper/UnsupportedSettingsHelper.cs
+++ b/Helper/UnsupportedSettingsHelper.cs
@@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Wox.Plugin.Logger;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper
{
diff --git a/Log.cs b/Log.cs
new file mode 100644
index 000000000..090c9a737
--- /dev/null
+++ b/Log.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Runtime.CompilerServices;
+using Flow.Launcher.Plugin;
+
+namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
+{
+ public static class Log
+ {
+ private static IPublicAPI _api;
+
+ public static void Init(IPublicAPI api)
+ {
+ _api = api;
+ }
+ public static void Exception(string message, Exception exception, Type type, [CallerMemberName] string methodName = "")
+ {
+ _api.LogException(type.FullName, message, exception, methodName);
+ }
+ public static void Warn(string message, Type type, [CallerMemberName] string methodName = "")
+ {
+ _api.LogWarn(type.FullName, message, methodName);
+ }
+ }
+}
diff --git a/Main.cs b/Main.cs
index 9c6fabbf1..4961266df 100644
--- a/Main.cs
+++ b/Main.cs
@@ -6,17 +6,16 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
-using ManagedCommon;
+using Flow.Launcher.Plugin;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Helper;
using Microsoft.PowerToys.Run.Plugin.WindowsSettings.Properties;
-using Wox.Plugin;
namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
{
///
/// Main class of this plugin that implement all used interfaces.
///
- public class Main : IPlugin, IContextMenu, IPluginI18n, IDisposable
+ public sealed class Main : IPlugin, IContextMenu, IPluginI18n, IDisposable
{
///
/// The path to the symbol for a light theme.
@@ -79,8 +78,6 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
public void Init(PluginInitContext context)
{
_context = context ?? throw new ArgumentNullException(nameof(context));
- _context.API.ThemeChanged += OnThemeChanged;
- UpdateIconPath(_context.API.GetCurrentTheme());
_settingsList = JsonSettingsListHelper.ReadAllPossibleSettings();
_settingsList = UnsupportedSettingsHelper.FilterByBuild(_settingsList);
@@ -126,7 +123,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
return true;
}
- if (!(found.AltNames is null))
+ if (found.AltNames is not null)
{
foreach (var altName in found.AltNames)
{
@@ -146,7 +143,7 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
///
/// The for the list with context menu entries.
/// A list context menu entries.
- public List LoadContextMenus(Result selectedResult)
+ public List LoadContextMenus(Result selectedResult)
{
return ContextMenuHelper.GetContextMenu(selectedResult, _assemblyName);
}
@@ -162,18 +159,13 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
/// Wrapper method for that dispose additional objects and events form the plugin itself.
///
/// Indicate that the plugin is disposed.
- protected virtual void Dispose(bool disposing)
+ private void Dispose(bool disposing)
{
if (_disposed || !disposing)
{
return;
}
- if (_context != null && _context.API != null)
- {
- _context.API.ThemeChanged -= OnThemeChanged;
- }
-
_disposed = true;
}
@@ -192,26 +184,5 @@ namespace Microsoft.PowerToys.Run.Plugin.WindowsSettings
{
return Description;
}
-
- ///
- /// Change all theme-based elements (typical called when the plugin theme has changed).
- ///
- /// The old .
- /// The new .
- private void OnThemeChanged(Theme oldtheme, Theme newTheme)
- {
- UpdateIconPath(newTheme);
- }
-
- ///
- /// Update all icons (typical called when the plugin theme has changed).
- ///
- /// The new for the icons.
- private void UpdateIconPath(Theme theme)
- {
- _defaultIconPath = theme == Theme.Light || theme == Theme.HighContrastWhite
- ? _lightSymbol
- : _darkSymbol;
- }
}
}
diff --git a/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj b/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj
index 4b7cf12b2..51656745e 100644
--- a/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj
+++ b/Microsoft.PowerToys.Run.Plugin.WindowsSettings.csproj
@@ -1,13 +1,10 @@
-
-
- netcoreapp3.1
+ net5.0-windows
{5043CECE-E6A7-4867-9CBE-02D27D83747A}
Properties
Microsoft.PowerToys.Run.Plugin.WindowsSettings
Microsoft.PowerToys.Run.Plugin.WindowsSettings
- $(Version).0
false
false
x64
@@ -18,12 +15,11 @@
- ..\..\..\..\..\x64\Debug\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\
+ Debug\WindowsSettings\
DEBUG;TRACE
false
- full
+ portable
true
- 8.0
x64
MinimumRecommendedRules.ruleset
4
@@ -31,11 +27,10 @@
- ..\..\..\..\..\x64\Release\modules\launcher\Plugins\Microsoft.PowerToys.Run.Plugin.WindowsSettings\
+ Release\WindowsSettings\
TRACE
true
- pdbonly
- 8.0
+ portable
x64
MinimumRecommendedRules.ruleset
4
@@ -46,29 +41,12 @@
-
-
- false
-
-
- false
-
-
-
PreserveNewest
-
-
- GlobalSuppressions.cs
-
-
- StyleCop.json
-
-
@@ -76,14 +54,6 @@
-
-
- 1.1.118
- runtime; build; native; contentfiles; analyzers; buildtransitive
- all
-
-
-
True
@@ -108,4 +78,8 @@
+
+
+
+
\ No newline at end of file