public AutoCompleteManager(TerminalWindow instance) { this.instance = instance; autoCompleterDict = new Dictionary <string, AutoCompleter>(); autoCompleterList = new SortedList <uint, AutoCompleter>(); }
void openGcodeTerminalButton_Click(object sender, EventArgs mouseEvent) { UiThread.RunOnIdle((state) => { TerminalWindow.Show(); }); }
public override bool initialize(TerminalWindow instance) { //instance.WriteLine(string.Format("Initializing {0} v{1}...", Name, Version)); TerminalWindow.autoCompleteManager.RegisterAutoCompleter(new TestTest()); return(true); }
private void Awake() { //Setup singleton if (_instance == null) { _instance = this; } }
/// <summary> /// Open terminal connection to target currently selected /// </summary> /// <param name="TargetID"></param> private void ConnectToTarget() { if (lvTargets.SelectedItems.Count == 1) { int TargetID = (int)lvTargets.SelectedItems[0].Tag; TerminalWindow term; string host = string.Empty; try { ConfigDS.ConfigTargetsRow[] targets = configDS.ConfigTargets.Select(string.Format("ConfigTargetID = {0}", TargetID)) as ConfigDS.ConfigTargetsRow[]; if (targets.Length > 0) { ConfigDS.ConfigTargetsRow selectedTarget = targets[0]; host = selectedTarget.TargetIP; SNGDataSet.ScriptSettingRow _localScriptSettings = Scriptngo.Common.SettingsManager.GetCurrentScriptSettings(this.SNGDataSet); ConnectionParameters CP = new ConnectionParameters { DeviceIP = selectedTarget.TargetIP, Protocol = (ConnectionProtocol)Enum.Parse(typeof(ConnectionProtocol), selectedTarget.Protocol, true), Port = selectedTarget.IsPortNull() ? 0 : selectedTarget.Port, DeviceVendor = selectedTarget.DeviceVendor, JumpServer = selectedTarget.JumpServerIP.Trim(), LogonUserName = _localScriptSettings.ScriptingUserName, EnablePassword = _localScriptSettings.DeviceEnablePassword, LogonPassword = _localScriptSettings.ScriptingPassword, AuthType = (SNGTermAuthType)Enum.Parse(typeof(SNGTermAuthType), _localScriptSettings.TerminalAuthType), LineFeedRule = (LineFeedRule)Enum.Parse(typeof(LineFeedRule), _localScriptSettings.TerminalLineFeedRule), EncodingType = (EncodingType)Enum.Parse(typeof(EncodingType), _localScriptSettings.TerminalEncoding), TerminalType = (TerminalType)Enum.Parse(typeof(TerminalType), _localScriptSettings.TerminalType), NewLine = (NewLine)Enum.Parse(typeof(NewLine), _localScriptSettings.TerminalTransmitNL) }; var t = from Form form in Application.OpenForms where form is TerminalWindow select form; if (t.Count() > 0) { term = (TerminalWindow)t.ElementAt(0); } else { term = new TerminalWindow(); } term.MdiParent = this.MdiParent; term.Show(); term.BringToFront(); term.ConnectDisconnectTask(ConnectionTaskAction.Connect, true, CP); } else { MessageBox.Show("Unable to open a terminal because the script target was not found.", "Cannot open terminal", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } catch (Exception Ex) { MessageBox.Show(string.Format("An error occurred while opening connection to {0}. The error was : {1}", host, Ex.Message), "Connection error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public override void Execute() { // This case is if they specified a window that might exist, we'll find it, edit that. var win = this.Interpreter.Conveyor.WindowList.FirstOrDefault(x => x.Name.Equals("Debug", StringComparison.Ordinal)) as TerminalWindow; if (win == null) { // Window wasn't found, create it. win = new TerminalWindow { Name = "Debug" }; // Add the terminal window to our list. this.Interpreter.Conveyor.WindowList.Add(win); } var sb = Argus.Memory.StringBuilderPool.Take(); sb.AppendLine("Main Terminal: "); sb.Append(" {G*{x IsAutoScrollEnabled = {y").Append(App.MainWindow.GameTerminal.IsAutoScrollEnabled).AppendLine("{x"); var startLineOne = App.MainWindow.GameTerminal.TextArea.TextView.VisualLines.First().FirstDocumentLine; var startLineTwo = App.MainWindow.GameTerminal.TextArea.TextView.VisualLines.First().FirstDocumentLine; string startLineText = App.MainWindow.GameTerminal.GetText(startLineOne.Offset, startLineOne.Length); var endLineOne = App.MainWindow.GameTerminal.TextArea.TextView.VisualLines.Last().FirstDocumentLine; var endLineTwo = App.MainWindow.GameTerminal.TextArea.TextView.VisualLines.Last().LastDocumentLine; string endLineText = App.MainWindow.GameTerminal.GetText(endLineOne.Offset, endLineTwo.Length); sb.AppendFormat("\r\nStringBuilder Pool: {{y{0}{{x Idle, {{y64{{x Max Idle Capacity\r\n", Argus.Memory.StringBuilderPool.Count().ToString()); sb.Append($" {{G*{{x Has Wrapped Lines = {{y{App.MainWindow.GameTerminal.HasVisibleWrappedLines.ToString()}{{x\r\n"); sb.Append($" {{G*{{x Start Visual Line = {{y{startLineOne.LineNumber.ToString()}{{x\r\n"); sb.Append($" {{G*{{x Start Offsets = {{y{startLineOne.Offset.ToString()}{{x to {{y{startLineTwo.EndOffset.ToString()}{{x\r\n"); sb.Append($" {{G*{{x Start Visual Line Text = {startLineText}\r\n"); sb.Append($" {{G*{{x End Visual Line = {{y{endLineOne.LineNumber.ToString()}{{x\r\n"); sb.Append($" {{G*{{x End Offsets = {{y{endLineOne.Offset.ToString()}{{x to {{y{endLineTwo.EndOffset.ToString()}{{x\r\n"); sb.Append($" {{G*{{x End Visual Line Text = {endLineText}\r\n"); sb.AppendLine("Terminal 1: "); sb.Append(" {G*{x IsAutoScrollEnabled = {y").Append(App.MainWindow.Terminal1.IsAutoScrollEnabled).AppendLine("{x"); sb.AppendLine("Terminal 2: "); sb.Append(" {G*{x IsAutoScrollEnabled = {y").Append(App.MainWindow.Terminal2.IsAutoScrollEnabled).AppendLine("{x"); sb.AppendLine("Terminal 2: "); sb.Append(" {G*{x IsAutoScrollEnabled = {y").Append(App.MainWindow.Terminal3.IsAutoScrollEnabled).AppendLine("{x"); win.Title = "Debug Information"; win.Terminal.Text = ""; win.AppendAnsi(sb); win.Show(); win.Focus(); Argus.Memory.StringBuilderPool.Return(sb); }
private void HandleTerminal() { var terminalWindow = new TerminalWindow { Owner = Application.Current.MainWindow }; var terminalViewModel = new TerminalViewModel(_neighbor); terminalWindow.DataContext = terminalViewModel; terminalWindow.Show(); }
public static void SetTerminalSize(int width, int height, int bufferHeight) { if (WindowList.Count > 1) { Runtime.ThrowError("Cannot resize terminal when windows are open"); } Width = width; Height = height; TerminalWindow.InitBuffer(width, height); TerminalWindow.InitClientRectangle(); StdScr.Resize(width, height, bufferHeight); RefreshAll(); }
//internal SessionDataObject SessionData //{ get { return this.SessionData; } } internal SessionForm(SessionConnectionInfo sciData) { InitializeComponent(); this.m_sessionData = new SessionDataObject(sciData); this.m_controller = new SessionController(this.m_sessionData, this); this.m_term = new TerminalWindow(this.m_sessionData); InitTermWindow(); this.toolStripButtonProxy.Checked = this.m_sessionData.ProxyEnabled; this.toolStripButtonLogon.Checked = this.m_sessionData.LogonEnabled; this.toolStripButtonMummy.Checked = this.m_sessionData.EnterGameEnabled; this.toolStripButtonMummy.Checked = this.m_sessionData.MummyScriptEnabled; }
static void Main(string[] args) { Console.WriteLine("Hello World!"); using (TerminalWindow tw = new TerminalWindow()) { tw.KeyDown += (sender, handler) => { Console.WriteLine($"Pressed button: {handler.Key}, Mods: {handler.Modifiers}"); }; tw.Init(); } //Console.Destroy(); }
public void New(string windowName, WindowType windowType = WindowType.TerminalWindow) { // If it doesn't have access then execute the same function on the UI thread, otherwise just run it. if (!Application.Current.Dispatcher.CheckAccess()) { Application.Current.Dispatcher.Invoke(() => this.New(windowName, windowType)); return; } // Does the specified window already exist by name? var win = _interpreter.Conveyor.WindowList.FirstOrDefault(x => x.Name.Equals(windowName, StringComparison.Ordinal)); // The window already existed, get out. if (win != null) { return; } switch (windowType) { case WindowType.Default: case WindowType.TerminalWindow: win = new TerminalWindow() { Name = windowName }; _interpreter.Conveyor.WindowList.Add(win); break; case WindowType.CompassWindow: win = new CompassWindow() { Name = windowName }; _interpreter.Conveyor.WindowList.Add(win); break; default: throw new Exception($"The specified WindowType of {windowType.ToString()} was invalid."); } win.Show(); win.Activate(); }
public override void Execute() { // If no parameters echo the help. if (string.IsNullOrWhiteSpace(this.Parameters)) { this.Interpreter.Send("#window --help"); return; } // Parse the arguments and append to the file. var result = Parser.Default.ParseArguments <Arguments>(CreateArgs(this.Parameters)) .WithParsed(o => { // Close all windows if (o.CloseAll) { int count = this.Interpreter.Conveyor.WindowList.Count; // Step backwards through the list removing all the items. for (int i = this.Interpreter.Conveyor.WindowList.Count - 1; i >= 0; i--) { this.Interpreter.Conveyor.WindowList[i].Close(); } this.Interpreter.Conveyor.EchoLog($"{count.ToString()} {"window".IfCountPluralize(count, "windows")} {"was".IfCountPluralize(count, "were")} closed", Common.Models.LogType.Information); return; } if (!string.IsNullOrWhiteSpace(o.Name)) { // This case is if they specified a window that might exist, we'll find it, edit that. var win = this.Interpreter.Conveyor.WindowList.FirstOrDefault(x => x.Name.Equals(o.Name, StringComparison.Ordinal)); if (win == null && o.Close) { // Window wasn't found, but close was specified, just exit. return; } else if (win == null) { // Window wasn't found, create it. win = new TerminalWindow { Name = o.Name }; // Add the terminal window to our list. this.Interpreter.Conveyor.WindowList.Add(win); } else { // It existed at this point, but let's see if it was supposed to be closed. Closing // will trigger the Closed event on the Window which will remove the Window from the // shared list of ITerminalWindows on the Conveyor. if (o.Close) { win.Close(); return; } } SetWindowProperties(win, o); win.Show(); return; } // Shows a known system window. if (!string.IsNullOrWhiteSpace(o.Show)) { Utilities.WindowManager.ShellWindowAsync(o.Show); return; } if (o.List) { // List info about all of the active windows. if (this.Interpreter.Conveyor.WindowList.Count == 0) { this.Interpreter.Conveyor.EchoLog("No user created terminal windows currently exist.", Common.Models.LogType.Information); return; } var tb = new TableBuilder(new[] { "Window Name", "Type", "Title", "Status Text" }); foreach (var win in this.Interpreter.Conveyor.WindowList) { tb.AddRow(win.Name, win.WindowType.ToString(), win.Title, win.StatusText); } this.Interpreter.Conveyor.EchoText(tb.ToString()); return; } // Main window handling if (o.Info) { this.Interpreter.Conveyor.EchoText($"Width = {{y{App.MainWindow.Width.ToString()}{{x, Height = {{y{App.MainWindow.Height.ToString()}{{x\r\n"); this.Interpreter.Conveyor.EchoText($"Left = {{y{App.MainWindow.Left.ToString()}{{x, Height = {{y{App.MainWindow.Top.ToString()}{{x\r\n"); } if (o.Height > 0) { App.MainWindow.Height = o.Height; } if (o.Width > 0) { App.MainWindow.Width = o.Width; } if (o.Top >= 0) { App.MainWindow.Top = o.Top; } if (o.Left >= 0) { App.MainWindow.Left = o.Left; } if (o.Center) { double screenWidth = System.Windows.SystemParameters.PrimaryScreenWidth; double screenHeight = System.Windows.SystemParameters.PrimaryScreenHeight; double windowWidth = App.MainWindow.Width; double windowHeight = App.MainWindow.Height; App.MainWindow.Left = (screenWidth / 2) - (windowWidth / 2); App.MainWindow.Top = (screenHeight / 2) - (windowHeight / 2); } if (!string.IsNullOrWhiteSpace(o.Title)) { App.Settings.ProfileSettings.WindowTitle = o.Title; } }); // Display the help or error output from the parameter parsing. this.DisplayParserOutput(result); }
public AutoCompleteContext(TerminalWindow instance) { WorkingDirectory = instance.WorkingDirectory; Input = instance.Input; }
private RichHudTerminal() : base(false, true) { settingsMenu = new TerminalWindow(HudMain.HighDpiRoot); root = settingsMenu.AddModRoot("Rich HUD Master"); MyAPIGateway.Utilities.MessageEntered += MessageHandler; }
static void Init() { TerminalWindow tw = (TerminalWindow)EditorWindow.GetWindow(typeof(TerminalWindow)); tw.Show(); }
public static void SetTerminalFont(string name, int size) { TerminalWindow.InitFont(name, size); TerminalWindow.InitClientRectangle(); RefreshAll(); }
public override void OnAwake() { base.OnAwake(); GetLocalizedTextValues(); var wolfScenario = FindObjectOfType <WOLF_ScenarioModule>(); _wolf = wolfScenario.ServiceManager.GetService <IRegistryCollection>(); var usiTools = USI_AddonServiceManager.Instance; if (usiTools != null) { var serviceManager = usiTools.ServiceManager; var windowManager = serviceManager.GetService <WindowManager>(); try { // Setup UI prefabs var filepath = Path.Combine(KSPUtil.ApplicationRootPath, "GameData/UmbraSpaceIndustries/WOLF/Assets/UI/CrewTransferWindow.prefabs"); var prefabs = AssetBundle.LoadFromFile(filepath); var flightSelectorPrefab = prefabs.LoadAsset <GameObject>("FlightSelector"); var kerbalSelectorPrefab = prefabs.LoadAsset <GameObject>("KerbalSelector"); var terminalWindowPrefab = prefabs.LoadAsset <GameObject>("TerminalWindow"); var warningPanelPrefab = prefabs.LoadAsset <GameObject>("WarningPanel"); // Register prefabs with window manager windowManager .RegisterPrefab <FlightSelector>(flightSelectorPrefab) .RegisterPrefab <KerbalSelector>(kerbalSelectorPrefab) .RegisterPrefab <WarningPanel>(warningPanelPrefab) .RegisterWindow <TerminalWindow>(terminalWindowPrefab); } catch (ServiceAlreadyRegisteredException) { } catch (NullReferenceException) { // TODO - Create an asset bundle loader service in USITools } catch (Exception ex) { Debug.LogError($"[WOLF] {ClassName}: {ex.Message}"); } try { _window = windowManager.GetWindow <TerminalWindow>(); _window.Initialize(this, windowManager, () => { if (_toolbarButton != null) { _toolbarButton.SetFalse(false); } }); } catch (Exception ex) { Debug.LogError($"[WOLF] {ClassName}: {ex.Message}"); enabled = false; return; } // Create toolbar button var textureService = serviceManager.GetService <TextureService>(); var toolbarIcon = textureService.GetTexture( "GameData/UmbraSpaceIndustries/WOLF/Assets/UI/crew-transfers.png", 36, 36); var showInScenes = ApplicationLauncher.AppScenes.FLIGHT | ApplicationLauncher.AppScenes.MAPVIEW | ApplicationLauncher.AppScenes.SPACECENTER | ApplicationLauncher.AppScenes.SPH | ApplicationLauncher.AppScenes.TRACKSTATION | ApplicationLauncher.AppScenes.VAB; _toolbarButton = ApplicationLauncher.Instance.AddModApplication( ShowWindow, CloseWindow, null, null, null, null, showInScenes, toolbarIcon); } }
public PluginManager(TerminalWindow instance) { this.instance = instance; pluginDict = new Dictionary <string, Plugin>(); }
public abstract bool initialize(TerminalWindow instance);
public override void finalize(TerminalWindow instance) { //instance.WriteLine(string.Format("Finalizing {0} v{1}...", Name, Version)); }
public abstract void finalize(TerminalWindow instance);