public static void ExecuteCommand(SolutionItem item, object data) { if (data is string) { if ((string)data == "selector") { using (var dlg = new ExecutionModeSelectorDialog()) { dlg.Load(item); var cmd = dlg.Run(); if (cmd?.Id == "run") { // Store the configuration for quick reuse var ec = new ExecutionConfiguration(dlg.SelectedConfiguration, dlg.SelectedExecutionModeSet, dlg.SelectedExecutionMode); var list = ExecutionModeCommandService.GetExecutionConfigurations(item).ToList(); list.Remove(ec); list.Insert(0, ec); while (list.Count > 10) { list.RemoveAt(list.Count - 1); } ExecutionModeCommandService.SetExecutionConfigurations(item, list.ToArray()); // Run the configuration IdeApp.ProjectOperations.Execute(item, dlg.SelectedExecutionMode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, dlg.SelectedConfiguration); } return; } } else if ((string)data == "custom") { using (var dlg = new RunWithCustomParametersDialog((Project)item)) { var cmd = dlg.Run(IdeServices.DesktopService.GetFocusedTopLevelWindow()); if (cmd?.Id == "run") { // Run the configuration IdeApp.ProjectOperations.Execute(item, dlg.SelectedExecutionMode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, dlg.SelectedConfiguration); } return; } } } var c = (ExecutionConfiguration)data; IdeApp.ProjectOperations.Execute(item, c.Mode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, c.RunConfiguration); }
public static void ExecuteCommand (SolutionItem item, object data) { if (data is string) { if ((string)data == "selector") { using (var dlg = new ExecutionModeSelectorDialog ()) { dlg.Load (item); var cmd = dlg.Run (); if (cmd?.Id == "run") { // Store the configuration for quick reuse var ec = new ExecutionConfiguration (dlg.SelectedConfiguration, dlg.SelectedExecutionModeSet, dlg.SelectedExecutionMode); var list = ExecutionModeCommandService.GetExecutionConfigurations (item).ToList (); list.Remove (ec); list.Insert (0, ec); while (list.Count > 10) list.RemoveAt (list.Count - 1); ExecutionModeCommandService.SetExecutionConfigurations (item, list.ToArray ()); // Run the configuration IdeApp.ProjectOperations.Execute (item, dlg.SelectedExecutionMode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, dlg.SelectedConfiguration); } return; } } else if ((string)data == "custom") { using (var dlg = new RunWithCustomParametersDialog ((Project)item)) { var cmd = dlg.Run (); if (cmd?.Id == "run") { // Run the configuration IdeApp.ProjectOperations.Execute (item, dlg.SelectedExecutionMode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, dlg.SelectedConfiguration); } return; } } } var c = (ExecutionConfiguration)data; IdeApp.ProjectOperations.Execute (item, c.Mode.ExecutionHandler, IdeApp.Workspace.ActiveConfiguration, c.RunConfiguration); }