diff --git a/Source/AutoHDR.Displays/Display.cs b/Source/AutoHDR.Displays/Display.cs index a8913e3..343483f 100644 --- a/Source/AutoHDR.Displays/Display.cs +++ b/Source/AutoHDR.Displays/Display.cs @@ -23,12 +23,10 @@ public class Display : BaseViewModel private bool _isPrimary; - [JsonProperty] public bool IsPrimary { get => _isPrimary; set { _isPrimary = value; OnPropertyChanged(); } } private string _name; - [JsonProperty] public string Name { get => _name; set { _name = value; OnPropertyChanged(); } } private string _graphicsCard; diff --git a/Source/AutoHDR/AutoHDRDaemon.cs b/Source/AutoHDR/AutoHDRDaemon.cs index bf38383..f2ef14c 100644 --- a/Source/AutoHDR/AutoHDRDaemon.cs +++ b/Source/AutoHDR/AutoHDRDaemon.cs @@ -114,27 +114,35 @@ private void Initialize() lock (_accessLock) { - if (Initialized) - return; - _threadManager = new ThreadManager(); - _threadManager.NewLog += (o, e) => Globals.Logs.Add(e, false); - _logsStorage = new LogsStorage(); - _lastActions = new ObservableCollection(); - InitializeApplicationWatcher(); - LoadSettings(); - Globals.Logs.Add("Initializing...", false); - - if (Settings.CheckForNewVersion) - CheckForNewVersion(); - InitializeDisplayManager(); - InitializeAudioManager(); - InitializeTrayMenuHelper(); - Globals.Instance.SaveSettings(); - CreateRelayCommands(); - ShowView = !Settings.StartMinimizedToTray; - Initialized = true; - Globals.Logs.Add("Initialized", false); - Start(); + try + { + if (Initialized) + return; + _threadManager = new ThreadManager(); + _threadManager.NewLog += (o, e) => Globals.Logs.Add(e, false); + _logsStorage = new LogsStorage(); + _lastActions = new ObservableCollection(); + InitializeApplicationWatcher(); + LoadSettings(); + Globals.Logs.Add("Initializing...", false); + + if (Settings.CheckForNewVersion) + CheckForNewVersion(); + InitializeDisplayManager(); + InitializeAudioManager(); + InitializeTrayMenuHelper(); + Globals.Instance.SaveSettings(); + CreateRelayCommands(); + ShowView = !Settings.StartMinimizedToTray; + Initialized = true; + Globals.Logs.Add("Initialized", false); + Start(); + } + catch (Exception ex) + { + Globals.Logs.AddException(ex); + throw ex; + } } } @@ -148,11 +156,18 @@ private void InitializeApplicationWatcher() private void ApplicationWatcher_ApplicationChanged(object sender, ApplicationChangedEventArgs e) { - Globals.Logs.Add($"Application {e.Application} changed: {e.ChangedType}", false); - CurrentApplication = e.Application; - UpdateCurrentProfile(e.Application, e.ChangedType); - if (e.ChangedType == ApplicationChangedType.Closed) - CurrentApplication = null; + try + { + Globals.Logs.Add($"Application {e.Application} changed: {e.ChangedType}", false); + CurrentApplication = e.Application; + UpdateCurrentProfile(e.Application, e.ChangedType); + if (e.ChangedType == ApplicationChangedType.Closed) + CurrentApplication = null; + } + catch (Exception ex) + { + Globals.Logs.AddException(ex); + } } private void ApplicationWatcher_NewLog(object sender, string e) @@ -336,13 +351,9 @@ private void LoadSettings() Settings.PropertyChanged += Settings_PropertyChanged; - ApplicationProfileAssigments_CollectionChanged( - Settings.ApplicationProfileAssignments, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfileAssignments.ToList())); - + ApplicationProfileAssigments_CollectionChanged(Settings.ApplicationProfileAssignments, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfileAssignments.ToList())); ApplicationProfiles_CollectionChanged(Settings.ApplicationProfiles, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfiles.ToList())); - - - + ActionShortcuts_CollectionChanged(Settings.ActionShortcuts, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ActionShortcuts.ToList())); Monitors_CollectionChanged(Settings.Displays, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.Displays.ToList())); diff --git a/Source/AutoHDR/ProfileActionShortcut.cs b/Source/AutoHDR/ProfileActionShortcut.cs index 9068a5b..bf2a3dd 100644 --- a/Source/AutoHDR/ProfileActionShortcut.cs +++ b/Source/AutoHDR/ProfileActionShortcut.cs @@ -63,11 +63,7 @@ public ActionShortcutManager() } - private void ActionShortcuts_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) - { - throw new NotImplementedException(); - } - + private void AddActionShortcut() { ProfileActionAdder adder = new ProfileActionAdder(); diff --git a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs index 5dd1ecf..6df143b 100644 --- a/Source/AutoHDR/Profiles/Actions/DisplayAction.cs +++ b/Source/AutoHDR/Profiles/Actions/DisplayAction.cs @@ -79,12 +79,6 @@ public Size Resolution { get { - try - { - if (Display.IsAllDisplay()) - return AllDisplays[1].Resolution; - } - catch { } return _resolution; } set { _resolution = value; OnPropertyChanged(); } @@ -97,12 +91,6 @@ public int RefreshRate { get { - try - { - if (Display.IsAllDisplay()) - return AllDisplays[1].RefreshRate; - } - catch { } return _refreshRate; } set { _refreshRate = value; OnPropertyChanged(); } } @@ -113,13 +101,7 @@ public int RefreshRate public ColorDepth ColorDepth { get - { - try - { - if (Display.IsAllDisplay()) - return AllDisplays[1].ColorDepth; - } - catch { } + { return _colorDepth; } set { _colorDepth = value; OnPropertyChanged(); } } diff --git a/Source/AutoHDR/Properties/AssemblyInfo.cs b/Source/AutoHDR/Properties/AssemblyInfo.cs index 62bc0c2..467a18d 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.2.0")] -[assembly: AssemblyFileVersion("1.9.2.0")] +[assembly: AssemblyVersion("1.9.4.0")] +[assembly: AssemblyFileVersion("1.9.4.0")] diff --git a/Source/AutoHDR/UserAppSettings.cs b/Source/AutoHDR/UserAppSettings.cs index 7921de0..1642010 100644 --- a/Source/AutoHDR/UserAppSettings.cs +++ b/Source/AutoHDR/UserAppSettings.cs @@ -27,7 +27,7 @@ public class UserAppSettings : BaseViewModel private bool _checkForNewVersion = true; readonly object _audioDevicesLock = new object(); private Guid _defaultProfileGuid = Guid.Empty; - private Size _windowSize = new Size(1280, 800); + private Size _windowSize = new Size(1280, 800); private SortableObservableCollection _applicationProfileAssignments; @@ -94,7 +94,7 @@ public static UserAppSettings ReadSettings(string path) { try - { + { string serializedJson = File.ReadAllText(path); serializedJson = UpgradeJson(serializedJson); settings = (UserAppSettings)JsonConvert.DeserializeObject(serializedJson, new JsonSerializerSettings