public PickTargetOutputTypeWindow(Window owner, OutputTargetSectionViewModel viewModel) : base(owner) { InitializeComponent(); Title = "Select type"; DataContext = this; IOutputTargetViewModel libraryVm = viewModel.Targets.First(vm => vm.Type == OutputTargetType.Library); if(libraryVm.IsAutoGenerated) { Targets = new OutputTargetType[] { OutputTargetType.Library, OutputTargetType.Binary, OutputTargetType.Benchmark, OutputTargetType.Test, OutputTargetType.Example }; } else { Targets = new OutputTargetType[] { OutputTargetType.Binary, OutputTargetType.Benchmark, OutputTargetType.Test, OutputTargetType.Example }; } SelectedTarget = Targets[0]; }
public static OutputTargetType? Start(OutputTargetSectionViewModel viewModel) { var window = new PickTargetOutputTypeWindow(Application.Current.MainWindow, viewModel); bool? result = window.ShowDialog(); if(result == true) return window.SelectedTarget; else return null; }