internal static void StartConsole(ToolInfo toolInfo, string command) { if (toolInfo == null) { return; } //if (String.IsNullOrEmpty(command)) return; if (!File.Exists(toolInfo.ToolExecutablePath)) { throw new FileNotFoundException( String.Format("Tool executable file '{0}' can not be found.", toolInfo.ToolExecutablePath), toolInfo.ToolExecutablePath); } // create UI var textOutput = new ConsoleOutput(); var toolWnd = ToolWindow.Create(textOutput, "Console"); var host = new ToolExecutionHost(toolInfo, textOutput); host.BeginExecute(command); toolWnd.ShowDialog(); }
protected override bool Execute(object parameter) { ErrorHandler(() => { var selSchema = new SelectSchema(); selSchema.ExecutableNames = from schema in _pageMgr.SchemaManager.GuiSchemas from exec in schema.ToolConfig.Executables select new GuiSchemaInfo { ExecutableName = exec.Name, SchemaFilePath = schema.SchemaFilePath, ScreenName = exec.Gui.Name }; var window = ToolWindow.Create(selSchema, "Select a Schema"); var result = window.ShowDialog(); if (result.HasValue && result.Value) { if (selSchema.IsNewSchema) { int index = _pageMgr.NewAll(selSchema.SchemaPath); _pageMgr.ActiveDocument = _pageMgr.Documents[index]; } else { var selected = (from schema in _pageMgr.SchemaManager.GuiSchemas where schema.SchemaFilePath == selSchema.Selected.SchemaFilePath from exec in schema.ToolConfig.Executables where exec.Name == selSchema.Selected.ExecutableName where exec.Gui.Name == selSchema.Selected.ScreenName select new { Schema = schema, Executable = exec }).FirstOrDefault(); _pageMgr.ActiveDocument = _pageMgr.AddDocument(selected.Schema, selected.Executable); } } }); return(base.Execute(parameter)); }