Skip to content

Commit

Permalink
Merge pull request #57 from VirtualPhotonics/feature/56-the-map-view-…
Browse files Browse the repository at this point in the history
…is-not-switching-back-to-the-plot-view-when-clicking-the-spectral-panel

feature 56 - the map view is not switching back to the plot view when clicking the spectral panel
  • Loading branch information
Lisa Glover authored Jun 13, 2024
2 parents 925313b + 287594e commit ba8be75
Showing 1 changed file with 29 additions and 31 deletions.
60 changes: 29 additions & 31 deletions Vts.Gui.Wpf/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,11 @@ namespace Vts.Gui.Wpf
public partial class MainWindow
{
private int _numViews;
private readonly ILogger _logger;

public MainWindow()
{
_logger = LoggerFactoryLocator.GetDefaultNLogFactory().Create(typeof(MainWindow));
_logger.Info("Starting application");
var logger = LoggerFactoryLocator.GetDefaultNLogFactory().Create(typeof(MainWindow));
logger.Info("Starting application");
var observableTarget =
NLog.LogManager.Configuration.AllTargets.FirstOrDefault(target => target is ObservableTarget);
((IObservable<string>)observableTarget)?.Subscribe(
Expand All @@ -35,35 +34,34 @@ public MainWindow()
public static MainWindow Current { get; set; }
private void InputTabControl_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (sender is TabControl inputTab &&
OutputTabControl != null && OutputTabControl.Items.Count > 1)
if (sender is not TabControl inputTab ||
OutputTabControl == null || OutputTabControl.Items.Count <= 1) return;
if (inputTab.SelectedItem is not TabItem tabItem) return;
WindowViewModel.Current.PlotVM?.SetCustomPlotLabel.Execute("");
switch (tabItem.Name)
{
if (!(inputTab.SelectedItem is TabItem tabItem)) return;
WindowViewModel.Current.PlotVM?.SetCustomPlotLabel.Execute("");
switch (tabItem.Name)
{
// default handles: "TabForward":
// "TabInverse":
// "TabSpectral":
default:
_logger.Debug($"Current Tab: {tabItem.Header}\n");
OutputTabControl.SelectedItem = OutputTabControl.Items[0];
((TabItem)OutputTabControl.Items[0]).Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[1]).Visibility = Visibility.Collapsed;
break;
case "TabFluence":
OutputTabControl.SelectedItem = OutputTabControl.Items[1];
((TabItem)OutputTabControl.Items[1]).Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[0]).Visibility = Visibility.Collapsed;
break;
case "TabMonteCarlo":
((TabItem)OutputTabControl.Items[1]).Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[0]).Visibility = Visibility.Visible;
break;
case "TabSpectral":
WindowViewModel.Current.PlotVM?.SetCustomPlotLabel.Execute(WindowViewModel.Current.SpectralMappingVM.SelectedTissue.Name);
break;
}
// default handles: "TabForward":
// "TabInverse":
default:
OutputTabControl.SelectedItem = OutputTabControl.Items[0];
((TabItem)OutputTabControl.Items[0])!.Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[1])!.Visibility = Visibility.Collapsed;
break;
case "TabFluence":
OutputTabControl.SelectedItem = OutputTabControl.Items[1];
((TabItem)OutputTabControl.Items[1])!.Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[0])!.Visibility = Visibility.Collapsed;
break;
case "TabMonteCarlo":
((TabItem)OutputTabControl.Items[1])!.Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[0])!.Visibility = Visibility.Visible;
break;
case "TabSpectral":
OutputTabControl.SelectedItem = OutputTabControl.Items[0];
((TabItem)OutputTabControl.Items[0])!.Visibility = Visibility.Visible;
((TabItem)OutputTabControl.Items[1])!.Visibility = Visibility.Collapsed;
WindowViewModel.Current.PlotVM?.SetCustomPlotLabel.Execute(WindowViewModel.Current.SpectralMappingVM.SelectedTissue.Name);
break;
}
}

Expand Down

0 comments on commit ba8be75

Please sign in to comment.