private void OpenSolution() { var solutionFiles = Directory.GetFiles(myStepContext.TargetDirectory, "*.sln", SearchOption.AllDirectories); if (solutionFiles.Length == 0) { MessageBox.Show("MicroService created - unable to open solution because no solution file found.", "Info", MessageBoxButton.OK, MessageBoxImage.Information); } else { string solutionFile = solutionFiles[0]; if (solutionFiles.Length > 1) { var itemSelectionViewModel = new ItemSelectionViewModel <string>(); foreach (var file in solutionFiles) { itemSelectionViewModel.Add(file, new FileInfo(file).Name, file); } UIHelper.ShowView <ItemSelectionView>(itemSelectionViewModel); if (itemSelectionViewModel.Canceled == false) { solutionFile = itemSelectionViewModel.SelectedItem; } else { solutionFile = null; } } if (solutionFile != null) { var application = ServiceFromTemplateCommand.Instance.ServiceProvider.GetService(typeof(SDTE)) as DTE2; if (!application.Solution.IsOpen) { application.Solution.Open(solutionFile); } else { Process.Start(solutionFile); } } } }
public ItemSelectionView() { InitializeComponent(); DataContext = new ItemSelectionViewModel(); }