public static string SetCommandPrompt(string id = "", string prompt = null) { Shell s = Shell.GetShell(id); if (s != null) { if (s.MainControl.Dispatcher.CheckAccess()) { ShellTextControl c = s.MainControl as ShellTextControl; if (c != null) { ShellTextBox b = c.GetContents; if (b != null) { if (prompt == null) { return(b.GetPromptPrefix()); } prompt = prompt.Trim(); b.SetPromptPrefix(prompt); return(""); } } } else { return((string)s.MainControl.Dispatcher.Invoke(new Func <string>(() => { return SetCommandPrompt(s.ShellId, prompt); }))); } } return("Error: could not access prompt."); }
// On entry, node is the shell node. public override void Serializer(XmlNode node, bool isSerialize) { base.Serializer(node, isSerialize); XmlNode t = Project.GetChildNode(node, "textcontrol"); if (t == null) { return; } ShellTextBox b = GetContents; if (b != null) { if (isSerialize) { Project.SetNodeAttributeValue(t, "prompt", b.GetPromptPrefix()); } else { b.SetPromptPrefix(Project.GetNodeAttributeValue(t, "prompt", "")); } } }