mirror of
https://github.com/hawkeye-stan/msfs-popout-panel-manager.git
synced 2024-11-22 13:50:14 +00:00
38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
|
using System;
|
|||
|
using System.Linq;
|
|||
|
using MSFSPopoutPanelManager.DomainModel.Profile;
|
|||
|
using MSFSPopoutPanelManager.Orchestration;
|
|||
|
using MSFSPopoutPanelManager.WindowsAgent;
|
|||
|
using Prism.Commands;
|
|||
|
|
|||
|
namespace MSFSPopoutPanelManager.MainApp.ViewModel
|
|||
|
{
|
|||
|
public class SwitchWindowViewModel : BaseViewModel
|
|||
|
{
|
|||
|
public DelegateCommand<string> ButtonCommand { get; private set; }
|
|||
|
|
|||
|
public Guid PanelId { get; set; }
|
|||
|
|
|||
|
public PanelConfig PanelConfig => ActiveProfile.PanelConfigs.FirstOrDefault(p => p.Id == PanelId);
|
|||
|
|
|||
|
|
|||
|
public SwitchWindowViewModel(SharedStorage sharedStorage) : base(sharedStorage)
|
|||
|
{
|
|||
|
ButtonCommand = new DelegateCommand<string>(OnButtonActivated);
|
|||
|
}
|
|||
|
|
|||
|
private void OnButtonActivated(string commandParameter)
|
|||
|
{
|
|||
|
switch (commandParameter)
|
|||
|
{
|
|||
|
case "VerticalPanel":
|
|||
|
PInvoke.SwitchToThisWindow(PInvoke.GetWindowHandle("737 Instruments Vertical"), true);
|
|||
|
break;
|
|||
|
case "OverheadPanel":
|
|||
|
PInvoke.SwitchToThisWindow(PInvoke.GetWindowHandle("737 Instruments Overhead"), true);
|
|||
|
break;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|