Skip to content

Commit 2eece06

Browse files
committed
1.9.4
[Bug fixes] - Action shortcuts display selection not being saved after restart #89
1 parent 47f7ac9 commit 2eece06

File tree

6 files changed

+49
-62
lines changed

6 files changed

+49
-62
lines changed

Source/AutoHDR.Displays/Display.cs

-2
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,10 @@ public class Display : BaseViewModel
2323

2424
private bool _isPrimary;
2525

26-
[JsonProperty]
2726
public bool IsPrimary { get => _isPrimary; set { _isPrimary = value; OnPropertyChanged(); } }
2827

2928
private string _name;
3029

31-
[JsonProperty]
3230
public string Name { get => _name; set { _name = value; OnPropertyChanged(); } }
3331

3432
private string _graphicsCard;

Source/AutoHDR/AutoHDRDaemon.cs

+43-32
Original file line numberDiff line numberDiff line change
@@ -114,27 +114,35 @@ private void Initialize()
114114

115115
lock (_accessLock)
116116
{
117-
if (Initialized)
118-
return;
119-
_threadManager = new ThreadManager();
120-
_threadManager.NewLog += (o, e) => Globals.Logs.Add(e, false);
121-
_logsStorage = new LogsStorage();
122-
_lastActions = new ObservableCollection<IProfileAction>();
123-
InitializeApplicationWatcher();
124-
LoadSettings();
125-
Globals.Logs.Add("Initializing...", false);
126-
127-
if (Settings.CheckForNewVersion)
128-
CheckForNewVersion();
129-
InitializeDisplayManager();
130-
InitializeAudioManager();
131-
InitializeTrayMenuHelper();
132-
Globals.Instance.SaveSettings();
133-
CreateRelayCommands();
134-
ShowView = !Settings.StartMinimizedToTray;
135-
Initialized = true;
136-
Globals.Logs.Add("Initialized", false);
137-
Start();
117+
try
118+
{
119+
if (Initialized)
120+
return;
121+
_threadManager = new ThreadManager();
122+
_threadManager.NewLog += (o, e) => Globals.Logs.Add(e, false);
123+
_logsStorage = new LogsStorage();
124+
_lastActions = new ObservableCollection<IProfileAction>();
125+
InitializeApplicationWatcher();
126+
LoadSettings();
127+
Globals.Logs.Add("Initializing...", false);
128+
129+
if (Settings.CheckForNewVersion)
130+
CheckForNewVersion();
131+
InitializeDisplayManager();
132+
InitializeAudioManager();
133+
InitializeTrayMenuHelper();
134+
Globals.Instance.SaveSettings();
135+
CreateRelayCommands();
136+
ShowView = !Settings.StartMinimizedToTray;
137+
Initialized = true;
138+
Globals.Logs.Add("Initialized", false);
139+
Start();
140+
}
141+
catch (Exception ex)
142+
{
143+
Globals.Logs.AddException(ex);
144+
throw ex;
145+
}
138146
}
139147
}
140148

@@ -148,11 +156,18 @@ private void InitializeApplicationWatcher()
148156

149157
private void ApplicationWatcher_ApplicationChanged(object sender, ApplicationChangedEventArgs e)
150158
{
151-
Globals.Logs.Add($"Application {e.Application} changed: {e.ChangedType}", false);
152-
CurrentApplication = e.Application;
153-
UpdateCurrentProfile(e.Application, e.ChangedType);
154-
if (e.ChangedType == ApplicationChangedType.Closed)
155-
CurrentApplication = null;
159+
try
160+
{
161+
Globals.Logs.Add($"Application {e.Application} changed: {e.ChangedType}", false);
162+
CurrentApplication = e.Application;
163+
UpdateCurrentProfile(e.Application, e.ChangedType);
164+
if (e.ChangedType == ApplicationChangedType.Closed)
165+
CurrentApplication = null;
166+
}
167+
catch (Exception ex)
168+
{
169+
Globals.Logs.AddException(ex);
170+
}
156171
}
157172

158173
private void ApplicationWatcher_NewLog(object sender, string e)
@@ -336,13 +351,9 @@ private void LoadSettings()
336351

337352
Settings.PropertyChanged += Settings_PropertyChanged;
338353

339-
ApplicationProfileAssigments_CollectionChanged(
340-
Settings.ApplicationProfileAssignments, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfileAssignments.ToList()));
341-
354+
ApplicationProfileAssigments_CollectionChanged(Settings.ApplicationProfileAssignments, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfileAssignments.ToList()));
342355
ApplicationProfiles_CollectionChanged(Settings.ApplicationProfiles, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ApplicationProfiles.ToList()));
343-
344-
345-
356+
ActionShortcuts_CollectionChanged(Settings.ActionShortcuts, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.ActionShortcuts.ToList()));
346357
Monitors_CollectionChanged(Settings.Displays, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, Settings.Displays.ToList()));
347358

348359

Source/AutoHDR/ProfileActionShortcut.cs

+1-5
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ public ActionShortcutManager()
6363

6464
}
6565

66-
private void ActionShortcuts_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
67-
{
68-
throw new NotImplementedException();
69-
}
70-
66+
7167
private void AddActionShortcut()
7268
{
7369
ProfileActionAdder adder = new ProfileActionAdder();

Source/AutoHDR/Profiles/Actions/DisplayAction.cs

+1-19
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,6 @@ public Size Resolution
7979
{
8080
get
8181
{
82-
try
83-
{
84-
if (Display.IsAllDisplay())
85-
return AllDisplays[1].Resolution;
86-
}
87-
catch { }
8882
return _resolution;
8983
}
9084
set { _resolution = value; OnPropertyChanged(); }
@@ -97,12 +91,6 @@ public int RefreshRate
9791
{
9892
get
9993
{
100-
try
101-
{
102-
if (Display.IsAllDisplay())
103-
return AllDisplays[1].RefreshRate;
104-
}
105-
catch { }
10694
return _refreshRate;
10795
}
10896
set { _refreshRate = value; OnPropertyChanged(); } }
@@ -113,13 +101,7 @@ public int RefreshRate
113101
public ColorDepth ColorDepth
114102
{
115103
get
116-
{
117-
try
118-
{
119-
if (Display.IsAllDisplay())
120-
return AllDisplays[1].ColorDepth;
121-
}
122-
catch { }
104+
{
123105
return _colorDepth;
124106
}
125107
set { _colorDepth = value; OnPropertyChanged(); } }

Source/AutoHDR/Properties/AssemblyInfo.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,5 @@
5252
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
5353
// indem Sie "*" wie unten gezeigt eingeben:
5454
// [assembly: AssemblyVersion("1.0.*")]
55-
[assembly: AssemblyVersion("1.9.2.0")]
56-
[assembly: AssemblyFileVersion("1.9.2.0")]
55+
[assembly: AssemblyVersion("1.9.4.0")]
56+
[assembly: AssemblyFileVersion("1.9.4.0")]

Source/AutoHDR/UserAppSettings.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class UserAppSettings : BaseViewModel
2727
private bool _checkForNewVersion = true;
2828
readonly object _audioDevicesLock = new object();
2929
private Guid _defaultProfileGuid = Guid.Empty;
30-
private Size _windowSize = new Size(1280, 800);
30+
private Size _windowSize = new Size(1280, 800);
3131

3232

3333
private SortableObservableCollection<ApplicationProfileAssignment> _applicationProfileAssignments;
@@ -94,7 +94,7 @@ public static UserAppSettings ReadSettings(string path)
9494
{
9595

9696
try
97-
{
97+
{
9898
string serializedJson = File.ReadAllText(path);
9999
serializedJson = UpgradeJson(serializedJson);
100100
settings = (UserAppSettings)JsonConvert.DeserializeObject<UserAppSettings>(serializedJson, new JsonSerializerSettings

0 commit comments

Comments
 (0)