2022-07-23 19:23:32 +00:00
|
|
|
|
using MSFSPopoutPanelManager.UserDataAgent;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace MSFSPopoutPanelManager.WpfApp.ViewModel
|
|
|
|
|
{
|
|
|
|
|
internal class DialogHelper
|
|
|
|
|
{
|
|
|
|
|
public static bool ConfirmDialog(string title, string message)
|
|
|
|
|
{
|
2022-08-08 06:07:24 +00:00
|
|
|
|
var dialog = new ConfirmationDialog(title, message);
|
2022-07-23 19:23:32 +00:00
|
|
|
|
dialog.Owner = Application.Current.MainWindow;
|
|
|
|
|
dialog.Topmost = true;
|
|
|
|
|
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
|
|
|
|
|
return (bool)dialog.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-06 04:07:03 +00:00
|
|
|
|
public static bool ConfirmDialog(string title, string message, Window owner)
|
|
|
|
|
{
|
|
|
|
|
var dialog = new ConfirmationDialog(title, message);
|
|
|
|
|
dialog.Owner = owner;
|
|
|
|
|
dialog.Topmost = true;
|
|
|
|
|
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
|
|
|
|
|
return (bool)dialog.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-23 19:23:32 +00:00
|
|
|
|
public static AddProfileDialogResult AddProfileDialog(List<Profile> profiles)
|
|
|
|
|
{
|
2022-08-08 06:07:24 +00:00
|
|
|
|
var dialog = new AddProfileDialog(profiles);
|
2022-07-23 19:23:32 +00:00
|
|
|
|
dialog.Owner = Application.Current.MainWindow;
|
|
|
|
|
dialog.Topmost = true;
|
|
|
|
|
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
|
|
|
|
|
if ((bool)dialog.ShowDialog())
|
|
|
|
|
{
|
|
|
|
|
return new AddProfileDialogResult(dialog.ProfileName, dialog.SelectedCopyProfileId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PreferencesDialog(PreferencesViewModel preferencesViewModel)
|
|
|
|
|
{
|
2022-08-08 06:07:24 +00:00
|
|
|
|
var dialog = new PreferencesDialog(preferencesViewModel);
|
|
|
|
|
dialog.Owner = Application.Current.MainWindow;
|
|
|
|
|
dialog.Topmost = true;
|
|
|
|
|
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
dialog.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void PanelConfigurationInstructionDialog()
|
|
|
|
|
{
|
|
|
|
|
var dialog = new PanelConfigurationInstructionDialog();
|
2022-07-23 19:23:32 +00:00
|
|
|
|
dialog.Owner = Application.Current.MainWindow;
|
|
|
|
|
dialog.Topmost = true;
|
|
|
|
|
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
|
|
|
|
dialog.ShowDialog();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
internal class AddProfileDialogResult
|
|
|
|
|
{
|
|
|
|
|
public AddProfileDialogResult(string profileName, int copyPofileId)
|
|
|
|
|
{
|
|
|
|
|
ProfileName = profileName;
|
|
|
|
|
CopyProfileId = copyPofileId;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string ProfileName { get; set; }
|
|
|
|
|
|
|
|
|
|
public int CopyProfileId { get; set; }
|
|
|
|
|
}
|
|
|
|
|
}
|