diff options
| author | Michael <[email protected]> | 2017-02-12 20:13:06 -0500 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-02-12 20:13:06 -0500 |
| commit | f483997d33bc59fccfc2cb967d0bef2e29448a02 (patch) | |
| tree | dfa536d0957f282da9f833aedd0c3fb41c014ff7 /ShiftOS.WinForms/Applications/MUDControlCentre.cs | |
| parent | f5f4dcbdb58829707ecbc7ecc20ffdae8c656457 (diff) | |
| download | shiftos_thereturn-f483997d33bc59fccfc2cb967d0bef2e29448a02.tar.gz shiftos_thereturn-f483997d33bc59fccfc2cb967d0bef2e29448a02.tar.bz2 shiftos_thereturn-f483997d33bc59fccfc2cb967d0bef2e29448a02.zip | |
New chat client-side.
Diffstat (limited to 'ShiftOS.WinForms/Applications/MUDControlCentre.cs')
| -rw-r--r-- | ShiftOS.WinForms/Applications/MUDControlCentre.cs | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs index 6336718..f2d5e77 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs @@ -78,6 +78,13 @@ namespace ShiftOS.WinForms.Applications myLegionToolStripMenuItem_Click(this, EventArgs.Empty); })); } + else if(msg.Name == "chat_all") + { + this.Invoke(new Action(() => + { + this.ListAllChats(JsonConvert.DeserializeObject<Channel[]>(msg.Contents)); + })); + } else if (msg.Name == "user_shop_check_result") { if (msg.Contents == "0") @@ -169,6 +176,69 @@ namespace ShiftOS.WinForms.Applications }; } + public void ListAllChats(Channel[] channels) + { + shop_all.BringToFront(); + + flshoplist.Controls.Clear(); + + foreach (var shop in channels) + { + var bnr = new Panel(); + bnr.Height = 100; + bnr.Tag = "keepbg"; + + bnr.Width = flshoplist.Width; + + var lTitle = new Label(); + lTitle.AutoSize = true; + lTitle.Tag = "keepbg header2"; + lTitle.Text = shop.Name; + lTitle.Location = new Point(18, 17); + bnr.Controls.Add(lTitle); + lTitle.Show(); + var desc = new Label(); + desc.Text = shop.Topic; + bnr.Controls.Add(desc); + desc.Show(); + + var flButtons = new FlowLayoutPanel(); + flButtons.AutoSize = true; + flButtons.AutoSizeMode = AutoSizeMode.GrowAndShrink; + flButtons.Tag = "keepbg"; + flButtons.FlowDirection = FlowDirection.RightToLeft; + flButtons.Anchor = AnchorStyles.Top | AnchorStyles.Right; + flButtons.Top = 2; + flButtons.Left = bnr.Width - flButtons.Width - 2; + bnr.Controls.Add(flButtons); + flButtons.Show(); + + var btn = new Button(); + btn.Text = "Browse"; + btn.Click += (o, a) => + { + OpenChat(shop.ID); + }; + flButtons.Controls.Add(btn); + btn.Show(); + + flshoplist.Controls.Add(bnr); + bnr.Show(); + ControlManager.SetupControls(bnr); + desc.Left = lTitle.Left; + desc.Width = (bnr.Width - desc.Left - desc.Left); + desc.Top = lTitle.Top + lTitle.Height; + desc.Height = (bnr.Height - lTitle.Top); + + } + + } + + public void OpenChat(string id) + { + AppearanceManager.SetupWindow(new Chat(id)); + } + private Shop editingShop = null; private string editingShopOldName = ""; @@ -782,5 +852,10 @@ Current legions: {legionname}"; shop_editor.BringToFront(); PopulateShopEditor(); } + + private void joinAChatToolStripMenuItem_Click(object sender, EventArgs e) + { + ServerManager.SendMessage("chat_getallchannels", ""); + } } } |
