From ee343916c292c741041167a1a77f4b59a95002c5 Mon Sep 17 00:00:00 2001 From: TheEdgeNK Date: Sun, 26 Aug 2018 14:15:03 -0400 Subject: Ability to change chatter username, also, terminal! --- Project Ports/Programs/ChatApp.Designer.cs | 1 + Project Ports/Programs/ChatApp.cs | 11 ++++++- Project Ports/Programs/Terminal.Designer.cs | 45 +++++++++++++++++++---------- Project Ports/Programs/Terminal.cs | 10 +++++++ 4 files changed, 51 insertions(+), 16 deletions(-) (limited to 'Project Ports/Programs') diff --git a/Project Ports/Programs/ChatApp.Designer.cs b/Project Ports/Programs/ChatApp.Designer.cs index c2200c1..f6a3dbd 100644 --- a/Project Ports/Programs/ChatApp.Designer.cs +++ b/Project Ports/Programs/ChatApp.Designer.cs @@ -57,6 +57,7 @@ this.txtMsgContents.Name = "txtMsgContents"; this.txtMsgContents.Size = new System.Drawing.Size(384, 18); this.txtMsgContents.TabIndex = 1; + this.txtMsgContents.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtMsgContents_KeyDown); // // listBox1 // diff --git a/Project Ports/Programs/ChatApp.cs b/Project Ports/Programs/ChatApp.cs index 593fa17..0e89077 100644 --- a/Project Ports/Programs/ChatApp.cs +++ b/Project Ports/Programs/ChatApp.cs @@ -21,7 +21,16 @@ namespace Project_Ports private void btnSendMSG_Click(object sender, EventArgs e) { - PortEngine.ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + } + + private void txtMsgContents_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + ChatAPI.SendMessage(txtMsgContents, txtSentMessages); + e.SuppressKeyPress = true; + } } } } diff --git a/Project Ports/Programs/Terminal.Designer.cs b/Project Ports/Programs/Terminal.Designer.cs index 48e3ee4..c5c2807 100644 --- a/Project Ports/Programs/Terminal.Designer.cs +++ b/Project Ports/Programs/Terminal.Designer.cs @@ -28,30 +28,44 @@ /// private void InitializeComponent() { - this.textBox1 = new System.Windows.Forms.TextBox(); + this.txtConsole = new System.Windows.Forms.TextBox(); + this.txtInput = new System.Windows.Forms.TextBox(); this.SuspendLayout(); // - // textBox1 + // txtConsole // - this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.txtConsole.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.textBox1.BackColor = System.Drawing.Color.Black; - this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None; - this.textBox1.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.textBox1.ForeColor = System.Drawing.Color.White; - this.textBox1.Location = new System.Drawing.Point(0, 0); - this.textBox1.Multiline = true; - this.textBox1.Name = "textBox1"; - this.textBox1.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; - this.textBox1.Size = new System.Drawing.Size(456, 337); - this.textBox1.TabIndex = 0; + this.txtConsole.BackColor = System.Drawing.Color.Black; + this.txtConsole.BorderStyle = System.Windows.Forms.BorderStyle.None; + this.txtConsole.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtConsole.ForeColor = System.Drawing.Color.White; + this.txtConsole.Location = new System.Drawing.Point(-3, 0); + this.txtConsole.Multiline = true; + this.txtConsole.Name = "txtConsole"; + this.txtConsole.ReadOnly = true; + this.txtConsole.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; + this.txtConsole.Size = new System.Drawing.Size(456, 321); + this.txtConsole.TabIndex = 3; + // + // txtInput + // + this.txtInput.BackColor = System.Drawing.SystemColors.WindowText; + this.txtInput.Font = new System.Drawing.Font("Lucida Console", 8F); + this.txtInput.ForeColor = System.Drawing.SystemColors.Window; + this.txtInput.Location = new System.Drawing.Point(0, 319); + this.txtInput.Name = "txtInput"; + this.txtInput.Size = new System.Drawing.Size(456, 18); + this.txtInput.TabIndex = 4; + this.txtInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInput_KeyDown); // // Terminal // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.textBox1); + this.Controls.Add(this.txtInput); + this.Controls.Add(this.txtConsole); this.Name = "Terminal"; this.Size = new System.Drawing.Size(456, 337); this.Load += new System.EventHandler(this.Terminal_Load); @@ -62,6 +76,7 @@ #endregion - private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.TextBox txtConsole; + public System.Windows.Forms.TextBox txtInput; } } diff --git a/Project Ports/Programs/Terminal.cs b/Project Ports/Programs/Terminal.cs index c878c32..55cf8ed 100644 --- a/Project Ports/Programs/Terminal.cs +++ b/Project Ports/Programs/Terminal.cs @@ -23,5 +23,15 @@ namespace Project_Ports { WindowManager wm = new WindowManager(); } + + private void txtInput_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + { + TerminalAPI.RunCommand(txtInput, txtConsole); + e.SuppressKeyPress = true; + txtInput.Clear(); + } + } } } -- cgit v1.2.3