diff --git a/Source/AutoHDR.Displays/Display.cs b/Source/AutoHDR.Displays/Display.cs index 343483f..6a9a21a 100644 --- a/Source/AutoHDR.Displays/Display.cs +++ b/Source/AutoHDR.Displays/Display.cs @@ -14,7 +14,7 @@ namespace AutoHDR.Displays [JsonObject(MemberSerialization.OptIn)] public class Display : BaseViewModel { - public static readonly Display AllDisplays = new Display(Locale.AllDisplays, UInt32.MaxValue); + public static readonly Display AllDisplays = new Display(Locale.AllDisplays, UInt32.MaxValue, UInt32.MaxValue); private bool _managed = true; [JsonProperty] @@ -37,7 +37,11 @@ public class Display : BaseViewModel private UInt32 _uid; [JsonProperty] - public UInt32 UID { get => _uid; set { _uid = value; OnPropertyChanged(); } } + public UInt32 UID + { + get => _uid; + set { _uid = value; OnPropertyChanged(); } + } private uint _id; @@ -81,20 +85,13 @@ public Display(DisplayInformation monitorInformation, uint uid) GraphicsCard = monitorInformation.DisplayDevice.DeviceString; } - public Display(string name, uint uid) + public Display(string name, uint uid, uint id) { Name = name; UID = uid; + ID = id; } - public Display(uint iD, uint uID, bool isPrimary, string name, string graphicsCard) - { - IsPrimary = isPrimary; - Name = name; - GraphicsCard = graphicsCard; - UID = uID; - ID = iD; - } public void UpdateHDRState() { diff --git a/Source/AutoHDR.Displays/DisplayManagerNvidia.cs b/Source/AutoHDR.Displays/DisplayManagerNvidia.cs index 197d092..c54af5e 100644 --- a/Source/AutoHDR.Displays/DisplayManagerNvidia.cs +++ b/Source/AutoHDR.Displays/DisplayManagerNvidia.cs @@ -38,40 +38,6 @@ public override List GetActiveMonitors() return displays; } - public List GetActiveMonitors2() - { - List displays = new List(); - DisplayHandle[] handles = DisplayApi.EnumNvidiaDisplayHandle(); - IPathInfo[] config = DisplayApi.GetDisplayConfig(); - for (int i = 0; i < handles.Length; i++) - { - string displayName = DisplayApi.GetAssociatedNvidiaDisplayName(handles[i]); - uint displayID = DisplayApi.GetDisplayIdByDisplayName(displayName); - IPathInfo pathInfo = config.First(p => p.TargetsInfo.ToList().First().DisplayId == displayID); - - DisplayDevice displayDevice = new DisplayDevice(displayID); - if (displayDevice.IsActive) - { - uint id = pathInfo.SourceId; - uint uid = 0; - if (Displays.Any(m => m.Tag != null && displayDevice.DisplayId.Equals(((DisplayDevice)m.Tag).DisplayId))) - uid = Displays.First(m => displayDevice.DisplayId.Equals(((DisplayDevice)m.Tag).DisplayId)).UID; - else - uid = GetUID(id); - bool isPrimary = pathInfo.SourceModeInfo.IsGDIPrimary; - string name = displayName; - string graphicsCard = displayDevice.Output.PhysicalGPU.FullName; - Display display = new Display(id, uid, isPrimary, name, graphicsCard); - display.Tag = displayDevice; - display.Resolution = new Size(displayDevice.CurrentTiming.HorizontalActive, displayDevice.CurrentTiming.VerticalActive); - display.RefreshRate = GetRefreshRate(display); - display.ColorDepth = GetColorDepth(display); - displays.Add(display); - - } - } - return displays; - } public override void SetColorDepth(Display display, ColorDepth colorDepth) { diff --git a/Source/AutoHDR/AutoHDRDaemon.cs b/Source/AutoHDR/AutoHDRDaemon.cs index f2ef14c..5c71e51 100644 --- a/Source/AutoHDR/AutoHDRDaemon.cs +++ b/Source/AutoHDR/AutoHDRDaemon.cs @@ -439,7 +439,11 @@ private void Shutdown() ApplicationWatcher.NewLog -= ApplicationWatcher_NewLog; ApplicationWatcher.ApplicationChanged -= ApplicationWatcher_ApplicationChanged; Stop(); - // TrayMenuHelper.SwitchTrayIcon(false); + try + { + TrayMenuHelper.SwitchTrayIcon(false); + } + catch {} Application.Current.Shutdown(); } @@ -651,8 +655,6 @@ private void ApplicationProfiles_CollectionChanged(object sender, NotifyCollecti } break; } - - Globals.Instance.SaveSettings(); } diff --git a/Source/AutoHDR/ProfileActionShortcut.cs b/Source/AutoHDR/ProfileActionShortcut.cs index bf2a3dd..399ba36 100644 --- a/Source/AutoHDR/ProfileActionShortcut.cs +++ b/Source/AutoHDR/ProfileActionShortcut.cs @@ -16,7 +16,11 @@ public class ProfileActionShortcut : BaseViewModel private IProfileAction _action; [JsonProperty] - public IProfileAction Action { get => _action; set { _action = value; OnPropertyChanged(); } } + public IProfileAction Action + { + get => _action; + set { _action = value; OnPropertyChanged(); } + } private string _shortcutName; diff --git a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs index 6df143b..9de53dd 100644 --- a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs +++ b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs @@ -29,24 +29,43 @@ public List AllDisplays return displays; } } - private Display _display = null; + + private uint _displayUID = uint.MaxValue; [JsonProperty] + public uint DisplayUID + { + get => _displayUID; + set + { + _displayUID = value; + OnPropertyChanged(); + OnPropertyChanged(nameof(Display)); + try + { + Resolution = Display.Resolution; + RefreshRate = Display.RefreshRate; + } + catch (Exception) + { } + + } + } + + private Display _display = null; + public Display Display { - get => _display; + get => AllDisplays.FirstOrDefault(d => d.UID.Equals(DisplayUID)); set { - _display = value; - OnPropertyChanged(); + DisplayUID = value.UID; - Resolution = value.Resolution; - RefreshRate = value.RefreshRate; } } - public override string ActionTypeName => ProjectResources.ProjectLocales.DisplayAction; - + public override string ActionTypeName => ProjectResources.ProjectLocales.DisplayAction; + private bool _changeHDR = false; [JsonProperty] diff --git a/Source/AutoHDR/Properties/AssemblyInfo.cs b/Source/AutoHDR/Properties/AssemblyInfo.cs index 467a18d..8e80980 100644 --- a/Source/AutoHDR/Properties/AssemblyInfo.cs +++ b/Source/AutoHDR/Properties/AssemblyInfo.cs @@ -52,5 +52,5 @@ // Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, // indem Sie "*" wie unten gezeigt eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.9.4.0")] -[assembly: AssemblyFileVersion("1.9.4.0")] +[assembly: AssemblyVersion("1.9.5.0")] +[assembly: AssemblyFileVersion("1.9.5.0")]