diff --git a/MainApp/AppUserControl/PopOutPanelSourceCard.xaml.cs b/MainApp/AppUserControl/PopOutPanelSourceCard.xaml.cs index 6530706..dc120f2 100644 --- a/MainApp/AppUserControl/PopOutPanelSourceCard.xaml.cs +++ b/MainApp/AppUserControl/PopOutPanelSourceCard.xaml.cs @@ -76,7 +76,6 @@ namespace MSFSPopoutPanelManager.MainApp.AppUserControl foreach (var panelConfig in _viewModel.ActiveProfile.PanelConfigs) panelConfig.IsSelectedPanelSource = false; - _viewModel.DataItem.IsSelectedPanelSource = true; _viewModel.EditPanelSourceCommand.Execute(); } } diff --git a/MainApp/ViewModel/PopOutPanelSourceCardViewModel.cs b/MainApp/ViewModel/PopOutPanelSourceCardViewModel.cs index 405fa14..a7fb8e0 100644 --- a/MainApp/ViewModel/PopOutPanelSourceCardViewModel.cs +++ b/MainApp/ViewModel/PopOutPanelSourceCardViewModel.cs @@ -3,6 +3,7 @@ using MSFSPopoutPanelManager.Orchestration; using MSFSPopoutPanelManager.Shared; using Prism.Commands; using System; +using System.Threading; using System.Windows.Input; namespace MSFSPopoutPanelManager.MainApp.ViewModel @@ -47,10 +48,12 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel private void OnAddPanelSourceLocation() { - DataItem.IsEditingPanel = true; + _panelSourceOrchestrator.ShowPanelSourceForEdit(DataItem); // This is to reset active panel source FixedCameraConfigs.Clear(); FixedCameraConfigs.AddRange(_panelSourceOrchestrator.GetFixedCameraConfigs()); + + DataItem.IsEditingPanel = true; _panelSourceOrchestrator.StartPanelSelectionEvent(); @@ -64,11 +67,14 @@ namespace MSFSPopoutPanelManager.MainApp.ViewModel private void OnEditPanelSource() { + if (!DataItem.HasPanelSource) + return; + FixedCameraConfigs.Clear(); FixedCameraConfigs.AddRange(_panelSourceOrchestrator.GetFixedCameraConfigs()); + DataItem.IsSelectedPanelSource = true; _panelSourceOrchestrator.ShowPanelSourceForEdit(DataItem); } } - }