mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-22 05:40:11 +00:00
43 lines
1.5 KiB
C#
43 lines
1.5 KiB
C#
using MSFSPopoutPanelManager.DomainModel.Setting;
|
|
using MSFSPopoutPanelManager.Shared;
|
|
using System;
|
|
using System.Collections.Specialized;
|
|
|
|
namespace MSFSPopoutPanelManager.Orchestration
|
|
{
|
|
public class AppSettingData : ObservableObject
|
|
{
|
|
public event EventHandler<bool> OnAlwaysOnTopChanged;
|
|
public event EventHandler<bool> OnEnablePanelResetWhenLockedChanged;
|
|
|
|
public ApplicationSetting ApplicationSetting { get; private set; }
|
|
|
|
public void ReadSettings()
|
|
{
|
|
ApplicationSetting = AppSettingDataManager.ReadAppSetting();
|
|
|
|
if (ApplicationSetting == null)
|
|
{
|
|
ApplicationSetting = new ApplicationSetting();
|
|
AppSettingDataManager.WriteAppSetting(ApplicationSetting);
|
|
}
|
|
|
|
// Auto Save data
|
|
ApplicationSetting.PropertyChanged += (_, e) =>
|
|
{
|
|
AppSettingDataManager.WriteAppSetting(ApplicationSetting);
|
|
|
|
switch (e.PropertyName)
|
|
{
|
|
case "AlwaysOnTop":
|
|
OnAlwaysOnTopChanged?.Invoke(this, ApplicationSetting.GeneralSetting.AlwaysOnTop);
|
|
break;
|
|
case "EnablePanelResetWhenLocked":
|
|
OnEnablePanelResetWhenLockedChanged?.Invoke(this,
|
|
ApplicationSetting.PopOutSetting.EnablePanelResetWhenLocked);
|
|
break;
|
|
}
|
|
};
|
|
}
|
|
}
|
|
}
|