Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature 56 - the map view is not switching back to the plot view when clicking the spectral panel #57

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading