1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 05:40:11 +00:00
msfs-popout-panel-manager/UserDataAgent/Profile.cs

216 lines
5.5 KiB
C#
Raw Normal View History

2022-07-23 19:23:32 +00:00
using MSFSPopoutPanelManager.Shared;
using Newtonsoft.Json;
using System;
using System.Collections.ObjectModel;
namespace MSFSPopoutPanelManager.UserDataAgent
{
public class Profile : ObservableObject
{
public Profile()
{
2022-08-01 23:21:42 +00:00
BindingAircrafts = new ObservableCollection<string>();
2022-07-23 19:23:32 +00:00
PanelConfigs = new ObservableCollection<PanelConfig>();
PanelSourceCoordinates = new ObservableCollection<PanelSourceCoordinate>();
TouchPanelBindings = new ObservableCollection<TouchPanelBinding>();
IsLocked = false;
PowerOnRequiredForColdStart = false;
IncludeInGamePanels = false;
2022-09-25 14:49:49 +00:00
RealSimGearGTN750Gen1Override = false;
MsfsGameWindowConfig = new MsfsGameWindowConfig();
2022-08-05 03:43:51 +00:00
// Legacy data
BindingAircraftLiveries = new ObservableCollection<string>();
2022-07-23 19:23:32 +00:00
}
public int ProfileId { get; set; }
public string ProfileName { get; set; }
[JsonConverter(typeof(SingleValueArrayConvertor<string>))]
2022-08-01 23:21:42 +00:00
public ObservableCollection<string> BindingAircrafts { get; set; }
2022-07-23 19:23:32 +00:00
public ObservableCollection<PanelSourceCoordinate> PanelSourceCoordinates { get; set; }
public ObservableCollection<PanelConfig> PanelConfigs { get; set; }
public ObservableCollection<TouchPanelBinding> TouchPanelBindings { get; set; }
2022-08-05 03:43:51 +00:00
// Legacy data
[JsonConverter(typeof(SingleValueArrayConvertor<string>))]
public ObservableCollection<string> BindingAircraftLiveries { get; set; }
2022-07-23 19:23:32 +00:00
public bool IsLocked { get; set; }
public bool PowerOnRequiredForColdStart { get; set; }
public bool IncludeInGamePanels { get; set; }
2022-09-25 14:49:49 +00:00
public bool RealSimGearGTN750Gen1Override { get; set; }
public MsfsGameWindowConfig MsfsGameWindowConfig { get; set; }
2022-07-23 19:23:32 +00:00
[JsonIgnore]
public bool IsActive { get; set; }
[JsonIgnore]
2022-08-01 23:21:42 +00:00
public bool HasBindingAircrafts
2022-07-23 19:23:32 +00:00
{
get
{
2022-08-01 23:21:42 +00:00
if (BindingAircrafts == null)
2022-07-23 19:23:32 +00:00
return false;
2022-08-01 23:21:42 +00:00
return BindingAircrafts.Count > 0;
2022-07-23 19:23:32 +00:00
}
}
public void Reset()
{
PanelSourceCoordinates.Clear();
PanelConfigs.Clear();
IsLocked = false;
}
}
public class PanelSourceCoordinate : ObservableObject
{
public int PanelIndex { get; set; }
public int X { get; set; }
public int Y { get; set; }
[JsonIgnore]
public IntPtr PanelHandle { get; set; }
}
public class PanelConfig : ObservableObject
{
public int PanelIndex { get; set; }
public string PanelName { get; set; }
public PanelType PanelType { get; set; }
public int Top { get; set; }
public int Left { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public bool AlwaysOnTop { get; set; }
public bool HideTitlebar { get; set; }
public bool FullScreen { get; set; }
public bool TouchEnabled { get; set; }
2022-07-30 02:29:20 +00:00
public bool DisableGameRefocus { get; set; }
2022-09-11 13:50:04 +00:00
[JsonIgnore]
public bool IsFound { get { return PanelHandle != IntPtr.Zero; } }
2022-07-23 19:23:32 +00:00
[JsonIgnore]
public bool IsCustomPopOut { get { return PanelType == PanelType.CustomPopout; } }
[JsonIgnore]
public bool IsBuiltInPopOut { get { return PanelType == PanelType.BuiltInPopout; } }
2022-07-23 19:23:32 +00:00
[JsonIgnore]
public IntPtr PanelHandle { get; set; }
[JsonIgnore]
public bool IsLockable
{
get
{
switch (PanelType)
{
case PanelType.CustomPopout:
case PanelType.BuiltInPopout:
case PanelType.MSFSTouchPanel:
return true;
default:
return false;
}
}
}
[JsonIgnore]
public bool HasTouchableEvent
{
get
{
switch (PanelType)
{
case PanelType.CustomPopout:
case PanelType.BuiltInPopout:
return true;
default:
return false;
}
}
}
2022-09-11 13:50:04 +00:00
[JsonIgnore]
public int FullScreenTop { get; set; }
[JsonIgnore]
public int FullScreenLeft { get; set; }
[JsonIgnore]
public int FullScreenWidth { get; set; }
[JsonIgnore]
public int FullScreenHeight { get; set; }
2022-07-23 19:23:32 +00:00
}
public class TouchPanelBinding : ObservableObject
{
public string PlaneId { get; set; }
public string PanelId { get; set; }
}
public class MsfsGameWindowConfig : ObservableObject
{
public MsfsGameWindowConfig()
{
Top = 0;
Left = 0;
Width = 0;
Height = 0;
}
public MsfsGameWindowConfig(int left, int top, int width, int height)
{
Top = top;
Left = left;
Width = width;
Height = height;
}
public int Top { get; set; }
public int Left { get; set; }
public int Width { get; set; }
public int Height { get; set; }
[JsonIgnore]
public bool IsValid
{
get
{
return Width != 0 && Height != 0;
}
}
}
2022-07-23 19:23:32 +00:00
}