public static string Exit(string id = "*") { if (String.IsNullOrWhiteSpace(id)) { id = "*"; } if (id.Equals("*")) { MainWindow.CloseChildren(false); return(""); } Shell s = GetShell(id); if ((s != null) && (!s.ShellId.Equals(ConsoleShellId))) { if (s.MainControl.Dispatcher.CheckAccess()) { s.Close(); } else { s.MainControl.Dispatcher.Invoke(new Func <string>(() => { return(Exit(s.ShellId)); })); } } return(""); }
public static string PlotDataFile(string dataFileName) { if (!String.IsNullOrWhiteSpace(dataFileName)) { string id = PlotControl.OpenPlotShell(); Shell s = Shell.GetShell(id); if (s != null) { PlotControl p = s.MainControl as PlotControl; if (p != null) { DataCache d = new DataCache(dataFileName); string header = ""; d.LoadFromFile(dataFileName, out header); p.NumPointsPerPlot = d.AbsoluteCount; p.SetCache(d); return(id); } s.Close(); return("Error: unable to open plot control."); } return("Error: unable to open plot shell."); } return("Error: bad file name."); }
static void AddShell(Shell shell) { if ((shell != null) && !String.IsNullOrWhiteSpace(shell.ShellId)) { try { if (Shells.ContainsKey(shell.ShellId)) { Shell s = (Shell)Shells[shell.ShellId]; if (s.Equals(shell)) { return; } s.Close(); } Shells[shell.ShellId] = shell; } catch (Exception) { } } }