/// <summary> /// When a new solution is selected, set _selectedSolution and update the reagent list. /// </summary> private void SolutionSelected(OptionButton.ItemSelectedEventArgs args) { SolutionOption.SelectId(args.Id); _selectedSolution = (string?)SolutionOption.SelectedMetadata; _addReagentWindow?.UpdateSolution(_selectedSolution); UpdateReagents(); }
public Options(string[] args) { commandLineApplication = new CommandLineApplication(); SolutionOption = commandLineApplication.Option("-s|--solution", "[Mandatory] Solution file (*.sln) path", CommandOptionType.SingleValue); ProjectOption = commandLineApplication.Option("-p|--project", "[Optional] Project name", CommandOptionType.SingleValue); ConfigurationOption = commandLineApplication.Option("-c|--configuration", "[Optional] Solution configuration name (if defined filter only this configuration)", CommandOptionType.SingleValue); PlatformOption = commandLineApplication.Option("-l|--platform", "[Optional] Solution platform name (if defined filter only this patform)", CommandOptionType.SingleValue); OrderByPlatformOption = commandLineApplication.Option("-op|--orderByPlatform", "[Optional] Output ordered by platform", CommandOptionType.NoValue); HelpOption = commandLineApplication.Option("-h|--help", "Show help", CommandOptionType.NoValue); var res = commandLineApplication.Execute(args); Solution = SolutionOption.HasValue() ? SolutionOption.Value() : null; Project = ProjectOption.HasValue() ? ProjectOption.Value() : null; Configuration = ConfigurationOption.HasValue() ? ConfigurationOption.Value() : null; Platform = PlatformOption.HasValue() ? PlatformOption.Value() : null; }
/// <summary> /// Update the solution options. /// </summary> public void UpdateSolutions(Dictionary <string, Solution>?solutions) { SolutionOption.Clear(); _solutions = solutions; if (_solutions == null) { return; } int i = 0; foreach (var solution in _solutions.Keys) { SolutionOption.AddItem(solution, i); SolutionOption.SetItemMetadata(i, solution); if (solution == _selectedSolution) { SolutionOption.Select(i); } i++; } if (SolutionOption.ItemCount == 0) { // No applicable solutions Close(); Dispose(); } if (_selectedSolution == null || !_solutions.ContainsKey(_selectedSolution)) { // the previously selected solution is no longer valid. SolutionOption.Select(0); _selectedSolution = (string?)SolutionOption.SelectedMetadata; } }