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/DomainModel/Profile/PanelConfig.cs

125 lines
3.5 KiB
C#
Raw Normal View History

2023-07-12 22:41:31 +00:00
using MSFSPopoutPanelManager.Shared;
using Newtonsoft.Json;
using System;
namespace MSFSPopoutPanelManager.DomainModel.Profile
{
public class PanelConfig : ObservableObject
{
public PanelConfig()
{
if (Id == Guid.Empty)
Id = Guid.NewGuid();
InitializeChildPropertyChangeBinding();
PropertyChanged += PanelConfig_PropertyChanged;
}
private void PanelConfig_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
if (e.PropertyName == "FullScreen" && FullScreen)
{
AlwaysOnTop = false;
HideTitlebar = false;
}
else if (e.PropertyName == "TouchEnabled" && TouchEnabled)
{
AutoGameRefocus = true;
}
}
public Guid Id { get; set; }
public PanelType PanelType { get; set; }
2024-02-28 02:44:21 +00:00
public string PanelName { get; set; } = "Default Panel Name";
2023-07-12 22:41:31 +00:00
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; }
2024-02-28 02:44:21 +00:00
public bool AutoGameRefocus { get; set; } = true;
2023-07-12 22:41:31 +00:00
2024-02-28 02:44:21 +00:00
public PanelSource PanelSource { get; set; } = new();
2023-07-12 22:41:31 +00:00
2024-02-28 02:44:21 +00:00
public FixedCameraConfig FixedCameraConfig { get; set; } = new();
2023-07-12 22:41:31 +00:00
[JsonIgnore]
2024-02-28 02:44:21 +00:00
public IntPtr PanelHandle { get; set; } = IntPtr.MaxValue;
2023-07-12 22:41:31 +00:00
[JsonIgnore]
2024-02-28 02:44:21 +00:00
public bool IsEditingPanel { get; set; }
2023-07-12 22:41:31 +00:00
[JsonIgnore]
public bool HasPanelSource => PanelType == PanelType.BuiltInPopout || (PanelType == PanelType.CustomPopout && PanelSource != null && PanelSource.X != null);
[JsonIgnore]
public bool? IsPopOutSuccess
{
get
{
if (PanelHandle == IntPtr.MaxValue)
return null;
2024-02-28 02:44:21 +00:00
return PanelHandle != IntPtr.Zero;
2023-07-12 22:41:31 +00:00
}
}
[JsonIgnore]
public bool IsSelectedPanelSource { get; set; }
[JsonIgnore]
public bool IsShownPanelSource { get; set; }
2024-02-28 02:44:21 +00:00
[JsonIgnore]
public bool IsDeletablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
PanelType != PanelType.NumPadWindow;
[JsonIgnore]
public bool IsTouchEnablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
PanelType != PanelType.NumPadWindow;
[JsonIgnore]
public bool IsCustomPopOut => PanelType == PanelType.CustomPopout;
[JsonIgnore]
public bool IsBuiltInPopOut => PanelType == PanelType.BuiltInPopout;
[JsonIgnore]
public bool IsHudBarWindow => PanelType == PanelType.HudBarWindow;
[JsonIgnore]
public bool IsRefocusDisplay => PanelType == PanelType.RefocusDisplay;
[JsonIgnore]
public bool IsNumPadWindow => PanelType == PanelType.NumPadWindow;
[JsonIgnore]
public string PanelSourceCoordinateText
{
get
{
if (PanelSource == null || PanelSource.X == null || PanelSource.Y == null)
return "top: N/A, left: N/A";
return $"Left: {PanelSource.X} / Top: {PanelSource.Y}";
}
}
2023-07-12 22:41:31 +00:00
}
}