1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-28 16:50:11 +00:00
msfs-popout-panel-manager/MainApp/ViewModel/BaseViewModel.cs

66 lines
2.4 KiB
C#
Raw Normal View History

2023-07-12 22:41:31 +00:00
using MSFSPopoutPanelManager.Orchestration;
using MSFSPopoutPanelManager.Shared;
using System;
using System.Collections.Generic;
using System.Windows.Documents;
using System.Windows.Media;
namespace MSFSPopoutPanelManager.MainApp.ViewModel
{
public abstract class BaseViewModel : ObservableObject
{
protected const string ROOT_DIALOG_HOST = "RootDialog";
protected MainOrchestrator Orchestrator { get; set; }
public BaseViewModel(MainOrchestrator orchestrator)
{
Orchestrator = orchestrator;
Orchestrator.PanelPopOut.OnPopOutStarted += (sender, e) => Orchestrator.PanelPopOut.IsDisabledStartPopOut = true;
Orchestrator.PanelPopOut.OnPopOutCompleted += (sender, e) => Orchestrator.PanelPopOut.IsDisabledStartPopOut = false;
Orchestrator.PanelSource.OnPanelSourceSelectionStarted += (sender, e) => Orchestrator.PanelPopOut.IsDisabledStartPopOut = true;
Orchestrator.PanelSource.OnPanelSourceSelectionCompleted += (sender, e) => Orchestrator.PanelPopOut.IsDisabledStartPopOut = false;
2023-07-12 22:41:31 +00:00
}
public AppSettingData AppSettingData => Orchestrator.AppSettingData;
public ProfileData ProfileData => Orchestrator.ProfileData;
public FlightSimData FlightSimData => Orchestrator.FlightSimData;
protected List<Run> FormatStatusMessages(List<StatusMessage> messages)
{
List<Run> runs = new List<Run>();
foreach (var statusMessage in messages)
{
var run = new Run();
run.Text = statusMessage.Message;
switch (statusMessage.StatusMessageType)
{
case StatusMessageType.Success:
run.Foreground = new SolidColorBrush(Colors.LimeGreen);
break;
case StatusMessageType.Failure:
run.Foreground = new SolidColorBrush(Colors.IndianRed);
break;
2023-08-16 03:41:14 +00:00
case StatusMessageType.Executing:
2023-09-29 06:15:02 +00:00
run.Foreground = new SolidColorBrush(Colors.NavajoWhite);
2023-08-16 03:41:14 +00:00
break;
2023-07-12 22:41:31 +00:00
case StatusMessageType.Info:
break;
}
runs.Add(run);
if (statusMessage.NewLine)
runs.Add(new Run { Text = Environment.NewLine });
}
return runs;
}
}
}