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)
|
|
|
|
|
{
|
2024-03-01 11:28:09 +00:00
|
|
|
|
var arg = e as PropertyChangedExtendedEventArgs;
|
|
|
|
|
|
2024-03-05 03:01:13 +00:00
|
|
|
|
switch (arg?.PropertyName)
|
2023-07-12 22:41:31 +00:00
|
|
|
|
{
|
2024-03-05 03:01:13 +00:00
|
|
|
|
case nameof(FullScreen) when FullScreen:
|
|
|
|
|
AlwaysOnTop = false;
|
|
|
|
|
HideTitlebar = false;
|
|
|
|
|
break;
|
|
|
|
|
case nameof(TouchEnabled) when TouchEnabled:
|
|
|
|
|
AutoGameRefocus = true;
|
|
|
|
|
break;
|
2024-02-29 06:11:56 +00:00
|
|
|
|
}
|
2023-07-12 22:41:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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-29 06:11:56 +00:00
|
|
|
|
public FloatingPanel FloatingPanel { get; set; } = new();
|
|
|
|
|
|
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
|
|
|
|
|
2024-02-29 06:11:56 +00:00
|
|
|
|
[JsonIgnore] public bool IsFloating { get; set; } = true;
|
|
|
|
|
|
2024-02-28 02:44:21 +00:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool IsDeletablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
|
2024-09-17 14:42:07 +00:00
|
|
|
|
PanelType != PanelType.NumPadWindow && PanelType != PanelType.SwitchWindow;
|
2024-02-28 02:44:21 +00:00
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool IsTouchEnablePanel => PanelType != PanelType.HudBarWindow && PanelType != PanelType.RefocusDisplay &&
|
2024-09-17 14:42:07 +00:00
|
|
|
|
PanelType != PanelType.NumPadWindow && PanelType != PanelType.SwitchWindow;
|
2024-02-28 02:44:21 +00:00
|
|
|
|
|
|
|
|
|
[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;
|
|
|
|
|
|
2024-09-17 14:42:07 +00:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool IsSwitchWindow => PanelType == PanelType.SwitchWindow;
|
|
|
|
|
|
2024-02-28 02:44:21 +00:00
|
|
|
|
[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
|
|
|
|
}
|
|
|
|
|
}
|