aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications/Chat.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-02-13 17:24:15 -0500
committerMichael <[email protected]>2017-02-13 17:24:20 -0500
commit9d7555c0bc77e9c32292f15a6bbb86e73d82fff6 (patch)
tree2efd9ec2b801e270eed5f609fdd1dd5e5408ab17 /ShiftOS.WinForms/Applications/Chat.cs
parenteb1427f2b11d4e6569eb9e0011d23413475f434d (diff)
downloadshiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.tar.gz
shiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.tar.bz2
shiftos_thereturn-9d7555c0bc77e9c32292f15a6bbb86e73d82fff6.zip
My hands are fixing bugs.
Diffstat (limited to 'ShiftOS.WinForms/Applications/Chat.cs')
-rw-r--r--ShiftOS.WinForms/Applications/Chat.cs34
1 files changed, 28 insertions, 6 deletions
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 = "";
}
}
}