diff --git a/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs b/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs index 86f38e0a1..dd5900922 100644 --- a/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs +++ b/src/Artemis.Core/Services/ProcessMonitor/ProcessMonitorService.cs @@ -39,13 +39,13 @@ namespace Artemis.Core.Services foreach (Process startedProcess in newProcesses.Except(_lastScannedProcesses, _comparer)) { ProcessStarted?.Invoke(this, new ProcessEventArgs(startedProcess)); - _logger.Debug("Started Process: {startedProcess}", startedProcess.ProcessName); + _logger.Verbose("Started Process: {startedProcess}", startedProcess.ProcessName); } foreach (Process stoppedProcess in _lastScannedProcesses.Except(newProcesses, _comparer)) { ProcessStopped?.Invoke(this, new ProcessEventArgs(stoppedProcess)); - _logger.Debug("Stopped Process: {stoppedProcess}", stoppedProcess.ProcessName); + _logger.Verbose("Stopped Process: {stoppedProcess}", stoppedProcess.ProcessName); } _lastScannedProcesses = newProcesses; diff --git a/src/Artemis.UI/Bootstrapper.cs b/src/Artemis.UI/Bootstrapper.cs index 471d56412..11d1f56c9 100644 --- a/src/Artemis.UI/Bootstrapper.cs +++ b/src/Artemis.UI/Bootstrapper.cs @@ -14,6 +14,7 @@ using Artemis.UI.Services; using Artemis.UI.Shared; using Artemis.UI.Shared.Services; using Artemis.UI.Stylet; +using Artemis.UI.Utilities; using Ninject; using Serilog; using Stylet; @@ -47,6 +48,8 @@ namespace Artemis.UI return; } + try { DPIAwareness.Initalize(); } catch (Exception ex) { logger.Error($"Failed to set DPI-Awareness: {ex.Message}"); } + IViewManager viewManager = Kernel.Get(); StartupArguments = Args.ToList(); @@ -68,7 +71,7 @@ namespace Artemis.UI Execute.OnUIThreadSync(() => { UIElement view = viewManager.CreateAndBindViewForModelIfNecessary(RootViewModel); - ((TrayViewModel) RootViewModel).SetTaskbarIcon(view); + ((TrayViewModel)RootViewModel).SetTaskbarIcon(view); }); // Initialize the core async so the UI can show the progress diff --git a/src/Artemis.UI/Properties/AssemblyInfo.cs b/src/Artemis.UI/Properties/AssemblyInfo.cs index 412a20daf..aee89dd05 100644 --- a/src/Artemis.UI/Properties/AssemblyInfo.cs +++ b/src/Artemis.UI/Properties/AssemblyInfo.cs @@ -1,11 +1,14 @@ using System.Runtime.InteropServices; using System.Windows; +using System.Windows.Media; // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from // COM, set the ComVisible attribute to true on that type. [assembly: ComVisible(false)] +[assembly: DisableDpiAwareness] + //In order to begin building localizable applications, set //CultureYouAreCodingWith in your .csproj file //inside a . For example, if you are using US english @@ -15,7 +18,6 @@ using System.Windows; //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, diff --git a/src/Artemis.UI/Utilities/DPIAwareness.cs b/src/Artemis.UI/Utilities/DPIAwareness.cs new file mode 100644 index 000000000..1a89562a2 --- /dev/null +++ b/src/Artemis.UI/Utilities/DPIAwareness.cs @@ -0,0 +1,36 @@ +using System.Runtime.InteropServices; + +namespace Artemis.UI.Utilities +{ + public static class DPIAwareness + { + [DllImport("user32.dll", SetLastError = true)] + internal static extern bool SetProcessDpiAwarenessContext(int dpiFlag); + + [DllImport("SHCore.dll", SetLastError = true)] + internal static extern bool SetProcessDpiAwareness(PROCESS_DPI_AWARENESS awareness); + + [DllImport("user32.dll")] + internal static extern bool SetProcessDPIAware(); + + internal enum PROCESS_DPI_AWARENESS + { + Process_DPI_Unaware = 0, + Process_System_DPI_Aware = 1, + Process_Per_Monitor_DPI_Aware = 2 + } + + internal enum DPI_AWARENESS_CONTEXT + { + DPI_AWARENESS_CONTEXT_UNAWARE = 16, + DPI_AWARENESS_CONTEXT_SYSTEM_AWARE = 17, + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE = 18, + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 = 34 + } + + public static void Initalize() + { + SetProcessDpiAwarenessContext((int)DPI_AWARENESS_CONTEXT.DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2); + } + } +}