Skip to content

Commit

Permalink
1.9.4
Browse files Browse the repository at this point in the history
[Bug fixes]
- Action shortcuts display selection not being saved after restart #89
  • Loading branch information
Codectory committed Jan 8, 2022
1 parent 47f7ac9 commit 2eece06
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 62 deletions.
2 changes: 0 additions & 2 deletions Source/AutoHDR.Displays/Display.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
75 changes: 43 additions & 32 deletions Source/AutoHDR/AutoHDRDaemon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IProfileAction>();
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<IProfileAction>();
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;
}
}
}

Expand All @@ -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)
Expand Down Expand Up @@ -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()));


Expand Down
6 changes: 1 addition & 5 deletions Source/AutoHDR/ProfileActionShortcut.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
20 changes: 1 addition & 19 deletions Source/AutoHDR/Profiles/Actions/DisplayAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ public Size Resolution
{
get
{
try
{
if (Display.IsAllDisplay())
return AllDisplays[1].Resolution;
}
catch { }
return _resolution;
}
set { _resolution = value; OnPropertyChanged(); }
Expand All @@ -97,12 +91,6 @@ public int RefreshRate
{
get
{
try
{
if (Display.IsAllDisplay())
return AllDisplays[1].RefreshRate;
}
catch { }
return _refreshRate;
}
set { _refreshRate = value; OnPropertyChanged(); } }
Expand All @@ -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(); } }
Expand Down
4 changes: 2 additions & 2 deletions Source/AutoHDR/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
4 changes: 2 additions & 2 deletions Source/AutoHDR/UserAppSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<ApplicationProfileAssignment> _applicationProfileAssignments;
Expand Down Expand Up @@ -94,7 +94,7 @@ public static UserAppSettings ReadSettings(string path)
{

try
{
{
string serializedJson = File.ReadAllText(path);
serializedJson = UpgradeJson(serializedJson);
settings = (UserAppSettings)JsonConvert.DeserializeObject<UserAppSettings>(serializedJson, new JsonSerializerSettings
Expand Down

0 comments on commit 2eece06

Please sign in to comment.