1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-22 13:50:14 +00:00
msfs-popout-panel-manager/WpfApp/UserControlPanelSelection.xaml.cs

119 lines
4.9 KiB
C#
Raw Normal View History

2022-01-27 13:40:04 +00:00
using MSFSPopoutPanelManager.WpfApp.ViewModel;
using System.Windows;
using System.Windows.Controls;
namespace MSFSPopoutPanelManager.WpfApp
{
public partial class UserControlPanelSelection : UserControl
{
private PanelSelectionViewModel _panelSelectionViewModel;
public UserControlPanelSelection(PanelSelectionViewModel panelSelectionViewModel)
{
InitializeComponent();
_panelSelectionViewModel = panelSelectionViewModel;
this.DataContext = panelSelectionViewModel;
}
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
2022-04-18 16:24:00 +00:00
cmbProfile.SelectionChanged -= Profile_Changed;
2022-01-27 13:40:04 +00:00
_panelSelectionViewModel.Initialize();
2022-04-18 16:24:00 +00:00
cmbProfile.SelectionChanged += Profile_Changed;
2022-01-27 13:40:04 +00:00
}
private void AddProfile_Click(object sender, RoutedEventArgs e)
{
AddProfileDialog dialog = new AddProfileDialog(_panelSelectionViewModel.DataStore.UserProfiles);
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.AddProfileCommand.Execute(new AddProfileCommandParameter() { ProfileName = dialog.ProfileName, CopyProfileId = dialog.SelectedCopyProfileId });
}
}
private void DeleteProfile_Click(object sender, RoutedEventArgs e)
{
ConfirmationDialog dialog = new ConfirmationDialog("Confirm Delete", "Are you sure you want to delete the selected profile?");
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.DeleteProfileCommand.Execute(null);
}
}
2022-04-18 16:24:00 +00:00
private void Profile_Changed(object sender, RoutedEventArgs e)
{
_panelSelectionViewModel.ChangeProfileCommand.Execute(null);
}
2022-01-27 13:40:04 +00:00
private void StartPanelSelection_Click(object sender, RoutedEventArgs e)
{
if (_panelSelectionViewModel.DataStore.ActiveUserProfile.PanelSourceCoordinates.Count > 0)
{
ConfirmationDialog dialog = new ConfirmationDialog("Confirm Overwrite", "WARNING! Are you sure you want to overwrite existing saved panel locations and all saved setttings for this profile?");
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.StartPanelSelectionCommand.Execute(null);
}
}
else
{
_panelSelectionViewModel.StartPanelSelectionCommand.Execute(null);
}
}
private void SaveAutoPanningCamera_Click(object sender, RoutedEventArgs e)
{
if (_panelSelectionViewModel.DataStore.ActiveUserProfile.PanelSourceCoordinates.Count > 0)
{
ConfirmationDialog dialog = new ConfirmationDialog("Confirm Overwrite Auto Panning Camera", "WARNING! Are you sure you want to overwrite existing Auto Panning camera angle?");
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.SaveAutoPanningCameraCommand.Execute(null);
}
}
}
2022-07-06 18:09:10 +00:00
private void StartPopOut_Click(object sender, RoutedEventArgs e)
{
if (_panelSelectionViewModel.DataStore.ActiveUserProfile.PanelSourceCoordinates.Count > 0)
{
_panelSelectionViewModel.StartPopOutCommand.Execute(null);
}
}
2022-01-27 13:40:04 +00:00
private void AddBinding_Click(object sender, RoutedEventArgs e)
{
2022-04-18 19:52:39 +00:00
_panelSelectionViewModel.AddProfileBindingCommand.Execute(null);
2022-01-27 13:40:04 +00:00
}
private void DeleteBinding_Click(object sender, RoutedEventArgs e)
{
2022-04-18 03:38:33 +00:00
ConfirmationDialog dialog = new ConfirmationDialog("Confirm Delete Binding", $"Are you sure you want to delete aircraft livery binding below from the active profile? \n{_panelSelectionViewModel.DataStore.CurrentMsfsPlaneTitle}");
2022-01-27 13:40:04 +00:00
dialog.Owner = Application.Current.MainWindow;
dialog.Topmost = true;
dialog.WindowStartupLocation = WindowStartupLocation.CenterOwner;
if ((bool)dialog.ShowDialog())
{
_panelSelectionViewModel.DeleteProfileBindingCommand.Execute(null);
}
}
}
}