diff --git a/DisplayMagician.LogReporter/Program.cs b/DisplayMagician.LogReporter/Program.cs
index c6ed01d..280b680 100644
--- a/DisplayMagician.LogReporter/Program.cs
+++ b/DisplayMagician.LogReporter/Program.cs
@@ -10,11 +10,13 @@ using WindowsDisplayAPI.DisplayConfig;
using NvAPIWrapper.GPU;
using NvAPIWrapper.Mosaic;
using AudioSwitcher.AudioApi.CoreAudio;
+using DisplayMagician.Shared;
namespace DisplayMagician.LogReporter
{
internal class Program
{
+
private static StreamWriter _writer;
internal static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
@@ -87,6 +89,13 @@ namespace DisplayMagician.LogReporter
private static void Main(string[] args)
{
+ // This sets the Application User Model ID to "LittleBitBig.DisplayMagician" so that
+ // Windows 10 recognises the application, and allows features such as Toasts,
+ // taskbar pinning and similar.
+ // This is a helper function that sets the AUMID to a static default defined
+ // within ShellUtils under the DisplayMagician.Shared project.
+ ShellUtils.SetDefaultProcessExplicitAppUserModelID();
+
Console.WriteLine("DisplayMagician LogReporter");
Console.WriteLine("======================");
Console.WriteLine();
diff --git a/DisplayMagician.Shared/DisplayMagician.Shared.csproj b/DisplayMagician.Shared/DisplayMagician.Shared.csproj
index 13c3497..98aff7e 100644
--- a/DisplayMagician.Shared/DisplayMagician.Shared.csproj
+++ b/DisplayMagician.Shared/DisplayMagician.Shared.csproj
@@ -68,6 +68,7 @@
+
diff --git a/DisplayMagician.Shared/ShellUtils.cs b/DisplayMagician.Shared/ShellUtils.cs
new file mode 100644
index 0000000..70a409c
--- /dev/null
+++ b/DisplayMagician.Shared/ShellUtils.cs
@@ -0,0 +1,23 @@
+using System.Runtime.InteropServices;
+
+namespace DisplayMagician.Shared
+{
+ public class ShellUtils
+ {
+ public static string AUMID = "LittleBitBig.DisplayMagician";
+
+ // Add the ability to set an Application AUMID so that Windows 10+ recognises the
+ // application and things like Toasts, Tasbar pinning and similar functionality
+ // works as intended. This DLL import avoids the need to package the app as an MSIX
+ // or moving to a WiX based installer at this stage, or the need to add this to the
+ // Windows Store.
+ [DllImport("shell32.dll", SetLastError = true)]
+ public static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
+
+ public static void SetDefaultProcessExplicitAppUserModelID()
+ {
+ SetCurrentProcessExplicitAppUserModelID(AUMID);
+ }
+
+ }
+}
diff --git a/DisplayMagician/Program.cs b/DisplayMagician/Program.cs
index 675dc08..69789f5 100644
--- a/DisplayMagician/Program.cs
+++ b/DisplayMagician/Program.cs
@@ -13,7 +13,7 @@ using DisplayMagician.Shared;
using DisplayMagician.UIForms;
using System.Text.RegularExpressions;
using System.Drawing;
-using System.Runtime.InteropServices;
+//using System.Runtime.InteropServices;
namespace DisplayMagician {
@@ -26,7 +26,6 @@ namespace DisplayMagician {
internal static class Program
{
- internal static string AUMID = "LittleBitBig.DisplayMagician";
internal static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
public static string AppIconPath = Path.Combine(Program.AppDataPath, $"Icons");
public static string AppProfilePath = Path.Combine(Program.AppDataPath, $"Profiles");
@@ -52,7 +51,9 @@ namespace DisplayMagician {
// This sets the Application User Model ID to "LittleBitBig.DisplayMagician" so that
// Windows 10 recognises the application, and allows features such as Toasts,
// taskbar pinning and similar.
- SetCurrentProcessExplicitAppUserModelID(AUMID);
+ // This is a helper function that sets the AUMID to a static default defined
+ // within ShellUtils under the DisplayMagician.Shared project.
+ ShellUtils.SetDefaultProcessExplicitAppUserModelID();
// Prepare NLog for logging
var config = new NLog.Config.LoggingConfiguration();
@@ -608,14 +609,6 @@ namespace DisplayMagician {
}
- // Add the ability to set an Application AUMID so that Windows 10+ recognises the
- // application and things like Toasts, Tasbar pinning and similar functionality
- // works as intended. This DLL import avoids the need to package the app as an MSIX
- // or moving to a WiX based installer at this stage, or the need to add this to the
- // Windows Store.
- [DllImport("shell32.dll", SetLastError = true)]
- static extern void SetCurrentProcessExplicitAppUserModelID([MarshalAs(UnmanagedType.LPWStr)] string AppID);
-
}