From 1a6cd5a744a0d6f7c472dee554e129779ad36970 Mon Sep 17 00:00:00 2001
From: Stone_Red <56473591+Stone-Red-Code@users.noreply.github.com>
Date: Wed, 21 Jan 2026 19:42:01 +0100
Subject: [PATCH] Add reload plugins button and open plugins in IDE support in
plugin manager
---
.../DataContexts/PluginEntryDataContext.cs | 37 +++++++++++++++-
src/DesktopMagic/Manager.cs | 8 ++++
src/DesktopMagic/Plugins/PluginManager.xaml | 14 ++++--
.../Plugins/PluginManager.xaml.cs | 44 +++++++++++++++----
4 files changed, 90 insertions(+), 13 deletions(-)
diff --git a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
index 5f60d2a..ae235fa 100644
--- a/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
+++ b/src/DesktopMagic/DataContexts/PluginEntryDataContext.cs
@@ -4,13 +4,14 @@ using DesktopMagic.Plugins;
using System;
using System.ComponentModel;
using System.Diagnostics;
+using System.IO;
using System.Runtime.CompilerServices;
using System.Windows;
using System.Windows.Input;
namespace DesktopMagic.DataContexts;
-internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, PluginEntryDataContext.Mode mode, string? path = null) : INotifyPropertyChanged
+internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand command, PluginEntryDataContext.Mode mode, string? path = null, string? csprojPath = null) : INotifyPropertyChanged
{
public event PropertyChangedEventHandler? PropertyChanged;
@@ -43,7 +44,11 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
{
get
{
- if (string.IsNullOrWhiteSpace(pluginMetadata.ProfileUri?.ToString()))
+ if (File.Exists(csprojPath))
+ {
+ return new("Code24", "IDE", true, new CommandHandler(OpenCsprojInIDE));
+ }
+ else if (string.IsNullOrWhiteSpace(pluginMetadata.ProfileUri?.ToString()))
{
return new("Folder24", (string)App.LanguageDictionary["folder"], path is not null, new CommandHandler(() => Process.Start("explorer.exe", path!)));
}
@@ -78,6 +83,34 @@ internal class PluginEntryDataContext(PluginMetadata pluginMetadata, ICommand co
_ = Process.Start(psi);
}
+ private void OpenCsprojInIDE()
+ {
+ string? associatedProgram = FileUtilities.GetAssociatedProgram(".csproj");
+ string pluginProjectPath = System.IO.Path.GetDirectoryName(csprojPath)!;
+
+ if (string.IsNullOrWhiteSpace(pluginProjectPath))
+ {
+ App.Logger.LogError("Could not determine plugin project directory.", source: "PluginManager");
+ return;
+ }
+
+ if (associatedProgram is null)
+ {
+ App.Logger.LogInfo($"Opening plugin project in Explorer: {pluginProjectPath}", source: "PluginManager");
+ _ = Process.Start("explorer.exe", pluginProjectPath);
+ return;
+ }
+
+ App.Logger.LogInfo($"Opening plugin project in IDE: {associatedProgram}", source: "PluginManager");
+ ProcessStartInfo psi = new ProcessStartInfo
+ {
+ FileName = associatedProgram,
+ Arguments = csprojPath,
+ };
+
+ _ = Process.Start(psi);
+ }
+
private string GetInstallUninstallButtonText()
{
return mode switch
diff --git a/src/DesktopMagic/Manager.cs b/src/DesktopMagic/Manager.cs
index b341a34..7a9d009 100644
--- a/src/DesktopMagic/Manager.cs
+++ b/src/DesktopMagic/Manager.cs
@@ -217,6 +217,14 @@ public sealed class Manager
PluginWindows.Add(window);
}
+ public void ReloadPlugins()
+ {
+ App.Logger.LogInfo("Reloading plugins", source: "PluginManager");
+
+ LoadPlugins();
+ LoadLayout(false);
+ }
+
public void SetEditMode(bool editMode)
{
_isEditMode = editMode;
diff --git a/src/DesktopMagic/Plugins/PluginManager.xaml b/src/DesktopMagic/Plugins/PluginManager.xaml
index 317836a..b994a6a 100644
--- a/src/DesktopMagic/Plugins/PluginManager.xaml
+++ b/src/DesktopMagic/Plugins/PluginManager.xaml
@@ -98,9 +98,11 @@
-
+
+
+
-
+
@@ -110,7 +112,13 @@
-