1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-29 01:00:13 +00:00
msfs-popout-panel-manager/MainApp/ViewModel/HelpViewModel.cs

79 lines
2.6 KiB
C#
Raw Normal View History

2023-07-12 22:41:31 +00:00
using MaterialDesignThemes.Wpf;
2024-02-28 02:44:21 +00:00
using MSFSPopoutPanelManager.MainApp.AppUserControl.Dialog;
2023-07-12 22:41:31 +00:00
using MSFSPopoutPanelManager.Orchestration;
using MSFSPopoutPanelManager.WindowsAgent;
using Prism.Commands;
using System;
using System.Windows.Input;
namespace MSFSPopoutPanelManager.MainApp.ViewModel
{
public class HelpViewModel : BaseViewModel
{
2024-02-28 02:44:21 +00:00
private readonly HelpOrchestrator _helpOrchestrator;
2023-07-12 22:41:31 +00:00
public DelegateCommand<string> HyperLinkCommand { get; private set; }
public ICommand DeleteAppCacheCommand { get; private set; }
public string ApplicationVersion { get; private set; }
public bool IsRollBackCommandVisible { get; private set; }
public bool HasOrphanAppCache { get; private set; }
2024-02-28 02:44:21 +00:00
public HelpViewModel(SharedStorage sharedStorage, HelpOrchestrator helpOrchestrator) : base(sharedStorage)
2023-07-12 22:41:31 +00:00
{
2024-02-28 02:44:21 +00:00
_helpOrchestrator = helpOrchestrator;
2023-07-12 22:41:31 +00:00
HyperLinkCommand = new DelegateCommand<string>(OnHyperLinkActivated);
DeleteAppCacheCommand = new DelegateCommand(OnDeleteAppCache);
2023-07-30 21:30:47 +00:00
#if DEBUG
2024-02-28 02:44:21 +00:00
var buildConfig = " (Debug)";
2023-07-30 21:30:47 +00:00
#elif LOCAL
2024-02-28 02:44:21 +00:00
var buildConfig = " (Local)";
#else
var buildConfig = string.Empty;
2023-07-30 21:30:47 +00:00
#endif
ApplicationVersion = $"{WindowProcessManager.GetApplicationVersion()}{buildConfig}";
2024-02-28 02:44:21 +00:00
HasOrphanAppCache = _helpOrchestrator.HasOrphanAppCache();
2023-07-12 22:41:31 +00:00
}
private void OnHyperLinkActivated(string commandParameter)
{
switch (commandParameter)
{
case "Getting Started":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenGettingStarted();
2023-07-12 22:41:31 +00:00
break;
case "User Guide":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenUserGuide();
2023-07-12 22:41:31 +00:00
break;
case "Download Latest GitHub":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenLatestDownloadGitHub();
2023-07-12 22:41:31 +00:00
break;
case "Download Latest FlightsimTo":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenLatestDownloadFligthsimTo();
2023-07-12 22:41:31 +00:00
break;
case "License":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenLicense();
2023-07-12 22:41:31 +00:00
break;
case "Version Info":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.OpenVersionInfo();
2023-07-12 22:41:31 +00:00
break;
case "Download VCC Library":
2024-02-28 02:44:21 +00:00
_helpOrchestrator.DownloadVccLibrary();
2023-07-12 22:41:31 +00:00
break;
}
}
private void OnDeleteAppCache()
{
2024-02-28 02:44:21 +00:00
_helpOrchestrator.DeleteAppCache();
HasOrphanAppCache = _helpOrchestrator.HasOrphanAppCache();
2023-07-12 22:41:31 +00:00
}
}
}