diff options
| author | Michael <[email protected]> | 2017-06-25 13:43:14 -0400 |
|---|---|---|
| committer | Michael <[email protected]> | 2017-06-25 13:43:14 -0400 |
| commit | 8e19c8599975685410d7508b150f811dc3991f4a (patch) | |
| tree | 83dcf614806a32651221f6c7426d60fa8dc0332c /ShiftOS.WinForms/Applications | |
| parent | 4c63e5e41c55d41c0bcaa09f125299d4b1892ef6 (diff) | |
| download | shiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.tar.gz shiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.tar.bz2 shiftos_thereturn-8e19c8599975685410d7508b150f811dc3991f4a.zip | |
another mission
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.Designer.cs | 32 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.cs | 97 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Chat.resx | 23 |
3 files changed, 89 insertions, 63 deletions
diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index 7bfa4dd..622bf1a 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -65,9 +65,12 @@ namespace ShiftOS.WinForms.Applications this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tschatid = new System.Windows.Forms.ToolStripLabel(); this.tsuserdata = new System.Windows.Forms.ToolStripLabel(); + this.lbtyping = 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.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.btnsendfile = new System.Windows.Forms.ToolStripButton(); this.panel1.SuspendLayout(); this.pnlstart.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -179,7 +182,10 @@ namespace ShiftOS.WinForms.Applications // this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.tschatid, - this.tsuserdata}); + this.tsuserdata, + this.lbtyping, + this.toolStripSeparator1, + this.btnsendfile}); this.toolStrip1.Location = new System.Drawing.Point(0, 0); this.toolStrip1.Name = "toolStrip1"; this.toolStrip1.Size = new System.Drawing.Size(633, 25); @@ -198,6 +204,12 @@ namespace ShiftOS.WinForms.Applications this.tsuserdata.Size = new System.Drawing.Size(86, 22); this.tsuserdata.Text = "toolStripLabel1"; // + // lbtyping + // + this.lbtyping.Name = "lbtyping"; + this.lbtyping.Size = new System.Drawing.Size(86, 22); + this.lbtyping.Text = "toolStripLabel1"; + // // tsbottombar // this.tsbottombar.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -227,6 +239,21 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25); + // + // btnsendfile + // + this.btnsendfile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; + this.btnsendfile.Image = ((System.Drawing.Image)(resources.GetObject("btnsendfile.Image"))); + this.btnsendfile.ImageTransparentColor = System.Drawing.Color.Magenta; + this.btnsendfile.Name = "btnsendfile"; + this.btnsendfile.Size = new System.Drawing.Size(65, 22); + this.btnsendfile.Text = "Send a file"; + this.btnsendfile.Click += new System.EventHandler(this.btnsendfile_Click); + // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -265,5 +292,8 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; private System.Windows.Forms.TextBox txtchatid; private System.Windows.Forms.Button btnjoin; + private System.Windows.Forms.ToolStripLabel lbtyping; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripButton btnsendfile; } } diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index 2abf5eb..5be7b0c 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -49,6 +49,41 @@ namespace ShiftOS.WinForms.Applications InitializeComponent(); } + public event Action<ShiftOS.Objects.ShiftFS.File> FileSent; + + public string Typing + { + get + { + return lbtyping.Text; + } + set + { + this.Invoke(new Action(() => + { + if (string.IsNullOrWhiteSpace(value)) + { + lbtyping.Visible = false; + } + else + { + lbtyping.Text = value + " is typing..."; + lbtyping.Visible = true; + } + })); + } + } + + public void ShowChat() + { + this.Invoke(new Action(() => + { + pnlstart.Hide(); + rtbchat.Show(); + rtbchat.BringToFront(); + })); + } + public void OnLoad() { AllInstances.Add(this); @@ -86,7 +121,7 @@ namespace ShiftOS.WinForms.Applications private void txtuserinput_KeyDown(object sender, KeyEventArgs e) { - if(e.KeyCode == Keys.Enter) + if (e.KeyCode == Keys.Enter) { e.SuppressKeyPress = true; @@ -108,7 +143,7 @@ namespace ShiftOS.WinForms.Applications public static void SendMessage(string user, string destination, string msg) { - foreach(var chat in AllInstances) + foreach (var chat in AllInstances) { chat.PostMessage(user, destination, msg); } @@ -138,62 +173,14 @@ namespace ShiftOS.WinForms.Applications txtuserinput.Text = ""; } - [Story("story_thefennfamily")] - public static void Story_TheFennFamily() + private void btnsendfile_Click(object sender, EventArgs e) { - bool complete = false; - Infobox.Show("SimpleSRC", "A direct message has been sent to you on SimpleSRC from user \"maureenfenn@trisys\".", () => + FileSkimmerBackend.GetFile(new[] { "" }, FileOpenerStyle.Open, (file) => { - string ch = "maureenfenn@trisys"; - var c = new Chat(); - c.ChatID = ch; - AppearanceManager.SetupWindow(c); - string you = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}"; - - var t = new Thread(() => - { - SendMessage(you, ch, "User has joined the chat."); - Thread.Sleep(2000); - SendMessage(ch, ch, "Hello, " + you + ". My name is Maureen. Maureen Fenn."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I am the author of the various Tri applications you may see on Appscape."); - Thread.Sleep(2000); - SendMessage(ch, ch, "I need your help with something..."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Firstly, a little backstory. There was a time in ShiftOS when none of us were connected."); - Thread.Sleep(2500); - SendMessage(ch, ch, "There wasn't a Digital Society, we didn't have chat applications or anything..."); - Thread.Sleep(2000); - SendMessage(ch, ch, "All we had was the Shiftnet."); - Thread.Sleep(2500); - SendMessage(ch, ch, "However, in 2016, something happened called the \"connected revolution\". It was like, the invention of the Internet - it was huge for the world of ShiftOS."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Before this, the only way you could earn Codepoints was through playing games in ShiftOS."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I was the one who coded those games, and I would put them on a Shiftnet website that you can still access today, shiftnet/main/shiftgames."); - Thread.Sleep(2500); - SendMessage(ch, ch, "But when the Connected Revolution took place, things got difficult. My son, Nalyr Fenn, was born, and people stopped using my software and instead moved on to hacking eachother and stealing peoples' Codepoints."); - Thread.Sleep(2500); - SendMessage(ch, ch, "When Nalyr's sentience levels reached near human - i.e, he grew up, we decided to start TriOffice. It was a huge success, thanks to Aiden Nirh, the guy who runs Appscape."); - Thread.Sleep(2500); - SendMessage(ch, ch, "However... a few months ago he cut contact with us and we stopped receiving Codepoints from TriOffice."); - Thread.Sleep(2500); - SendMessage(ch, ch, "I'm running low - I can't afford to keep my system running much longer. You have to help!"); - Thread.Sleep(2500); - SendMessage(ch, ch, "Perhaps, you could breach Aiden's server and look for clues as to why he's against us? I'll reward you with the last Codepoints I have."); - Thread.Sleep(2500); - SendMessage(you, ch, "Alright, I'm in - but I don't know where to begin..."); - Thread.Sleep(2500); - SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server."); - Thread.Sleep(2500); - SendMessage(ch, ch, "Good luck... My life depends on you!"); - complete = true; - }); - t.IsBackground = true; - t.Start(); + var finf = ShiftOS.Objects.ShiftFS.Utils.GetFileInfo(file); + PostMessage($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}", ChatID, "<user sent a file: " + finf.Name + ">"); + FileSent?.Invoke(finf); }); - while (!complete) - Thread.Sleep(10); } } } diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index e4a35ad..1787168 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -120,16 +120,25 @@ <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> + <data name="btnsendfile.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> <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>122, 17</value> </metadata> - <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 |
