2024-03-03 05:02:21 +00:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using MSFSPopoutPanelManager.Shared;
|
|
|
|
|
using Newtonsoft.Json;
|
2023-08-14 19:51:28 +00:00
|
|
|
|
|
|
|
|
|
namespace MSFSPopoutPanelManager.DomainModel.Setting
|
|
|
|
|
{
|
|
|
|
|
public class KeyboardShortcutSetting : ObservableObject
|
|
|
|
|
{
|
2024-03-03 05:02:21 +00:00
|
|
|
|
private string _startPopOutKeyBindingLegacyConversion;
|
|
|
|
|
|
2024-02-28 02:44:21 +00:00
|
|
|
|
public bool IsEnabled { get; set; } = true;
|
2023-08-14 19:51:28 +00:00
|
|
|
|
|
2024-03-03 05:02:21 +00:00
|
|
|
|
public string StartPopOutKeyBinding
|
|
|
|
|
{
|
|
|
|
|
get => _startPopOutKeyBindingLegacyConversion;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
// Convert legacy start pop out keyboard binding to new keyboard bindings (v4.0.3 and earlier)
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(value))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
var keys = new List<string>() { "LeftCtrl", "LeftShift", value.ToUpper() };
|
|
|
|
|
keys = keys.OrderBy(x => x).ToList();
|
|
|
|
|
PopOutKeyboardBinding = string.Join("|", keys);
|
|
|
|
|
|
|
|
|
|
_startPopOutKeyBindingLegacyConversion = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string PopOutKeyboardBinding { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool IsDetectingKeystroke { get; set; }
|
2023-08-14 19:51:28 +00:00
|
|
|
|
}
|
|
|
|
|
}
|