diff options
| author | Michael <[email protected]> | 2017-02-13 17:24:15 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-13 17:24:20 -0500 |
| commit | 9d7555c0bc77e9c32292f15a6bbb86e73d82fff6 (patch) | |
| tree | 2efd9ec2b801e270eed5f609fdd1dd5e5408ab17 | |
| parent | eb1427f2b11d4e6569eb9e0011d23413475f434d (diff) | |
| download | shiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.tar.gz shiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.tar.bz2 shiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.zip | |
My hands are fixing bugs.
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.Designer.cs | 79 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.cs | 34 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.resx | 22 |
3 files changed, 120 insertions, 15 deletions
diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index 62c9b42..d4b7211 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -52,16 +52,25 @@ namespace ShiftOS.WinForms.Applications /// </summary> private void InitializeComponent() { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Chat)); this.panel1 = new System.Windows.Forms.Panel(); this.rtbchat = new System.Windows.Forms.RichTextBox(); - this.txtuserinput = new System.Windows.Forms.TextBox(); + this.toolStrip1 = new System.Windows.Forms.ToolStrip(); + this.tschatid = new System.Windows.Forms.ToolStripLabel(); + this.tsuserdata = new System.Windows.Forms.ToolStripLabel(); + this.tsbottombar = new System.Windows.Forms.ToolStrip(); + this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); + this.btnsend = new System.Windows.Forms.ToolStripButton(); this.panel1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.tsbottombar.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.rtbchat); - this.panel1.Controls.Add(this.txtuserinput); + this.panel1.Controls.Add(this.toolStrip1); + this.panel1.Controls.Add(this.tsbottombar); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; @@ -72,23 +81,66 @@ namespace ShiftOS.WinForms.Applications // this.rtbchat.Dock = System.Windows.Forms.DockStyle.Fill; this.rtbchat.HideSelection = false; - this.rtbchat.Location = new System.Drawing.Point(0, 0); + this.rtbchat.Location = new System.Drawing.Point(0, 25); this.rtbchat.Name = "rtbchat"; - this.rtbchat.Size = new System.Drawing.Size(633, 298); + this.rtbchat.Size = new System.Drawing.Size(633, 268); this.rtbchat.TabIndex = 1; this.rtbchat.Text = ""; this.rtbchat.TextChanged += new System.EventHandler(this.rtbchat_TextChanged); this.rtbchat.KeyDown += new System.Windows.Forms.KeyEventHandler(this.richTextBox1_KeyDown); // + // toolStrip1 + // + this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.tschatid, + this.tsuserdata}); + this.toolStrip1.Location = new System.Drawing.Point(0, 0); + this.toolStrip1.Name = "toolStrip1"; + this.toolStrip1.Size = new System.Drawing.Size(633, 25); + this.toolStrip1.TabIndex = 2; + this.toolStrip1.Text = "toolStrip1"; + // + // tschatid + // + this.tschatid.Name = "tschatid"; + this.tschatid.Size = new System.Drawing.Size(86, 22); + this.tschatid.Text = "toolStripLabel1"; + // + // tsuserdata + // + this.tsuserdata.Name = "tsuserdata"; + this.tsuserdata.Size = new System.Drawing.Size(86, 22); + this.tsuserdata.Text = "toolStripLabel1"; + // + // tsbottombar + // + this.tsbottombar.Dock = System.Windows.Forms.DockStyle.Bottom; + this.tsbottombar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.txtuserinput, + this.btnsend}); + this.tsbottombar.Location = new System.Drawing.Point(0, 293); + this.tsbottombar.Name = "tsbottombar"; + this.tsbottombar.Size = new System.Drawing.Size(633, 25); + this.tsbottombar.TabIndex = 3; + this.tsbottombar.Text = "toolStrip2"; + // // txtuserinput // - this.txtuserinput.Dock = System.Windows.Forms.DockStyle.Bottom; - this.txtuserinput.Location = new System.Drawing.Point(0, 298); + this.txtuserinput.AutoSize = false; this.txtuserinput.Name = "txtuserinput"; - this.txtuserinput.Size = new System.Drawing.Size(633, 20); - this.txtuserinput.TabIndex = 0; + this.txtuserinput.Size = new System.Drawing.Size(100, 25); this.txtuserinput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtuserinput_KeyDown); // + // btnsend + // + this.btnsend.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnsend.Image = ((System.Drawing.Image)(resources.GetObject("btnsend.Image"))); + this.btnsend.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnsend.Name = "btnsend"; + this.btnsend.Size = new System.Drawing.Size(37, 22); + this.btnsend.Text = "Send"; + this.btnsend.Click += new System.EventHandler(this.btnsend_Click); + // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -98,6 +150,10 @@ namespace ShiftOS.WinForms.Applications this.Size = new System.Drawing.Size(633, 318); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.tsbottombar.ResumeLayout(false); + this.tsbottombar.PerformLayout(); this.ResumeLayout(false); } @@ -106,6 +162,11 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Panel panel1; private System.Windows.Forms.RichTextBox rtbchat; - private System.Windows.Forms.TextBox txtuserinput; + private System.Windows.Forms.ToolStrip toolStrip1; + private System.Windows.Forms.ToolStripLabel tschatid; + private System.Windows.Forms.ToolStripLabel tsuserdata; + private System.Windows.Forms.ToolStrip tsbottombar; + private System.Windows.Forms.ToolStripTextBox txtuserinput; + private System.Windows.Forms.ToolStripButton btnsend; } } diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index da68fc6..6c7528c 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -70,20 +70,30 @@ namespace ShiftOS.WinForms.Applications public void SendMessage(string msg) { - rtbchat.AppendText($"[{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}] {msg}{Environment.NewLine}"); + if (!string.IsNullOrWhiteSpace(msg)) + { + rtbchat.AppendText($"[{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}] {msg}{Environment.NewLine}"); - ServerManager.SendMessage("chat_send", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatMessage(SaveSystem.CurrentSave.Username, SaveSystem.CurrentSave.SystemName, msg, id))); + ServerManager.SendMessage("chat_send", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatMessage(SaveSystem.CurrentSave.Username, SaveSystem.CurrentSave.SystemName, msg, id))); + } + else + { + rtbchat.AppendText($"[sys@multiuserdomain] You can't send blank messages. (only you can see this)"); + } } + private string id = ""; public void OnLoad() { SendMessage("User has joined the chat."); + RefreshUserInput(); } public void OnSkinLoad() { + RefreshUserInput(); } public bool OnUnload() @@ -95,6 +105,12 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { + RefreshUserInput(); + } + + public void RefreshUserInput() + { + txtuserinput.Width = (tsbottombar.Width) - (btnsend.Width) - 15; } private void richTextBox1_KeyDown(object sender, KeyEventArgs e) @@ -108,10 +124,7 @@ namespace ShiftOS.WinForms.Applications { e.SuppressKeyPress = true; - var save = SaveSystem.CurrentSave; - - SendMessage(txtuserinput.Text); - txtuserinput.Text = ""; + btnsend_Click(sender, EventArgs.Empty); } } @@ -119,6 +132,15 @@ namespace ShiftOS.WinForms.Applications { rtbchat.SelectionStart = rtbchat.Text.Length; rtbchat.ScrollToCaret(); + tschatid.Text = id; + tsuserdata.Text = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}"; + RefreshUserInput(); + } + + private void btnsend_Click(object sender, EventArgs e) + { + SendMessage(txtuserinput.Text); + txtuserinput.Text = ""; } } } diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index 1af7de1..a7b2b93 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -117,4 +117,26 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> + <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>122, 17</value> + </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="btnsend.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value> + iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG + YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9 + 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw + bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc + VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9 + c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32 + Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo + mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+ + kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D + TgDQASA1MVpwzwAAAABJRU5ErkJggg== +</value> + </data> </root>
\ No newline at end of file |
