mirror of
https://github.com/terrymacdonald/DisplayMagician.git
synced 2024-08-30 18:32:20 +00:00
Moved AUMID to Shared project
And also added it to the LogReporter project.
This commit is contained in:
parent
50d9726141
commit
33689931ca
@ -10,11 +10,13 @@ using WindowsDisplayAPI.DisplayConfig;
|
|||||||
using NvAPIWrapper.GPU;
|
using NvAPIWrapper.GPU;
|
||||||
using NvAPIWrapper.Mosaic;
|
using NvAPIWrapper.Mosaic;
|
||||||
using AudioSwitcher.AudioApi.CoreAudio;
|
using AudioSwitcher.AudioApi.CoreAudio;
|
||||||
|
using DisplayMagician.Shared;
|
||||||
|
|
||||||
namespace DisplayMagician.LogReporter
|
namespace DisplayMagician.LogReporter
|
||||||
{
|
{
|
||||||
internal class Program
|
internal class Program
|
||||||
{
|
{
|
||||||
|
|
||||||
private static StreamWriter _writer;
|
private static StreamWriter _writer;
|
||||||
internal static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "DisplayMagician");
|
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)
|
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("DisplayMagician LogReporter");
|
||||||
Console.WriteLine("======================");
|
Console.WriteLine("======================");
|
||||||
Console.WriteLine();
|
Console.WriteLine();
|
||||||
|
@ -68,6 +68,7 @@
|
|||||||
<Compile Include="Rotation.cs" />
|
<Compile Include="Rotation.cs" />
|
||||||
<Compile Include="Scaling.cs" />
|
<Compile Include="Scaling.cs" />
|
||||||
<Compile Include="ProfileRepository.cs" />
|
<Compile Include="ProfileRepository.cs" />
|
||||||
|
<Compile Include="ShellUtils.cs" />
|
||||||
<Compile Include="Topology\Path.cs" />
|
<Compile Include="Topology\Path.cs" />
|
||||||
<Compile Include="Topology\PathHelper.cs" />
|
<Compile Include="Topology\PathHelper.cs" />
|
||||||
<Compile Include="Topology\PathTarget.cs" />
|
<Compile Include="Topology\PathTarget.cs" />
|
||||||
|
23
DisplayMagician.Shared/ShellUtils.cs
Normal file
23
DisplayMagician.Shared/ShellUtils.cs
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ using DisplayMagician.Shared;
|
|||||||
using DisplayMagician.UIForms;
|
using DisplayMagician.UIForms;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Runtime.InteropServices;
|
//using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace DisplayMagician {
|
namespace DisplayMagician {
|
||||||
|
|
||||||
@ -26,7 +26,6 @@ namespace DisplayMagician {
|
|||||||
|
|
||||||
internal static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
internal static string AUMID = "LittleBitBig.DisplayMagician";
|
|
||||||
internal static string AppDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "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 AppIconPath = Path.Combine(Program.AppDataPath, $"Icons");
|
||||||
public static string AppProfilePath = Path.Combine(Program.AppDataPath, $"Profiles");
|
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
|
// This sets the Application User Model ID to "LittleBitBig.DisplayMagician" so that
|
||||||
// Windows 10 recognises the application, and allows features such as Toasts,
|
// Windows 10 recognises the application, and allows features such as Toasts,
|
||||||
// taskbar pinning and similar.
|
// 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
|
// Prepare NLog for logging
|
||||||
var config = new NLog.Config.LoggingConfiguration();
|
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);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user