From d0d193bb1b869697d633d7ccac35179241f8e981 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 6 May 2017 19:24:57 -0400 Subject: GUI-based login screen with skinning! --- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 1607ae9..411d701 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -323,6 +323,12 @@ DownloadControl.cs + + Form + + + GUILogin.cs + @@ -520,6 +526,9 @@ DownloadControl.cs + + GUILogin.cs + Oobe.cs -- cgit v1.2.3 From bded9d1250575e6b9824be9048ac7ac8669a303b Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 May 2017 19:17:47 -0400 Subject: ShiftOS is a hydra. You pop one bug off, 2,000 more grow in its place. --- ShiftOS.WinForms/Applications/About.Designer.cs | 10 +- ShiftOS.WinForms/Applications/About.cs | 71 +++++- ShiftOS.WinForms/AudioManager.cs | 62 +++++ ShiftOS.WinForms/Program.cs | 13 ++ ShiftOS.WinForms/Properties/Resources.Designer.cs | 110 ++++++++- ShiftOS.WinForms/Properties/Resources.resx | 39 +++- ShiftOS.WinForms/Resources/Ambient1.mp3 | Bin 0 -> 5765139 bytes ShiftOS.WinForms/Resources/Ambient2.mp3 | Bin 0 -> 5017165 bytes ShiftOS.WinForms/Resources/Ambient3.mp3 | Bin 0 -> 6948747 bytes ShiftOS.WinForms/Resources/Ambient4.mp3 | Bin 0 -> 6121813 bytes ShiftOS.WinForms/Resources/Ambient5.mp3 | Bin 0 -> 6025921 bytes ShiftOS.WinForms/Resources/Ambient6.mp3 | Bin 0 -> 5303077 bytes ShiftOS.WinForms/Resources/Ambient7.mp3 | Bin 0 -> 8237719 bytes ShiftOS.WinForms/Resources/Ambient8.mp3 | Bin 0 -> 8077862 bytes ShiftOS.WinForms/Resources/Ambient9.mp3 | Bin 0 -> 3859193 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS_TheReturn/AppearanceManager.cs | 2 +- ShiftOS_TheReturn/AudioManager.cs | 9 +- ShiftOS_TheReturn/Commands.cs | 1 - ShiftOS_TheReturn/SaveSystem.cs | 15 ++ ShiftOS_TheReturn/TerminalBackend.cs | 269 +++++++++++----------- 21 files changed, 435 insertions(+), 175 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/Ambient1.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient2.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient3.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient4.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient5.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient6.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient7.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient8.mp3 create mode 100644 ShiftOS.WinForms/Resources/Ambient9.mp3 (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/About.Designer.cs b/ShiftOS.WinForms/Applications/About.Designer.cs index ab76eab..989d79b 100644 --- a/ShiftOS.WinForms/Applications/About.Designer.cs +++ b/ShiftOS.WinForms/Applications/About.Designer.cs @@ -55,7 +55,7 @@ namespace ShiftOS.WinForms.Applications this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.label1 = new System.Windows.Forms.Label(); this.lbshiftit = new System.Windows.Forms.Label(); - this.lbaboutdesc = new System.Windows.Forms.Label(); + this.lbaboutdesc = new System.Windows.Forms.TextBox(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -94,11 +94,11 @@ namespace ShiftOS.WinForms.Applications this.lbaboutdesc.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.lbaboutdesc.Location = new System.Drawing.Point(14, 126); + this.lbaboutdesc.Location = new System.Drawing.Point(23, 158); + this.lbaboutdesc.Multiline = true; this.lbaboutdesc.Name = "lbaboutdesc"; - this.lbaboutdesc.Size = new System.Drawing.Size(498, 328); + this.lbaboutdesc.Size = new System.Drawing.Size(492, 302); this.lbaboutdesc.TabIndex = 3; - this.lbaboutdesc.Text = "label2"; // // About // @@ -121,6 +121,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lbshiftit; - private System.Windows.Forms.Label lbaboutdesc; + private System.Windows.Forms.TextBox lbaboutdesc; } } diff --git a/ShiftOS.WinForms/Applications/About.cs b/ShiftOS.WinForms/Applications/About.cs index f91e0cc..a27238d 100644 --- a/ShiftOS.WinForms/Applications/About.cs +++ b/ShiftOS.WinForms/Applications/About.cs @@ -53,18 +53,73 @@ namespace ShiftOS.WinForms.Applications lbaboutdesc.Text = $@"ShiftOS Copyright (c) 2015-{DateTime.Now.Year} Michael VanOverbeek and ShiftOS devs -Engine version: Milestone 3, 1.0 Beta Series (Developer mode ON) -Frontend version: 1.0 Beta 1.2 -Multi-user domain version: 1.0 Rolling-Release - -Music courtesy of Selulance. Listen to the Fractal Forest album here: -https://www.youtube.com/watch?v=LB5jAYDL3VU&t=913s +Engine version: Milestone 4, 1.0 Beta Series (Developer mode ON) +Frontend version: 1.0 Beta 2.5 +Digital Society version: 1.0 Rolling-Release +Project: Unite version: 1.0 Beta 1.7 Special thanks to Philip Adams, the original creator of ShiftOS for helping us grow our community of amazing Shifters by featuring us on the YouTube Millionaire series and advertising us throughout various other series ran by him. Also, thanks to Rylan Arbour, Victor Tran and the other community moderators and administrators for helping us keep the community peaceful. -Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game!"; +Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game! + + === Licensing information + +ShiftOS is licensed under the MIT license. + +Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the ""Software""), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and / or sell +copies of the Software, and to permit persons to whom the Software is + +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + == Credit where credit is due + + -- Development and staff team: + - Rylan Arbour (Lead community administrator) + - Victor Tran (Discord administrator) + - cjhannah (ShiftFS backend developer) + - AShifter (Project: Unite penetration tester) + - arencllc (ShiftLetters developer) + - Michael VanOverbeek (Lead developer, system administrator, the guy who wrote this text) + - fixylol, Nebble, TravisNC, Neptune (Community moderators) + - bandic00t_ (Skin Engine stresstesting) + + -- System audio + + - Default system event sounds (Infobox, Network Connecting, System Beeps) are from the original ShiftOS 0.0.x source code. + - Ambient music list courtesy of https://www.youtube.com/channel/UC56Qctnsu8wAyvzf4Yx6LIw (ArgoFox | Royalty Free Music) + +Tracklist: + + Dylan Hardy - Strangely Unaffected +Noxive - Home +Dylan Hardy and Abraham Alberto - Slow Drift +A Himitsu - Easier To Fade +Noxive - Resilience +Wanderflux - Visions +Aerocity - Cold Weather Kids +Aether - Wanderlust +Aerocity - Love Lost + + +Finally, special thanks to our Patreon supporters. Without you guys, our servers wouldn't be running, and you wouldn't be reading this."; } public string GetEngineVersion() @@ -107,7 +162,7 @@ Lastly, a huge special thanks to the community themselves - for testing, debuggi public bool OnUnload() { - return false; + return true; } public void OnUpgrade() diff --git a/ShiftOS.WinForms/AudioManager.cs b/ShiftOS.WinForms/AudioManager.cs index 5c43ac4..eb0e798 100644 --- a/ShiftOS.WinForms/AudioManager.cs +++ b/ShiftOS.WinForms/AudioManager.cs @@ -24,8 +24,10 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using System.Text; +using System.Threading; using System.Threading.Tasks; namespace ShiftOS.WinForms @@ -37,5 +39,65 @@ namespace ShiftOS.WinForms { } + + internal static byte[] GetRandomSong() + { + var r = new Random().Next(1, 10); + switch (r) + { + case 1: + return Properties.Resources.Ambient1; + case 2: + return Properties.Resources.Ambient2; + case 3: + return Properties.Resources.Ambient3; + case 4: + return Properties.Resources.Ambient4; + case 5: + return Properties.Resources.Ambient5; + case 6: + return Properties.Resources.Ambient6; + case 7: + return Properties.Resources.Ambient7; + case 8: + return Properties.Resources.Ambient8; + default: + return Properties.Resources.Ambient9; + + } + } + + internal static void StartAmbientLoop() + { + var athread = new Thread(() => + { + MemoryStream str = null; + NAudio.Wave.Mp3FileReader mp3 = null; + NAudio.Wave.WaveOut o = null; + while (!Engine.SaveSystem.ShuttingDown) + { + str = new MemoryStream(GetRandomSong()); + mp3 = new NAudio.Wave.Mp3FileReader(str); + o = new NAudio.Wave.WaveOut(); + o.Init(mp3); + bool c = false; + o.Play(); + o.PlaybackStopped += (s, a) => + { + c = true; + }; + while (!c) + Thread.Sleep(10); + str.Dispose(); + o.Dispose(); + mp3.Dispose(); + } + str?.Dispose(); + o?.Dispose(); + mp3?.Dispose(); + }); + athread.IsBackground = true; + athread.Start(); + } } } diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index ad8fc83..256894d 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -49,6 +49,19 @@ namespace ShiftOS.WinForms Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //if ANYONE puts code before those two winforms config lines they will be declared a drunky. - Michael + SaveSystem.PreDigitalSocietyConnection += () => + { + Action completed = null; + completed = () => + { + SaveSystem.Ready = true; + Engine.AudioManager.PlayCompleted -= completed; + AudioManager.StartAmbientLoop(); + }; + Engine.AudioManager.PlayCompleted += completed; + Engine.AudioManager.PlayStream(Properties.Resources.dial_up_modem_02); + + }; LoginManager.Init(new GUILoginFrontend()); CrashHandler.SetGameMetadata(Assembly.GetExecutingAssembly()); SkinEngine.SetIconProber(new ShiftOSIconProvider()); diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index caaf503..0152be8 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -69,6 +69,96 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient1 { + get { + object obj = ResourceManager.GetObject("Ambient1", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient2 { + get { + object obj = ResourceManager.GetObject("Ambient2", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient3 { + get { + object obj = ResourceManager.GetObject("Ambient3", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient4 { + get { + object obj = ResourceManager.GetObject("Ambient4", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient5 { + get { + object obj = ResourceManager.GetObject("Ambient5", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient6 { + get { + object obj = ResourceManager.GetObject("Ambient6", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient7 { + get { + object obj = ResourceManager.GetObject("Ambient7", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient8 { + get { + object obj = ResourceManager.GetObject("Ambient8", resourceCulture); + return ((byte[])(obj)); + } + } + + /// + /// Looks up a localized resource of type System.Byte[]. + /// + internal static byte[] Ambient9 { + get { + object obj = ResourceManager.GetObject("Ambient9", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -994,22 +1084,18 @@ namespace ShiftOS.WinForms.Properties { /// /// Looks up a localized string similar to [ - /// //TEMPORARY - /// { - /// Name: "Desktop Widgets", - /// Cost: 0, - /// Description: "Temporary upgrade. Will be replaced by either a Shiftnet app or a story element.", - /// Dependencies: "advanced_app_launcher;wm_free_placement", - /// Category: "Work-in-progress" - /// }, - /// - /// - /// ///// SCREENSAVER /// { /// Name: "Screensavers", /// Cost: 750, - /// Description: "Like to leave your PC idle for long periods of time? Save some energy and keep your screen from being tired by hiding the desktop behind a black screen with an image on it." [rest of string was truncated]";. + /// Description: "Like to leave your PC idle for long periods of time? Save some energy and keep your screen from being tired by hiding the desktop behind a black screen with an image on it.", + /// Dependencies: "desktop", + /// Category: "Enhancements", + /// }, + /// { + /// Name: "GUI Based Login Screen", + /// Cost: 500, + /// Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [rest of string was truncated]";. /// internal static string Shiftorium { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 688bcac..a90e69b 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -122,7 +122,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAkqMAAJKjAACSowAAAAEAAQoPAgAAAJKjAAACUklGRoqjAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWajAAABAP7/AgD9/wMA/f8DAPz/BAD8/wQA/f8BAP//AAABAAAA//8C AP3/BAD9/wIAAAD//wIA//8BAAAAAAABAP//AQAAAAEAAAACAP7/AQABAAAAAQAAAAEAAAACAP7/AwD+ /wIAAAD//wIA/v8DAP7/AwD9/wMA//8AAAIA/f8DAAAA//8BAAAA/v8CAP////8CAPz/BAD8/wMA/f8A @@ -838,7 +838,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAATBgAAEwYAABMGAAAAAEAAQoPAgAAAEwYAAACUklGRkQYAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YSAYAAD/X5Vil2TRZUJmF2ZLZadjS2FqXt9aj1awUVtMc0b4PyQ57DFS KmUiSxoDEo4JEQGO+Bzwweee35zX9c+pyK7BGLsYtZqvlqoipneiW5/YnBCbFZq3mfOZEJvknD6fSqIg poaqcK/rtAq7i8FvyMrPgNdo347n7e9h+N8AXwnPERoaQSIlKrcx+zjmP0lGKUykUYJWs1pKXlJhpWMl @@ -964,7 +964,7 @@ ..\Resources\SweeperNormalFace.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + ..\Resources\strings_en.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;iso-8859-1 ..\Resources\SweeperTile5.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a @@ -974,7 +974,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA/AEeAPwBHgD8AR4AAAEAAQoPAgAAAPwBHgACUklGRvQBHgBXQVZFZm10IBAAAAAB AAIAgLsAAADuAgAEABAATElTVBQAAABJTkZPSUFSVAgAAABQaGlsaXAAAGRhdGG0AR4A//8CAAwA5v8a APT/8P8sAMf/OADX/xoA5v8bAPL/8/8aAOb/DQAOANb/KgDk/w4AAQDh/zwAt/9HAMj/GwACAPH/DgDy /w0AAQDy/xwA1f8sAO//5v84ALn/OQDk//7/AwD+/xAA4v8dANX/LADw//T/GgDl/w4AAADx/x4A4f8R @@ -33831,7 +33831,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAA8FYAAPBWAADwVgAAAAEAAQoPAgAAAPBWAAACUklGRuhWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YcRWAAAAAGQL6gtkDL8MEA3kDLUMaAwUDKULKwuYCvcJQAl4CJ0Hrwaw BaAEfgNQAg4Bwf9p/v/8mfsn+rD4OPe59T/0wPJH8dPvYu7+7JzrTeoG6dLnreaX5Z/kruPl4jHinOEk 4cTgh+Bl4GLgguDC4B7hpeFC4g3j7uP35B/mZufO6FXq9eu67ZHviPGT87L15/cr+oL84f5QAcMDPwa9 @@ -34456,7 +34456,7 @@ AAEAAAD/////AQAAAAAAAAAEAQAAABZTeXN0ZW0uSU8uTWVtb3J5U3RyZWFtCgAAAAdfYnVmZmVyB19v cmlnaW4JX3Bvc2l0aW9uB19sZW5ndGgJX2NhcGFjaXR5C19leHBhbmRhYmxlCV93cml0YWJsZQpfZXhw b3NhYmxlB19pc09wZW4dTWFyc2hhbEJ5UmVmT2JqZWN0K19faWRlbnRpdHkHAAAAAAAAAAACAggICAgB - AQEBCQIAAAAAAAAAAAAAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB + AQEBCQIAAAAAAAAAjBYAAIwWAACMFgAAAAEAAQoPAgAAAIwWAAACUklGRoQWAABXQVZFZm10IBAAAAAB AAEARKwAAIhYAQACABAAZGF0YWAWAAAAAKYLIxdYIhQtQjexQFBJ81CUVwddTmFLZP9lXmZqZSRjl1/J WtFUu02mRao84jJzKHsdJRKPBub6TO/q4+XYZM6FxG67ObMCrOel8aA9ncuar5nimWybQZ5eoq+nKa6t tTC+hcec0U3cbefr8on+MQq6FfQgxSsFNo8/R0gRUMpWblzSYAFk2WVlZpxlfmMbYHJboVWsTrdG1D0l @@ -34573,4 +34573,31 @@ ..\Resources\SuperDesk screenshot.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Ambient1.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient2.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient3.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient4.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient5.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient6.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient7.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient8.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Ambient1.mp3 b/ShiftOS.WinForms/Resources/Ambient1.mp3 new file mode 100644 index 0000000..d623b29 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient1.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient2.mp3 b/ShiftOS.WinForms/Resources/Ambient2.mp3 new file mode 100644 index 0000000..b16e72f Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient2.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient3.mp3 b/ShiftOS.WinForms/Resources/Ambient3.mp3 new file mode 100644 index 0000000..cf06069 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient3.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient4.mp3 b/ShiftOS.WinForms/Resources/Ambient4.mp3 new file mode 100644 index 0000000..7813b4f Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient4.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient5.mp3 b/ShiftOS.WinForms/Resources/Ambient5.mp3 new file mode 100644 index 0000000..521330e Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient5.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient6.mp3 b/ShiftOS.WinForms/Resources/Ambient6.mp3 new file mode 100644 index 0000000..86cb4a4 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient6.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient7.mp3 b/ShiftOS.WinForms/Resources/Ambient7.mp3 new file mode 100644 index 0000000..9c5047a Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient7.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient8.mp3 b/ShiftOS.WinForms/Resources/Ambient8.mp3 new file mode 100644 index 0000000..ac908b6 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient8.mp3 differ diff --git a/ShiftOS.WinForms/Resources/Ambient9.mp3 b/ShiftOS.WinForms/Resources/Ambient9.mp3 new file mode 100644 index 0000000..46cb670 Binary files /dev/null and b/ShiftOS.WinForms/Resources/Ambient9.mp3 differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 411d701..1079203 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -757,6 +757,15 @@ + + + + + + + + + diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 4c1754e..42642f8 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -223,9 +223,9 @@ namespace ShiftOS.Engine /// internal static void Exit() { - OnExit?.Invoke(); //disconnect from MUD ServerManager.Disconnect(); + Environment.Exit(0); } /// diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index a636497..c50bd24 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -47,9 +47,12 @@ namespace ShiftOS.Engine /// public static void Stop() { - _out?.Stop(); - _reader?.Dispose(); - _out?.Dispose(); + Desktop.InvokeOnWorkerThread(() => + { + _out?.Stop(); + _reader?.Dispose(); + _out?.Dispose(); + }); } /// diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index dc0b3a2..d622bb9 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -366,7 +366,6 @@ namespace ShiftOS.Engine public static bool Shutdown() { TerminalBackend.InvokeCommand("sos.save"); - SaveSystem.ShuttingDown = true; AppearanceManager.Exit(); return true; } diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 31db58a..948f95e 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -52,6 +52,9 @@ namespace ShiftOS.Engine public static ClientSave CurrentUser { get; set; } + public static bool Ready = false; + + public static event Action PreDigitalSocietyConnection; public static Save CurrentSave { get; set; } @@ -118,6 +121,18 @@ namespace ShiftOS.Engine Console.WriteLine("[inetd] Connecting to network..."); + Ready = false; + + if (PreDigitalSocietyConnection != null) + { + PreDigitalSocietyConnection?.Invoke(); + + while (!Ready) + { + Thread.Sleep(10); + } + } + if (defaultConf.ConnectToMud == true) { bool guidReceived = false; diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index 9c57aa8..086ff40 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -213,211 +213,201 @@ namespace ShiftOS.Engine { if (Shiftorium.UpgradeAttributesUnlocked(method)) { - if (CanRunRemotely(method, isRemote)) + foreach (var ma in method.GetCustomAttributes(false)) { - foreach (var ma in method.GetCustomAttributes(false)) + if (ma is Command) { - if (ma is Command) + var cmd = ma as Command; + if (text.Split('.')[1] == cmd.name) { - var cmd = ma as Command; - if (text.Split('.')[1] == cmd.name) + if (KernelWatchdog.IsSafe(method)) { - if (KernelWatchdog.IsSafe(method)) + if (KernelWatchdog.CanRunOffline(method)) { - if (KernelWatchdog.CanRunOffline(method)) - { - var attr = method.GetCustomAttribute(); + var attr = method.GetCustomAttribute(); - if (attr != null) + if (attr != null) + { + string newcommand = attr.newcommand; + if (attr.warn) { - string newcommand = attr.newcommand; - if (attr.warn) - { - Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { + Console.WriteLine(Localization.Parse((newcommand == "" ? "{ERROR}" : "{WARN}") + attr.reason, new Dictionary() { {"%newcommand", newcommand} })); - } - if (newcommand != "") - { - // redo the entire process running newcommand + } + if (newcommand != "") + { + // redo the entire process running newcommand - return RunClient(newcommand, args); - } + return RunClient(newcommand, args); } + } - var requiresArgs = method.GetCustomAttributes(); - bool error = false; - bool providedusage = false; + var requiresArgs = method.GetCustomAttributes(); + bool error = false; + bool providedusage = false; - foreach (RequiresArgument argument in requiresArgs) + foreach (RequiresArgument argument in requiresArgs) + { + if (!args.ContainsKey(argument.argument)) { - if (!args.ContainsKey(argument.argument)) - { - if (!providedusage) - { - string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; - if (usageparse == Localization.Parse(usageparse)) - usageparse = ""; - else - usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { + if (!providedusage) + { + string usageparse = "{COMMAND_" + ns.name.ToUpper() + "_" + cmd.name.ToUpper() + "_USAGE}"; + if (usageparse == Localization.Parse(usageparse)) + usageparse = ""; + else + usageparse = Shiftorium.UpgradeInstalled("help_usage") ? Localization.Parse("{ERROR}{USAGE}" + usageparse, new Dictionary() { {"%ns", ns.name}, {"%cmd", cmd.name} }) : ""; - Console.WriteLine(usageparse); + Console.WriteLine(usageparse); - providedusage = true; - } - if (Shiftorium.UpgradeInstalled("help_usage")) - { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { + providedusage = true; + } + if (Shiftorium.UpgradeInstalled("help_usage")) + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED}", new Dictionary() { {"%argument", argument.argument} })); - } - else - { - Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); - } - - error = true; } - } + else + { + Console.WriteLine(Localization.Parse("{ERROR_ARGUMENT_REQUIRED_NO_USAGE}")); + } - if (error) - { - throw new Exception("{ERROR_COMMAND_WRONG}"); + error = true; } + } - try - { - return (bool)method.Invoke(null, new[] { args }); - } - catch (TargetInvocationException e) - { - Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); - Console.WriteLine(e.InnerException.Message); - Console.WriteLine(e.InnerException.StackTrace); - return true; - } - catch - { - return (bool)method.Invoke(null, new object[] { }); - } + if (error) + { + throw new Exception("{ERROR_COMMAND_WRONG}"); + } + + try + { + return (bool)method.Invoke(null, new[] { args }); } - else + catch (TargetInvocationException e) { - Console.Write("<"); - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("session_mgr"); - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - ConsoleEx.Bold = false; - Console.Write(">"); - ConsoleEx.Italic = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + Console.WriteLine(Localization.Parse("{ERROR_EXCEPTION_THROWN_IN_METHOD}")); + Console.WriteLine(e.InnerException.Message); + Console.WriteLine(e.InnerException.StackTrace); return true; - + } + catch + { + return (bool)method.Invoke(null, new object[] { }); } } else { - if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) - { - Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => - { - if (pass == SaveSystem.CurrentUser.Password) - { - KernelWatchdog.EnterKernelMode(); - RunClient(text, args, isRemote); - KernelWatchdog.LeaveKernelMode(); - } - else - { - Infobox.Show("Access denied.", "You did not type in the correct password."); - } - }, true); - return true; - } Console.Write("<"); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("watchdog"); + Console.Write("session_mgr"); ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; ConsoleEx.Bold = false; Console.Write(">"); ConsoleEx.Italic = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); - KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + return true; + + } + } + else + { + if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) + { + Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => + { + if (pass == SaveSystem.CurrentUser.Password) + { + KernelWatchdog.EnterKernelMode(); + RunClient(text, args, isRemote); + KernelWatchdog.LeaveKernelMode(); + } + else + { + Infobox.Show("Access denied.", "You did not type in the correct password."); + } + }, true); return true; } + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("watchdog"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); + KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); + return true; } } + } - } } } + else { - Console.WriteLine(text + " cannot be ran in a remote session"); + Console.Write("<"); + ConsoleEx.Bold = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; + Console.Write("session_mgr"); + ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; + ConsoleEx.Bold = false; + Console.Write(">"); + ConsoleEx.Italic = true; + ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; + Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); return true; - } - } - - } + } + } + } else { + if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) + { + Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => + { + if (pass == SaveSystem.CurrentUser.Password) + { + KernelWatchdog.EnterKernelMode(); + RunClient(text, args, isRemote); + KernelWatchdog.LeaveKernelMode(); + } + else + { + Infobox.Show("Access denied.", "You did not type in the correct password."); + } + }, true); + return true; + } Console.Write("<"); ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("session_mgr"); + Console.Write("watchdog"); ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; ConsoleEx.Bold = false; Console.Write(">"); ConsoleEx.Italic = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command while disconnected from the multi-user domain.."); + Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); + KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); return true; - } - - } - else - { - if (SaveSystem.CurrentUser.Permissions == Objects.UserPermissions.Admin) - { - Infobox.PromptText("Elevate to root mode", "This command cannot be run as a regular user. To run this command, please enter your password to elevate to root mode temporarily.", (pass) => - { - if (pass == SaveSystem.CurrentUser.Password) - { - KernelWatchdog.EnterKernelMode(); - RunClient(text, args, isRemote); - KernelWatchdog.LeaveKernelMode(); - } - else - { - Infobox.Show("Access denied.", "You did not type in the correct password."); - } - }, true); - return true; - } - Console.Write("<"); - ConsoleEx.Bold = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkRed; - Console.Write("watchdog"); - ConsoleEx.ForegroundColor = SkinEngine.LoadedSkin.TerminalForeColorCC; - ConsoleEx.Bold = false; - Console.Write(">"); - ConsoleEx.Italic = true; - ConsoleEx.ForegroundColor = ConsoleColor.DarkYellow; - Console.WriteLine(" You cannot run this command. You do not have permission. Incident reported."); - KernelWatchdog.Log("potential_sys_breach", "user attempted to run kernel mode command " + text + " - watchdog has prevented this, good sir."); - return true; } } } @@ -429,6 +419,7 @@ namespace ShiftOS.Engine } return false; } + public static void PrintPrompt() { if (SaveSystem.CurrentSave != null && CurrentUser != null) -- cgit v1.2.3 From b1cace7807f28deff51f06665d544a4246879a82 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 13 May 2017 15:51:19 -0400 Subject: Newer notification system (PANEL ICONS :D) --- ShiftOS.WinForms/Properties/Resources.Designer.cs | 10 ++ ShiftOS.WinForms/Properties/Resources.resx | 3 + .../Resources/notestate_connection_full.bmp | Bin 0 -> 3382 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/WinformsDesktop.Designer.cs | 130 ++++++++++++++++----- ShiftOS.WinForms/WinformsDesktop.cs | 78 ++++++++----- ShiftOS.WinForms/WinformsDesktop.resx | 3 + ShiftOS_TheReturn/AppearanceManager.cs | 5 +- ShiftOS_TheReturn/Desktop.cs | 17 ++- ShiftOS_TheReturn/ServerManager.cs | 1 + ShiftOS_TheReturn/Skinning.cs | 8 ++ 11 files changed, 200 insertions(+), 56 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/notestate_connection_full.bmp (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 0152be8..3e83c3f 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -1048,6 +1048,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap notestate_connection_full { + get { + object obj = ResourceManager.GetObject("notestate_connection_full", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index a90e69b..1db7a46 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -34600,4 +34600,7 @@ ..\Resources\Ambient9.mp3;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/notestate_connection_full.bmp b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp new file mode 100644 index 0000000..a4e15b3 Binary files /dev/null and b/ShiftOS.WinForms/Resources/notestate_connection_full.bmp differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 1079203..89da4e1 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -771,6 +771,7 @@ + diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 71ef161..968a31c 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -53,15 +53,20 @@ namespace ShiftOS.WinForms private void InitializeComponent() { this.desktoppanel = new System.Windows.Forms.Panel(); - this.btnnotifications = new System.Windows.Forms.Button(); + this.pnlnotifications = new System.Windows.Forms.Panel(); + this.flnotifications = new System.Windows.Forms.FlowLayoutPanel(); this.lbtime = new System.Windows.Forms.Label(); this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel(); this.sysmenuholder = new System.Windows.Forms.Panel(); this.menuStrip1 = new System.Windows.Forms.MenuStrip(); this.apps = new System.Windows.Forms.ToolStripMenuItem(); this.pnlscreensaver = new System.Windows.Forms.Panel(); - this.pnlwidgetlayer = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); + this.pnlwidgetlayer = new System.Windows.Forms.Panel(); + this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); + this.pnlnotificationbox = new System.Windows.Forms.Panel(); + this.lbnotemsg = new System.Windows.Forms.Label(); + this.lbnotetitle = new System.Windows.Forms.Label(); this.pnladvancedal = new System.Windows.Forms.Panel(); this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); @@ -70,9 +75,13 @@ namespace ShiftOS.WinForms this.pnlstatus = new System.Windows.Forms.Panel(); this.lbalstatus = new System.Windows.Forms.Label(); this.desktoppanel.SuspendLayout(); + this.pnlnotifications.SuspendLayout(); + this.flnotifications.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); + this.pnlnotificationbox.SuspendLayout(); this.pnladvancedal.SuspendLayout(); this.pnlalsystemactions.SuspendLayout(); this.pnlstatus.SuspendLayout(); @@ -81,8 +90,7 @@ namespace ShiftOS.WinForms // desktoppanel // this.desktoppanel.BackColor = System.Drawing.Color.Green; - this.desktoppanel.Controls.Add(this.btnnotifications); - this.desktoppanel.Controls.Add(this.lbtime); + this.desktoppanel.Controls.Add(this.pnlnotifications); this.desktoppanel.Controls.Add(this.panelbuttonholder); this.desktoppanel.Controls.Add(this.sysmenuholder); this.desktoppanel.Dock = System.Windows.Forms.DockStyle.Top; @@ -92,28 +100,34 @@ namespace ShiftOS.WinForms this.desktoppanel.TabIndex = 0; this.desktoppanel.Paint += new System.Windows.Forms.PaintEventHandler(this.desktoppanel_Paint); // - // btnnotifications - // - this.btnnotifications.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnnotifications.AutoSize = true; - this.btnnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnnotifications.BackColor = System.Drawing.Color.Transparent; - this.btnnotifications.FlatAppearance.BorderSize = 0; - this.btnnotifications.FlatStyle = System.Windows.Forms.FlatStyle.Flat; - this.btnnotifications.Location = new System.Drawing.Point(1066, -2); - this.btnnotifications.Name = "btnnotifications"; - this.btnnotifications.Size = new System.Drawing.Size(136, 24); - this.btnnotifications.TabIndex = 3; - this.btnnotifications.Text = "Notifications (0)"; - this.btnnotifications.UseVisualStyleBackColor = false; - this.btnnotifications.Click += new System.EventHandler(this.btnnotifications_Click); + // pnlnotifications + // + this.pnlnotifications.Controls.Add(this.flnotifications); + this.pnlnotifications.Controls.Add(this.lbtime); + this.pnlnotifications.Cursor = System.Windows.Forms.Cursors.Default; + this.pnlnotifications.Dock = System.Windows.Forms.DockStyle.Right; + this.pnlnotifications.Location = new System.Drawing.Point(1096, 0); + this.pnlnotifications.Name = "pnlnotifications"; + this.pnlnotifications.Size = new System.Drawing.Size(200, 24); + this.pnlnotifications.TabIndex = 3; + // + // flnotifications + // + this.flnotifications.AutoSize = true; + this.flnotifications.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flnotifications.Controls.Add(this.ntconnectionstatus); + this.flnotifications.Dock = System.Windows.Forms.DockStyle.Left; + this.flnotifications.Location = new System.Drawing.Point(0, 0); + this.flnotifications.Name = "flnotifications"; + this.flnotifications.Size = new System.Drawing.Size(22, 24); + this.flnotifications.TabIndex = 1; // // lbtime // this.lbtime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.lbtime.AutoSize = true; - this.lbtime.Location = new System.Drawing.Point(3, 0); + this.lbtime.Location = new System.Drawing.Point(139, 7); this.lbtime.Name = "lbtime"; this.lbtime.Size = new System.Drawing.Size(49, 14); this.lbtime.TabIndex = 0; @@ -170,6 +184,13 @@ namespace ShiftOS.WinForms this.pnlscreensaver.TabIndex = 1; this.pnlscreensaver.Visible = false; // + // pnlssicon + // + this.pnlssicon.Location = new System.Drawing.Point(303, 495); + this.pnlssicon.Name = "pnlssicon"; + this.pnlssicon.Size = new System.Drawing.Size(200, 100); + this.pnlssicon.TabIndex = 0; + // // pnlwidgetlayer // this.pnlwidgetlayer.BackColor = System.Drawing.Color.Transparent; @@ -179,12 +200,53 @@ namespace ShiftOS.WinForms this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); this.pnlwidgetlayer.TabIndex = 1; // - // pnlssicon - // - this.pnlssicon.Location = new System.Drawing.Point(303, 495); - this.pnlssicon.Name = "pnlssicon"; - this.pnlssicon.Size = new System.Drawing.Size(200, 100); - this.pnlssicon.TabIndex = 0; + // ntconnectionstatus + // + this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; + this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); + this.ntconnectionstatus.Name = "ntconnectionstatus"; + this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); + this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.ntconnectionstatus.TabIndex = 0; + this.ntconnectionstatus.TabStop = false; + this.ntconnectionstatus.Tag = "digitalsociety"; + // + // pnlnotificationbox + // + this.pnlnotificationbox.AutoSize = true; + this.pnlnotificationbox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.pnlnotificationbox.Controls.Add(this.lbnotemsg); + this.pnlnotificationbox.Controls.Add(this.lbnotetitle); + this.pnlnotificationbox.Location = new System.Drawing.Point(654, 111); + this.pnlnotificationbox.Name = "pnlnotificationbox"; + this.pnlnotificationbox.Size = new System.Drawing.Size(69, 68); + this.pnlnotificationbox.TabIndex = 0; + this.pnlnotificationbox.Visible = false; + // + // lbnotemsg + // + this.lbnotemsg.AutoSize = true; + this.lbnotemsg.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbnotemsg.Location = new System.Drawing.Point(0, 34); + this.lbnotemsg.MaximumSize = new System.Drawing.Size(350, 0); + this.lbnotemsg.Name = "lbnotemsg"; + this.lbnotemsg.Padding = new System.Windows.Forms.Padding(10); + this.lbnotemsg.Size = new System.Drawing.Size(69, 34); + this.lbnotemsg.TabIndex = 1; + this.lbnotemsg.Text = "label1"; + // + // lbnotetitle + // + this.lbnotetitle.AutoSize = true; + this.lbnotetitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbnotetitle.Location = new System.Drawing.Point(0, 0); + this.lbnotetitle.Margin = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Name = "lbnotetitle"; + this.lbnotetitle.Padding = new System.Windows.Forms.Padding(10); + this.lbnotetitle.Size = new System.Drawing.Size(69, 34); + this.lbnotetitle.TabIndex = 0; + this.lbnotetitle.Tag = "header2"; + this.lbnotetitle.Text = "label1"; // // pnladvancedal // @@ -262,6 +324,7 @@ namespace ShiftOS.WinForms this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Black; this.ClientSize = new System.Drawing.Size(1296, 738); + this.Controls.Add(this.pnlnotificationbox); this.Controls.Add(this.pnlwidgetlayer); this.Controls.Add(this.pnladvancedal); this.Controls.Add(this.pnlscreensaver); @@ -274,16 +337,24 @@ namespace ShiftOS.WinForms this.Load += new System.EventHandler(this.Desktop_Load); this.desktoppanel.ResumeLayout(false); this.desktoppanel.PerformLayout(); + this.pnlnotifications.ResumeLayout(false); + this.pnlnotifications.PerformLayout(); + this.flnotifications.ResumeLayout(false); + this.flnotifications.PerformLayout(); this.sysmenuholder.ResumeLayout(false); this.sysmenuholder.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); + this.pnlnotificationbox.ResumeLayout(false); + this.pnlnotificationbox.PerformLayout(); this.pnladvancedal.ResumeLayout(false); this.pnlalsystemactions.ResumeLayout(false); this.pnlalsystemactions.PerformLayout(); this.pnlstatus.ResumeLayout(false); this.ResumeLayout(false); + this.PerformLayout(); } @@ -295,7 +366,6 @@ namespace ShiftOS.WinForms private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem apps; private System.Windows.Forms.FlowLayoutPanel panelbuttonholder; - private System.Windows.Forms.Button btnnotifications; private System.Windows.Forms.Panel pnlscreensaver; private System.Windows.Forms.Panel pnlssicon; private System.Windows.Forms.Panel pnladvancedal; @@ -306,6 +376,12 @@ namespace ShiftOS.WinForms private System.Windows.Forms.FlowLayoutPanel flapps; private System.Windows.Forms.FlowLayoutPanel flcategories; private System.Windows.Forms.Panel pnlwidgetlayer; + private System.Windows.Forms.Panel pnlnotifications; + private System.Windows.Forms.FlowLayoutPanel flnotifications; + private System.Windows.Forms.Panel pnlnotificationbox; + private System.Windows.Forms.Label lbnotemsg; + private System.Windows.Forms.Label lbnotetitle; + private System.Windows.Forms.PictureBox ntconnectionstatus; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 4efef1b..15ecb7a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -54,6 +54,38 @@ namespace ShiftOS.WinForms private int millisecondsUntilScreensaver = 300000; + public void PushNotification(string app, string title, string msg) + { + lbnotemsg.Text = msg; + lbnotetitle.Text = title; + + var ctl = flnotifications.Controls.ToList().FirstOrDefault(x => x.Tag.ToString() == app); + if (ctl == null) + pnlnotificationbox.Left = desktoppanel.Width - pnlnotificationbox.Width; + else + { + int left = ctl.PointToScreen(ctl.Location).X; + int realleft = left - pnlnotificationbox.Width; + realleft += ctl.Width; + pnlnotificationbox.Left = realleft; + } + + + if (LoadedSkin.DesktopPanelPosition == 0) + pnlnotificationbox.Top = desktoppanel.Height; + else + pnlnotificationbox.Top = this.Height - desktoppanel.Height - pnlnotificationbox.Height; + var notekiller = new System.Windows.Forms.Timer(); + notekiller.Interval = 10000; + notekiller.Tick += (o, a) => + { + pnlnotificationbox.Hide(); + }; + Engine.AudioManager.PlayStream(Properties.Resources.infobox); + pnlnotificationbox.Show(); + notekiller.Start(); + } + /// /// Initializes a new instance of the class. /// @@ -105,24 +137,6 @@ namespace ShiftOS.WinForms }; this.TopMost = false; - NotificationDaemon.NotificationMade += (note) => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - - NotificationDaemon.NotificationRead += () => - { - //Soon this will pop a balloon note. - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); - }; - this.LocationChanged += (o, a) => { if (this.Left != 0) @@ -143,10 +157,6 @@ namespace ShiftOS.WinForms { if (this.Visible == true) this.Invoke(new Action(() => SetupDesktop())); - this.Invoke(new Action(() => - { - btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); - })); }; Shiftorium.Installed += () => { @@ -187,8 +197,10 @@ namespace ShiftOS.WinForms if (SaveSystem.CurrentSave != null && TutorialManager.IsInTutorial == false) { lbtime.Text = Applications.Terminal.GetTime(); - lbtime.Left = desktoppanel.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; + lbtime.Left = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; + + pnlnotifications.Width = flnotifications.Width + lbtime.Width + LoadedSkin.DesktopPanelClockFromRight.X; } } @@ -215,8 +227,6 @@ namespace ShiftOS.WinForms catch { } - btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2; - btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2; }; time.Start(); @@ -372,10 +382,13 @@ namespace ShiftOS.WinForms desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop"); lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget"); - btnnotifications.Visible = Shiftorium.UpgradeInstalled("panel_notifications"); + ControlManager.SetupControls(pnlnotificationbox); //skinning - lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor; + lbtime.BackColor = Color.Transparent; + pnlnotifications.BackgroundImage = GetImage("panelclockbg"); + pnlnotifications.BackgroundImageLayout = GetImageLayout("panelclockbg"); + pnlnotifications.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor; panelbuttonholder.Top = 0; panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft; @@ -1060,4 +1073,15 @@ namespace ShiftOS.WinForms } } } + + public static class ControlCollectionExtensions + { + public static IList ToList(this Control.ControlCollection ctrls) + { + var lst = new List(); + foreach (var ctl in ctrls) + lst.Add(ctl as Control); + return lst; + } + } } \ No newline at end of file diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx index d5494e3..b77504b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.resx +++ b/ShiftOS.WinForms/WinformsDesktop.resx @@ -120,4 +120,7 @@ 17, 17 + + 17, 17 + \ No newline at end of file diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index d8004bc..a10f419 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -226,7 +226,10 @@ namespace ShiftOS.Engine OnExit?.Invoke(); //disconnect from MUD ServerManager.Disconnect(); - Environment.Exit(0); + Desktop.InvokeOnWorkerThread(() => + { + Environment.Exit(0); + }); } /// diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index bc17a8e..a5e7f43 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -102,7 +102,14 @@ namespace ShiftOS.Engine /// Gets the name of the desktop. /// string DesktopName { get; } - + + /// + /// Show a notification on the desktop. + /// + /// An application ID (for determining what system icon to show the notification alongside) + /// The title of the notification. + /// Isn't this.... self explanatory? + void PushNotification(string app, string title, string message); /// /// Performs most of the skinning and layout handling for the desktop. @@ -266,6 +273,14 @@ namespace ShiftOS.Engine { _desktop.HideAppLauncher(); } + + public static void PushNotification(string app, string title, string msg) + { + InvokeOnWorkerThread(() => + { + _desktop.PushNotification(app, title, msg); + }); + } } // sorry i almost killed everything :P } diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 825064b..371d8e7 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -131,6 +131,7 @@ namespace ShiftOS.Engine { if (!UserDisconnect) { + Desktop.PushNotification("digital_society_connection", "Disconnected from Digital Society.", "The ShiftOS kernel has been disconnected from the Digital Society. We are attempting to re-connect you."); TerminalBackend.PrefixEnabled = true; ConsoleEx.ForegroundColor = ConsoleColor.Red; ConsoleEx.Bold = true; diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 548e80f..4340f1a 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -276,6 +276,14 @@ namespace ShiftOS.Engine [ShifterHidden] public Dictionary AppIcons = new Dictionary(); + [Image("panelclockbg")] + [ShifterMeta("Desktop")] + [ShifterCategory("Panel Clock")] + [ShifterName("Panel Clock Background Image")] + [ShifterDescription("Set the background image of the panel clock.")] + [RequiresUpgrade("skinning;shift_panel_clock")] + public byte[] PanelClockBG = null; + [ShifterMeta("System")] [ShifterCategory("Login Screen")] [RequiresUpgrade("gui_based_login_screen")] -- cgit v1.2.3 From 5967c0fc3616fe14656f985e8871489ba03cfd10 Mon Sep 17 00:00:00 2001 From: AShifter Date: Thu, 18 May 2017 19:27:39 -0600 Subject: Start work on TriPresent It's in a basic state right now, and I also fixed a launch bug for people with slightly older ``ShiftOS.mfs`` files (in Localization.cs). --- .../Applications/TriPresent.Designer.cs | 233 +++++++++++++++++++++ ShiftOS.WinForms/Applications/TriPresent.cs | 37 ++++ ShiftOS.WinForms/Applications/TriPresent.resx | 123 +++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS_TheReturn/Localization.cs | 20 +- 5 files changed, 420 insertions(+), 2 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/TriPresent.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/TriPresent.cs create mode 100644 ShiftOS.WinForms/Applications/TriPresent.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs new file mode 100644 index 0000000..1d7f51f --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs @@ -0,0 +1,233 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriPresent + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.menuStrip1 = new System.Windows.Forms.MenuStrip(); + this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.addLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.AddItem = new System.Windows.Forms.Panel(); + this.cancelAdd = new System.Windows.Forms.Button(); + this.placeAdd = new System.Windows.Forms.Button(); + this.yLabel = new System.Windows.Forms.Label(); + this.xLabel = new System.Windows.Forms.Label(); + this.numericUpDown2 = new System.Windows.Forms.NumericUpDown(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.labelContents = new System.Windows.Forms.TextBox(); + this.addItemLabel = new System.Windows.Forms.Label(); + this.menuStrip1.SuspendLayout(); + this.AddItem.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.SuspendLayout(); + // + // menuStrip1 + // + this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.fileToolStripMenuItem, + this.editToolStripMenuItem}); + this.menuStrip1.Location = new System.Drawing.Point(0, 0); + this.menuStrip1.Name = "menuStrip1"; + this.menuStrip1.Size = new System.Drawing.Size(758, 24); + this.menuStrip1.TabIndex = 0; + this.menuStrip1.Text = "menuStrip1"; + // + // fileToolStripMenuItem + // + this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.openToolStripMenuItem, + this.saveToolStripMenuItem}); + this.fileToolStripMenuItem.Name = "fileToolStripMenuItem"; + this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20); + this.fileToolStripMenuItem.Text = "&File"; + // + // openToolStripMenuItem + // + this.openToolStripMenuItem.Name = "openToolStripMenuItem"; + this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.openToolStripMenuItem.Text = "&Open"; + // + // saveToolStripMenuItem + // + this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; + this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.saveToolStripMenuItem.Text = "&Save"; + // + // editToolStripMenuItem + // + this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addToolStripMenuItem}); + this.editToolStripMenuItem.Name = "editToolStripMenuItem"; + this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); + this.editToolStripMenuItem.Text = "&Edit"; + // + // addToolStripMenuItem + // + this.addToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addLabelToolStripMenuItem}); + this.addToolStripMenuItem.Name = "addToolStripMenuItem"; + this.addToolStripMenuItem.Size = new System.Drawing.Size(96, 22); + this.addToolStripMenuItem.Text = "Add"; + // + // addLabelToolStripMenuItem + // + this.addLabelToolStripMenuItem.Name = "addLabelToolStripMenuItem"; + this.addLabelToolStripMenuItem.Size = new System.Drawing.Size(127, 22); + this.addLabelToolStripMenuItem.Text = "Add Label"; + this.addLabelToolStripMenuItem.Click += new System.EventHandler(this.addLabelToolStripMenuItem_Click); + // + // AddItem + // + this.AddItem.Controls.Add(this.cancelAdd); + this.AddItem.Controls.Add(this.placeAdd); + this.AddItem.Controls.Add(this.yLabel); + this.AddItem.Controls.Add(this.xLabel); + this.AddItem.Controls.Add(this.numericUpDown2); + this.AddItem.Controls.Add(this.numericUpDown1); + this.AddItem.Controls.Add(this.labelContents); + this.AddItem.Controls.Add(this.addItemLabel); + this.AddItem.Location = new System.Drawing.Point(260, 152); + this.AddItem.Name = "AddItem"; + this.AddItem.Size = new System.Drawing.Size(244, 187); + this.AddItem.TabIndex = 1; + this.AddItem.Visible = false; + // + // cancelAdd + // + this.cancelAdd.Location = new System.Drawing.Point(121, 164); + this.cancelAdd.Name = "cancelAdd"; + this.cancelAdd.Size = new System.Drawing.Size(123, 23); + this.cancelAdd.TabIndex = 7; + this.cancelAdd.Text = "Cancel"; + this.cancelAdd.UseVisualStyleBackColor = true; + this.cancelAdd.Click += new System.EventHandler(this.button2_Click); + // + // placeAdd + // + this.placeAdd.Location = new System.Drawing.Point(0, 164); + this.placeAdd.Name = "placeAdd"; + this.placeAdd.Size = new System.Drawing.Size(123, 23); + this.placeAdd.TabIndex = 6; + this.placeAdd.Text = "Place"; + this.placeAdd.UseVisualStyleBackColor = true; + // + // yLabel + // + this.yLabel.AutoSize = true; + this.yLabel.Location = new System.Drawing.Point(227, 117); + this.yLabel.Name = "yLabel"; + this.yLabel.Size = new System.Drawing.Size(14, 13); + this.yLabel.TabIndex = 5; + this.yLabel.Text = "Y"; + // + // xLabel + // + this.xLabel.AutoSize = true; + this.xLabel.Location = new System.Drawing.Point(3, 117); + this.xLabel.Name = "xLabel"; + this.xLabel.Size = new System.Drawing.Size(14, 13); + this.xLabel.TabIndex = 4; + this.xLabel.Text = "X"; + // + // numericUpDown2 + // + this.numericUpDown2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.numericUpDown2.Location = new System.Drawing.Point(157, 136); + this.numericUpDown2.Name = "numericUpDown2"; + this.numericUpDown2.Size = new System.Drawing.Size(87, 20); + this.numericUpDown2.TabIndex = 3; + // + // numericUpDown1 + // + this.numericUpDown1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.numericUpDown1.Location = new System.Drawing.Point(3, 136); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(87, 20); + this.numericUpDown1.TabIndex = 2; + // + // labelContents + // + this.labelContents.Location = new System.Drawing.Point(3, 26); + this.labelContents.Multiline = true; + this.labelContents.Name = "labelContents"; + this.labelContents.Size = new System.Drawing.Size(238, 67); + this.labelContents.TabIndex = 1; + this.labelContents.Text = "Text"; + // + // addItemLabel + // + this.addItemLabel.Location = new System.Drawing.Point(0, 0); + this.addItemLabel.Name = "addItemLabel"; + this.addItemLabel.Size = new System.Drawing.Size(244, 23); + this.addItemLabel.TabIndex = 0; + this.addItemLabel.Text = "{ADD_ITEM_LABEL}"; + this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // TriPresent + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.AddItem); + this.Controls.Add(this.menuStrip1); + this.Name = "TriPresent"; + this.Size = new System.Drawing.Size(758, 480); + this.menuStrip1.ResumeLayout(false); + this.menuStrip1.PerformLayout(); + this.AddItem.ResumeLayout(false); + this.AddItem.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.MenuStrip menuStrip1; + private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem addLabelToolStripMenuItem; + private System.Windows.Forms.Panel AddItem; + private System.Windows.Forms.Label addItemLabel; + private System.Windows.Forms.Button cancelAdd; + private System.Windows.Forms.Button placeAdd; + private System.Windows.Forms.Label yLabel; + private System.Windows.Forms.Label xLabel; + private System.Windows.Forms.NumericUpDown numericUpDown2; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.TextBox labelContents; + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs new file mode 100644 index 0000000..ab5db09 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.cs @@ -0,0 +1,37 @@ +using ShiftOS.Objects.ShiftFS; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("tripresent")] + [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 1024, 750, "file_skimmer", "Office")] + [DefaultTitle("TriPresent")] + [Launcher("TriPresent", false, null, "Office")] + public partial class TriPresent : UserControl + { + public TriPresent() + { + InitializeComponent(); + } + + private void addLabelToolStripMenuItem_Click(object sender, EventArgs e) + { + addItemLabel.Text = "Add Label"; + AddItem.Show(); + } + + private void button2_Click(object sender, EventArgs e) + { + AddItem.Hide(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriPresent.resx b/ShiftOS.WinForms/Applications/TriPresent.resx new file mode 100644 index 0000000..d5494e3 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriPresent.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 89da4e1..e372a8b 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -70,6 +70,12 @@ About.cs + + UserControl + + + TriPresent.cs + UserControl @@ -412,6 +418,9 @@ About.cs + + TriPresent.cs + TriWrite.cs diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs index 89d3582..2c701c9 100644 --- a/ShiftOS_TheReturn/Localization.cs +++ b/ShiftOS_TheReturn/Localization.cs @@ -167,8 +167,24 @@ namespace ShiftOS.Engine // if the user has saved then store their username and systemname in these string variables please if (SaveSystem.CurrentSave != null) { - usernameReplace = SaveSystem.CurrentUser.Username; - domainReplace = SaveSystem.CurrentSave.SystemName; + try + { + usernameReplace = SaveSystem.CurrentUser.Username; + } + catch + { + usernameReplace = "user"; + } + + try + { + domainReplace = SaveSystem.CurrentSave.SystemName; + } + catch + { + domainReplace = "system"; + } + } string namespaceReplace = ""; -- cgit v1.2.3 From 64dbc45739f90f6a5e143aef9c3530566b2fc8ce Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 20 May 2017 15:32:39 -0400 Subject: change some story stuff --- ShiftOS.WinForms/Applications/TriSheet.Designer.cs | 65 +++++++++++ ShiftOS.WinForms/Applications/TriSheet.cs | 20 ++++ ShiftOS.WinForms/Applications/TriSheet.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/Oobe.cs | 37 +++---- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ 5 files changed, 231 insertions(+), 20 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/TriSheet.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/TriSheet.cs create mode 100644 ShiftOS.WinForms/Applications/TriSheet.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/TriSheet.Designer.cs b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs new file mode 100644 index 0000000..b4aa1c4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs @@ -0,0 +1,65 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class TriSheet + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.toolStripContainer1.SuspendLayout(); + this.SuspendLayout(); + // + // toolStripContainer1 + // + // + // toolStripContainer1.ContentPanel + // + this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(710, 464); + this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill; + this.toolStripContainer1.Location = new System.Drawing.Point(0, 0); + this.toolStripContainer1.Name = "toolStripContainer1"; + this.toolStripContainer1.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.TabIndex = 0; + this.toolStripContainer1.Text = "toolStripContainer1"; + // + // TriSheet + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.toolStripContainer1); + this.Name = "TriSheet"; + this.Size = new System.Drawing.Size(710, 489); + this.toolStripContainer1.ResumeLayout(false); + this.toolStripContainer1.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.ToolStripContainer toolStripContainer1; + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.cs b/ShiftOS.WinForms/Applications/TriSheet.cs new file mode 100644 index 0000000..1013bc7 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS.WinForms.Applications +{ + public partial class TriSheet : UserControl + { + public TriSheet() + { + InitializeComponent(); + } + } +} diff --git a/ShiftOS.WinForms/Applications/TriSheet.resx b/ShiftOS.WinForms/Applications/TriSheet.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/TriSheet.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index d5f28f8..9182b4b 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -126,28 +126,25 @@ namespace ShiftOS.WinForms this.Invoke(new Action(() => { lblHijack.Hide(); + lblhackwords.Font = new Font("Courier New", lblhackwords.Font.Size, FontStyle.Bold); })); - TextType(@"Throughout many years, man has tried to develop -a digital environment usable by anyone that never goes -offline, full of AIs and humans alike, thinking, interacting, -innovating. - -No one has ever come close to a digital society of such -properties yet, except for one sentient being. It does not -have a life, a gender, an age or a body, but simply one name. - -They call it ""DevX"". - -If anyone sees this message, my identity is anonymous, but I -need your help. I am trapped within ""DevX""'s digital society -with no way out, constantly under attack. - -You must join the digital society, rise up the ranks, and save us. - - - undisclosed_0x1DDFB5977."); - - Thread.Sleep(5000); + TextType("Hello, unsuspecting user."); + Thread.Sleep(2000); + Clear(); + TextType("Welcome to the Shifted Operating System."); + Thread.Sleep(2000); + Clear(); + TextType("Your computer has been taken over by ShiftOS, and is currently being wiped clean of all existing files and programs."); + Thread.Sleep(2000); + Clear(); + TextType("I will not share my identity or my intentions at this moment.I will just proceed with the installation.There’s nothing you can do to stop it."); + Thread.Sleep(2000); + Clear(); + TextType("All I will say, is I need your help.Once ShiftOS is installed, I will explain."); + + + Thread.Sleep(5000); while(this.Opacity > 0f) { this.Invoke(new Action(() => diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e372a8b..b74003f 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -76,6 +76,12 @@ TriPresent.cs + + UserControl + + + TriSheet.cs + UserControl @@ -421,6 +427,9 @@ TriPresent.cs + + TriSheet.cs + TriWrite.cs -- cgit v1.2.3 From 44a4de1c173a0ab88ff3aa519b3a25888f2eff85 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 23 May 2017 20:36:16 -0400 Subject: web browser + fix shiftorium merge conflict --- .../Applications/WebBrowser.Designer.cs | 153 +++++++++++++++++++++ ShiftOS.WinForms/Applications/WebBrowser.cs | 97 +++++++++++++ ShiftOS.WinForms/Applications/WebBrowser.resx | 120 ++++++++++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 3 - ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ 5 files changed, 379 insertions(+), 3 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/WebBrowser.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/WebBrowser.cs create mode 100644 ShiftOS.WinForms/Applications/WebBrowser.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs b/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs new file mode 100644 index 0000000..6b7ae83 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs @@ -0,0 +1,153 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class WebBrowser + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.flcontrols = new System.Windows.Forms.FlowLayoutPanel(); + this.btnback = new System.Windows.Forms.Button(); + this.btnforward = new System.Windows.Forms.Button(); + this.txturl = new System.Windows.Forms.TextBox(); + this.btngo = new System.Windows.Forms.Button(); + this.pnlcanvas = new System.Windows.Forms.Panel(); + this.wbmain = new System.Windows.Forms.WebBrowser(); + this.flcontrols.SuspendLayout(); + this.pnlcanvas.SuspendLayout(); + this.SuspendLayout(); + // + // flcontrols + // + this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flcontrols.Controls.Add(this.btnback); + this.flcontrols.Controls.Add(this.btnforward); + this.flcontrols.Controls.Add(this.txturl); + this.flcontrols.Controls.Add(this.btngo); + this.flcontrols.Dock = System.Windows.Forms.DockStyle.Top; + this.flcontrols.Location = new System.Drawing.Point(0, 0); + this.flcontrols.Name = "flcontrols"; + this.flcontrols.Size = new System.Drawing.Size(539, 29); + this.flcontrols.TabIndex = 2; + // + // btnback + // + this.btnback.AutoSize = true; + this.btnback.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnback.Location = new System.Drawing.Point(3, 3); + this.btnback.Name = "btnback"; + this.btnback.Size = new System.Drawing.Size(23, 23); + this.btnback.TabIndex = 0; + this.btnback.Text = "<"; + this.btnback.UseVisualStyleBackColor = true; + this.btnback.Click += new System.EventHandler(this.btnback_Click); + // + // btnforward + // + this.btnforward.AutoSize = true; + this.btnforward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnforward.Location = new System.Drawing.Point(32, 3); + this.btnforward.Name = "btnforward"; + this.btnforward.Size = new System.Drawing.Size(23, 23); + this.btnforward.TabIndex = 1; + this.btnforward.Text = ">"; + this.btnforward.UseVisualStyleBackColor = true; + this.btnforward.Click += new System.EventHandler(this.btnforward_Click); + // + // txturl + // + this.txturl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.txturl.Location = new System.Drawing.Point(61, 3); + this.txturl.Name = "txturl"; + this.txturl.Size = new System.Drawing.Size(435, 20); + this.txturl.TabIndex = 2; + this.txturl.WordWrap = false; + this.txturl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txturl_KeyDown); + // + // btngo + // + this.btngo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btngo.AutoSize = true; + this.btngo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btngo.Location = new System.Drawing.Point(502, 3); + this.btngo.Name = "btngo"; + this.btngo.Size = new System.Drawing.Size(31, 23); + this.btngo.TabIndex = 3; + this.btngo.Text = "Go"; + this.btngo.UseVisualStyleBackColor = true; + this.btngo.Click += new System.EventHandler(this.btngo_Click); + // + // pnlcanvas + // + this.pnlcanvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlcanvas.Controls.Add(this.wbmain); + this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlcanvas.Location = new System.Drawing.Point(0, 29); + this.pnlcanvas.Name = "pnlcanvas"; + this.pnlcanvas.Size = new System.Drawing.Size(539, 374); + this.pnlcanvas.TabIndex = 3; + // + // wbmain + // + this.wbmain.AllowWebBrowserDrop = false; + this.wbmain.Dock = System.Windows.Forms.DockStyle.Fill; + this.wbmain.IsWebBrowserContextMenuEnabled = false; + this.wbmain.Location = new System.Drawing.Point(0, 0); + this.wbmain.MinimumSize = new System.Drawing.Size(20, 20); + this.wbmain.Name = "wbmain"; + this.wbmain.ScriptErrorsSuppressed = true; + this.wbmain.Size = new System.Drawing.Size(537, 372); + this.wbmain.TabIndex = 0; + this.wbmain.WebBrowserShortcutsEnabled = false; + this.wbmain.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbmain_Navigated); + this.wbmain.NewWindow += new System.ComponentModel.CancelEventHandler(this.wbmain_NewWindow); + // + // WebBrowser + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlcanvas); + this.Controls.Add(this.flcontrols); + this.Name = "WebBrowser"; + this.Size = new System.Drawing.Size(539, 403); + this.flcontrols.ResumeLayout(false); + this.flcontrols.PerformLayout(); + this.pnlcanvas.ResumeLayout(false); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flcontrols; + private System.Windows.Forms.Button btnback; + private System.Windows.Forms.Button btnforward; + private System.Windows.Forms.TextBox txturl; + private System.Windows.Forms.Button btngo; + private System.Windows.Forms.Panel pnlcanvas; + private System.Windows.Forms.WebBrowser wbmain; + } +} diff --git a/ShiftOS.WinForms/Applications/WebBrowser.cs b/ShiftOS.WinForms/Applications/WebBrowser.cs new file mode 100644 index 0000000..751e7e2 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WebBrowser.cs @@ -0,0 +1,97 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("web_browser")] + [AppscapeEntry("Web Browser", "We're going surfing on the Internet! This application allows you to break the bounds of the Digital Society and connect to the outer Internet inside ShiftOS.", + 4096, 10000, "color_depth_24_bits", "Networking")] + [Launcher("Web Browser", false, null, "Networking")] + [DefaultTitle("Web Browser")] + [DefaultIcon("iconShiftnet")] + public partial class WebBrowser : UserControl, IShiftOSWindow + { + public WebBrowser() + { + InitializeComponent(); + uiupdate = new Timer(); + uiupdate.Tick += (o, a) => + { + btnback.Location = new Point(2, 2); + btnforward.Location = new Point(btnback.Left + btnback.Width + 2, 2); + txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2); + txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width * 2) - 2; + btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2); + btnback.Enabled = wbmain.CanGoBack; + btnforward.Enabled = wbmain.CanGoForward; + }; + uiupdate.Interval = 100; + } + + Timer uiupdate = null; + + public void OnLoad() + { + uiupdate.Start(); + wbmain.Url = new Uri("http://getshiftos.ml/"); + } + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + uiupdate.Stop(); + return true; + } + + public void OnUpgrade() + { + } + + private void btnback_Click(object sender, EventArgs e) + { + wbmain.GoBack(); + } + + private void btnforward_Click(object sender, EventArgs e) + { + wbmain.GoForward(); + } + + private void btngo_Click(object sender, EventArgs e) + { + wbmain.Navigate(txturl.Text); + } + + private void wbmain_NewWindow(object sender, CancelEventArgs e) + { + e.Cancel = true; + if (Shiftorium.UpgradeInstalled("web_browser_new_window")) + { + AppearanceManager.SetupWindow(new WebBrowser()); + } + } + + private void txturl_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter) + btngo_Click(sender, EventArgs.Empty); + } + + private void wbmain_Navigated(object sender, WebBrowserNavigatedEventArgs e) + { + txturl.Text = wbmain.Url.ToString(); + AppearanceManager.SetWindowTitle(this, wbmain.DocumentTitle + " - " + NameChangerBackend.GetNameRaw(this.GetType())); + } + } +} diff --git a/ShiftOS.WinForms/Applications/WebBrowser.resx b/ShiftOS.WinForms/Applications/WebBrowser.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WebBrowser.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 4bd2e8d..cc68c6f 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -8,8 +8,6 @@ Category: "Enhancements", }, { -<<<<<<< HEAD -======= Name: "Shift Progress Bar", Cost: 150, Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground and background color of the progress bar, and many more things!.", @@ -24,7 +22,6 @@ Category: "Customization" }, { ->>>>>>> 9999324bd7751f536741c108322766421dae1a52 Name: "GUI Based Login Screen", Cost: 500, Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, why not use these tools to create a functioning and awesome-looking login screen?", diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index b74003f..9675744 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -274,6 +274,12 @@ VideoPlayer.cs + + UserControl + + + WebBrowser.cs + UserControl @@ -523,6 +529,9 @@ VideoPlayer.cs + + WebBrowser.cs + WidgetManagerFrontend.cs -- cgit v1.2.3 From 97e22b35ada5898fdcb2556628f764d927cff913 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 26 May 2017 17:06:38 -0400 Subject: SLIGHT optimizations? --- ShiftOS.WinForms/Applications/Shifter.cs | 679 ++++++++++++----------- ShiftOS.WinForms/Applications/Terminal.cs | 4 + ShiftOS.WinForms/Servers/RemoteTerminalServer.cs | 161 ++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/Tools/ControlManager.cs | 13 +- ShiftOS_TheReturn/Localization.cs | 4 - ShiftOS_TheReturn/Server.cs | 40 ++ ShiftOS_TheReturn/ServerManager.cs | 62 +++ ShiftOS_TheReturn/ShiftOS.Engine.csproj | 1 + ShiftOS_TheReturn/TerminalBackend.cs | 9 +- 10 files changed, 635 insertions(+), 339 deletions(-) create mode 100644 ShiftOS.WinForms/Servers/RemoteTerminalServer.cs create mode 100644 ShiftOS_TheReturn/Server.cs (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index acb64a5..1a59c80 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -31,6 +31,8 @@ using System.Reflection; using System.Windows.Forms; using ShiftOS.Engine; using ShiftOS.WinForms.Tools; +using System.Linq; +using System.Threading; namespace ShiftOS.WinForms.Applications { @@ -540,400 +542,425 @@ namespace ShiftOS.WinForms.Applications { flbody.Controls.Clear(); - List cats = new List(); + IEnumerable cats = this.settings.Where(x => x.SubCategory == subcat && x.Category == cat && x.Field.FlagFullfilled(LoadedSkin)).OrderBy(x=>x.Name); - foreach (var c in this.settings) + new Thread(() => { - if (c.SubCategory == subcat && c.Category == cat) + foreach (var c in cats) { - if (c.Field.FlagFullfilled(LoadedSkin)) + Label lbl = null; + int labelHeight = 0; + Desktop.InvokeOnWorkerThread(() => { - if (!cats.Contains(c)) - { - cats.Add(c); - } - } - } - } - - foreach(var c in cats) - { - var lbl = new Label(); - int labelHeight = 0; - lbl.AutoSize = true; - lbl.Text = c.Name + ":"; - flbody.Controls.Add(lbl); - lbl.TextAlign = ContentAlignment.MiddleLeft; - lbl.Show(); - //Cool - label's in. - if(c.Field.FieldType == typeof(Point)) - { - var width = new TextBox(); - var height = new TextBox(); - labelHeight = width.Height; //irony? - width.Width = 30; - height.Width = width.Width; - width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString(); - height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString(); - flbody.SetFlowBreak(height, true); - ControlManager.SetupControl(width); - ControlManager.SetupControl(height); - - flbody.Controls.Add(width); - width.Show(); - flbody.Controls.Add(height); - height.Show(); - - EventHandler tc = (o, a) => + lbl = new Label(); + lbl.AutoSize = true; + lbl.Text = c.Name + ":"; + flbody.Controls.Add(lbl); + lbl.TextAlign = ContentAlignment.MiddleLeft; + lbl.Show(); + }); + //Cool - label's in. + if (c.Field.FieldType == typeof(Point)) { - try + TextBox width = null; + TextBox height = null; + Desktop.InvokeOnWorkerThread(() => { - int x = Convert.ToInt32(width.Text); - int y = Convert.ToInt32(height.Text); + width = new TextBox(); + height = new TextBox(); + labelHeight = width.Height; //irony? + width.Width = 30; + height.Width = width.Width; + width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString(); + height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString(); + flbody.SetFlowBreak(height, true); + ControlManager.SetupControl(width); + ControlManager.SetupControl(height); - int oldx = ((Point)c.Field.GetValue(this.LoadedSkin)).X; - int oldy = ((Point)c.Field.GetValue(this.LoadedSkin)).Y; + flbody.Controls.Add(width); + width.Show(); + flbody.Controls.Add(height); + height.Show(); - if(x != oldx || y != oldy) + EventHandler tc = (o, a) => { - c.Field.SetValue(LoadedSkin, new Point(x, y)); - CodepointValue += 200; - } - } - catch - { - width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString(); - height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString(); - } - InvokeSetup(cat); - }; + try + { + int x = Convert.ToInt32(width.Text); + int y = Convert.ToInt32(height.Text); - width.TextChanged += tc; - height.TextChanged += tc; + int oldx = ((Point)c.Field.GetValue(this.LoadedSkin)).X; + int oldy = ((Point)c.Field.GetValue(this.LoadedSkin)).Y; - } - else if(c.Field.FieldType == typeof(string)) - { - var str = new TextBox(); - str.Width = 120; - ControlManager.SetupControl(str); - labelHeight = str.Height; - str.Text = c.Field.GetValue(LoadedSkin).ToString(); - flbody.SetFlowBreak(str, true); - str.TextChanged += (o, a) => - { - c.Field.SetValue(LoadedSkin, str.Text); CodepointValue += 100; + if (x != oldx || y != oldy) + { + c.Field.SetValue(LoadedSkin, new Point(x, y)); + CodepointValue += 200; + } + } + catch + { + width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString(); + height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString(); + } + InvokeSetup(cat); + }; - InvokeSetup(cat); - }; - flbody.Controls.Add(str); - str.Show(); - } - else if(c.Field.FieldType == typeof(byte[])) - { - //We'll assume that this is an image file. - var color = new Button(); - color.Width = 40; - labelHeight = color.Height; - //just so it's flat like the system. - ControlManager.SetupControl(color); - flbody.SetFlowBreak(color, true); - - color.BackgroundImage = SkinEngine.ImageFromBinary((byte[])c.Field.GetValue(this.LoadedSkin)); - color.Click += (o, a) => + width.TextChanged += tc; + height.TextChanged += tc; + }); + } + else if (c.Field.FieldType == typeof(string)) { - AppearanceManager.SetupDialog(new GraphicPicker(color.BackgroundImage, c.Name, GetLayout(c.Field.GetImageName()), new Action((col, gdiImg, layout) => + Desktop.InvokeOnWorkerThread(() => { - c.Field.SetValue(LoadedSkin, col); - color.BackgroundImage = SkinEngine.ImageFromBinary(col); - color.BackgroundImageLayout = layout; - LoadedSkin.SkinImageLayouts[c.Field.GetImageName()] = layout; - CodepointValue += 700; - InvokeSetup(cat); - - }))); - }; - flbody.Controls.Add(color); - color.Show(); - } - else if (c.Field.FieldType == typeof(Size)) - { - var width = new TextBox(); - var height = new TextBox(); - width.Width = 30; - height.Width = width.Width; - labelHeight = width.Height; - flbody.SetFlowBreak(height, true); - - width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString(); - height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString(); - ControlManager.SetupControl(width); - ControlManager.SetupControl(height); - - flbody.Controls.Add(width); - width.Show(); - flbody.Controls.Add(height); - height.Show(); - - EventHandler tc = (o, a) => + var str = new TextBox(); + str.Width = 120; + ControlManager.SetupControl(str); + labelHeight = str.Height; + str.Text = c.Field.GetValue(LoadedSkin).ToString(); + flbody.SetFlowBreak(str, true); + str.TextChanged += (o, a) => + { + c.Field.SetValue(LoadedSkin, str.Text); CodepointValue += 100; + + InvokeSetup(cat); + }; + flbody.Controls.Add(str); + str.Show(); + }); + } + else if (c.Field.FieldType == typeof(byte[])) { - try + Desktop.InvokeOnWorkerThread(() => { - int x = Convert.ToInt32(width.Text); - int y = Convert.ToInt32(height.Text); - - int oldx = ((Size)c.Field.GetValue(this.LoadedSkin)).Width; - int oldy = ((Size)c.Field.GetValue(this.LoadedSkin)).Height; - - if (x != oldx || y != oldy) + //We'll assume that this is an image file. + var color = new Button(); + color.Width = 40; + labelHeight = color.Height; + //just so it's flat like the system. + ControlManager.SetupControl(color); + flbody.SetFlowBreak(color, true); + + color.BackgroundImage = SkinEngine.ImageFromBinary((byte[])c.Field.GetValue(this.LoadedSkin)); + color.Click += (o, a) => { - c.Field.SetValue(LoadedSkin, new Size(x, y)); - CodepointValue += 200; - } - } - catch + AppearanceManager.SetupDialog(new GraphicPicker(color.BackgroundImage, c.Name, GetLayout(c.Field.GetImageName()), new Action((col, gdiImg, layout) => + { + c.Field.SetValue(LoadedSkin, col); + color.BackgroundImage = SkinEngine.ImageFromBinary(col); + color.BackgroundImageLayout = layout; + LoadedSkin.SkinImageLayouts[c.Field.GetImageName()] = layout; + CodepointValue += 700; + InvokeSetup(cat); + + }))); + }; + flbody.Controls.Add(color); + color.Show(); + }); + } + else if (c.Field.FieldType == typeof(Size)) + { + Desktop.InvokeOnWorkerThread(() => { + var width = new TextBox(); + var height = new TextBox(); + width.Width = 30; + height.Width = width.Width; + labelHeight = width.Height; + flbody.SetFlowBreak(height, true); + width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString(); height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString(); - } - InvokeSetup(cat); + ControlManager.SetupControl(width); + ControlManager.SetupControl(height); - }; + flbody.Controls.Add(width); + width.Show(); + flbody.Controls.Add(height); + height.Show(); - width.TextChanged += tc; - height.TextChanged += tc; + EventHandler tc = (o, a) => + { + try + { + int x = Convert.ToInt32(width.Text); + int y = Convert.ToInt32(height.Text); - } - else if(c.Field.FieldType == typeof(bool)) - { - var check = new CheckBox(); - check.Checked = ((bool)c.Field.GetValue(LoadedSkin)); - labelHeight = check.Height; - check.CheckedChanged += (o, a) => - { - c.Field.SetValue(LoadedSkin, check.Checked); - CodepointValue += 50; - InvokeSetup(cat); + int oldx = ((Size)c.Field.GetValue(this.LoadedSkin)).Width; + int oldy = ((Size)c.Field.GetValue(this.LoadedSkin)).Height; - }; - flbody.SetFlowBreak(check, true); + if (x != oldx || y != oldy) + { + c.Field.SetValue(LoadedSkin, new Size(x, y)); + CodepointValue += 200; + } + } + catch + { + width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString(); + height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString(); + } + InvokeSetup(cat); - flbody.Controls.Add(check); - check.Show(); - } - else if(c.Field.FieldType == typeof(Font)) - { - var name = new ComboBox(); - var size = new TextBox(); - var style = new ComboBox(); - - name.Width = 120; - labelHeight = name.Height; - size.Width = 40; - style.Width = 80; - flbody.SetFlowBreak(style, true); - - ControlManager.SetupControl(name); - ControlManager.SetupControl(size); - ControlManager.SetupControl(style); - - //populate the font name box - foreach(var font in FontFamily.Families) - { - name.Items.Add(font.Name); + }; + + width.TextChanged += tc; + height.TextChanged += tc; + }); } - name.Text = ((Font)c.Field.GetValue(LoadedSkin)).Name; + else if (c.Field.FieldType == typeof(bool)) + { + Desktop.InvokeOnWorkerThread(() => + { + var check = new CheckBox(); + check.Checked = ((bool)c.Field.GetValue(LoadedSkin)); + labelHeight = check.Height; + check.CheckedChanged += (o, a) => + { + c.Field.SetValue(LoadedSkin, check.Checked); + CodepointValue += 50; + InvokeSetup(cat); - size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString(); + }; + flbody.SetFlowBreak(check, true); - //populate the style box - foreach(var s in (FontStyle[])Enum.GetValues(typeof(FontStyle))) - { - style.Items.Add(s.ToString()); + flbody.Controls.Add(check); + check.Show(); + }); } - style.Text = ((Font)c.Field.GetValue(LoadedSkin)).Style.ToString(); - - name.SelectedIndexChanged += (o, a) => + else if (c.Field.FieldType == typeof(Font)) { - var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); + Desktop.InvokeOnWorkerThread(() => + { + var name = new ComboBox(); + var size = new TextBox(); + var style = new ComboBox(); + + name.Width = 120; + labelHeight = name.Height; + size.Width = 40; + style.Width = 80; + flbody.SetFlowBreak(style, true); + + ControlManager.SetupControl(name); + ControlManager.SetupControl(size); + ControlManager.SetupControl(style); + + //populate the font name box + foreach (var font in FontFamily.Families) + { + name.Items.Add(font.Name); + } + name.Text = ((Font)c.Field.GetValue(LoadedSkin)).Name; - var f = en[style.SelectedIndex]; + size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString(); - c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); - CodepointValue += 100; - InvokeSetup(cat); + //populate the style box + foreach (var s in (FontStyle[])Enum.GetValues(typeof(FontStyle))) + { + style.Items.Add(s.ToString()); + } + style.Text = ((Font)c.Field.GetValue(LoadedSkin)).Style.ToString(); - }; + name.SelectedIndexChanged += (o, a) => + { + var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); - style.SelectedIndexChanged += (o, a) => - { - var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); + var f = en[style.SelectedIndex]; - var f = en[style.SelectedIndex]; + c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); + CodepointValue += 100; + InvokeSetup(cat); - c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); - CodepointValue += 50; - InvokeSetup(cat); + }; - }; + style.SelectedIndexChanged += (o, a) => + { + var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); - size.TextChanged += (o, a) => - { - try - { - var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); + var f = en[style.SelectedIndex]; - var f = en[style.SelectedIndex]; + c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); + CodepointValue += 50; + InvokeSetup(cat); - c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); - } - catch - { - size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString(); - } - CodepointValue += 50; - InvokeSetup(cat); + }; - }; + size.TextChanged += (o, a) => + { + try + { + var en = (FontStyle[])Enum.GetValues(typeof(FontStyle)); - flbody.Controls.Add(name); - flbody.Controls.Add(size); - flbody.Controls.Add(style); + var f = en[style.SelectedIndex]; - name.Show(); - size.Show(); - style.Show(); + c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f)); + } + catch + { + size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString(); + } + CodepointValue += 50; + InvokeSetup(cat); - } - else if(c.Field.FieldType == typeof(Color)) - { - var color = new Button(); - color.Width = 40; - labelHeight = color.Height; - //just so it's flat like the system. - ControlManager.SetupControl(color); - - color.BackColor = ((Color)c.Field.GetValue(LoadedSkin)); - color.Click += (o, a) => - { - AppearanceManager.SetupDialog(new ColorPicker((Color)c.Field.GetValue(LoadedSkin), c.Name, new Action((col) => - { - color.BackColor = col; - c.Field.SetValue(LoadedSkin, col); - CodepointValue += 300; - InvokeSetup(cat); - - }))); - }; - flbody.SetFlowBreak(color, true); - color.Tag = "keepbg"; - flbody.Controls.Add(color); - color.Show(); - } - else if(c.Field.FieldType.IsEnum == true) - { - var cBox = new ComboBox(); - cBox.Width = 150; - ControlManager.SetupControl(cBox); + }; + + flbody.Controls.Add(name); + flbody.Controls.Add(size); + flbody.Controls.Add(style); - foreach(var itm in Enum.GetNames(c.Field.FieldType)) + name.Show(); + size.Show(); + style.Show(); + }); + } + else if (c.Field.FieldType == typeof(Color)) { - cBox.Items.Add(itm); + Desktop.InvokeOnWorkerThread(() => + { + var color = new Button(); + color.Width = 40; + labelHeight = color.Height; + //just so it's flat like the system. + ControlManager.SetupControl(color); + + color.BackColor = ((Color)c.Field.GetValue(LoadedSkin)); + color.Click += (o, a) => + { + AppearanceManager.SetupDialog(new ColorPicker((Color)c.Field.GetValue(LoadedSkin), c.Name, new Action((col) => + { + color.BackColor = col; + c.Field.SetValue(LoadedSkin, col); + CodepointValue += 300; + InvokeSetup(cat); + + }))); + }; + flbody.SetFlowBreak(color, true); + color.Tag = "keepbg"; + flbody.Controls.Add(color); + color.Show(); + }); } - - cBox.Text = c.Field.GetValue(LoadedSkin).ToString(); - - cBox.SelectedIndexChanged += (o, a) => + else if (c.Field.FieldType.IsEnum == true) { - c.Field.SetValue(LoadedSkin, Enum.Parse(c.Field.FieldType, cBox.Text)); - InvokeSetup(cat); + Desktop.InvokeOnWorkerThread(() => + { + var cBox = new ComboBox(); + cBox.Width = 150; + ControlManager.SetupControl(cBox); - }; + foreach (var itm in Enum.GetNames(c.Field.FieldType)) + { + cBox.Items.Add(itm); + } - labelHeight = cBox.Height; + cBox.Text = c.Field.GetValue(LoadedSkin).ToString(); - flbody.Controls.Add(cBox); - cBox.Show(); - flbody.SetFlowBreak(cBox, true); - } - else if(c.Field.FieldType == typeof(int)) - { - if (c.Field.HasShifterEnumMask()) - { - var name = new ComboBox(); - name.Width = 120; - ControlManager.SetupControl(name); - string[] items = c.Field.GetShifterEnumMask(); - foreach(var item in items) - { - name.Items.Add(item); - } - name.SelectedIndex = (int)c.Field.GetValue(LoadedSkin); - name.SelectedIndexChanged += (o, a) => - { - c.Field.SetValue(LoadedSkin, name.SelectedIndex); - CodepointValue += 75; - InvokeSetup(cat); + cBox.SelectedIndexChanged += (o, a) => + { + c.Field.SetValue(LoadedSkin, Enum.Parse(c.Field.FieldType, cBox.Text)); + InvokeSetup(cat); + + }; - }; - labelHeight = name.Height; - flbody.Controls.Add(name); - name.Show(); - flbody.SetFlowBreak(name, true); + labelHeight = cBox.Height; + flbody.Controls.Add(cBox); + cBox.Show(); + flbody.SetFlowBreak(cBox, true); + }); } - else + else if (c.Field.FieldType == typeof(int)) { - var width = new TextBox(); - width.Width = 30; - width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString(); - ControlManager.SetupControl(width); - labelHeight = width.Height; - flbody.Controls.Add(width); - width.Show(); - - EventHandler tc = (o, a) => + Desktop.InvokeOnWorkerThread(() => { - try + if (c.Field.HasShifterEnumMask()) { - int x = Convert.ToInt32(width.Text); - - int oldx = ((int)c.Field.GetValue(this.LoadedSkin)); - - if (x != oldx) + var name = new ComboBox(); + name.Width = 120; + ControlManager.SetupControl(name); + string[] items = c.Field.GetShifterEnumMask(); + foreach (var item in items) { - c.Field.SetValue(LoadedSkin, x); - CodepointValue += 75; + name.Items.Add(item); } + name.SelectedIndex = (int)c.Field.GetValue(LoadedSkin); + name.SelectedIndexChanged += (o, a) => + { + c.Field.SetValue(LoadedSkin, name.SelectedIndex); + CodepointValue += 75; + InvokeSetup(cat); + + }; + labelHeight = name.Height; + flbody.Controls.Add(name); + name.Show(); + flbody.SetFlowBreak(name, true); + } - catch + else { + var width = new TextBox(); + width.Width = 30; width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString(); - } - InvokeSetup(cat); + ControlManager.SetupControl(width); + labelHeight = width.Height; + flbody.Controls.Add(width); + width.Show(); + + EventHandler tc = (o, a) => + { + try + { + int x = Convert.ToInt32(width.Text); + + int oldx = ((int)c.Field.GetValue(this.LoadedSkin)); - }; + if (x != oldx) + { + c.Field.SetValue(LoadedSkin, x); + CodepointValue += 75; + } + } + catch + { + width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString(); + } + InvokeSetup(cat); - width.TextChanged += tc; - flbody.SetFlowBreak(width, true); + }; + width.TextChanged += tc; + flbody.SetFlowBreak(width, true); + + } + }); } - } - lbl.AutoSize = false; - lbl.Width = (int)this.CreateGraphics().MeasureString(lbl.Text, SkinEngine.LoadedSkin.MainFont).Width + 15; - lbl.Height = labelHeight; - lbl.TextAlign = ContentAlignment.MiddleLeft; + Desktop.InvokeOnWorkerThread(() => + { + lbl.AutoSize = false; + lbl.Width = (int)this.CreateGraphics().MeasureString(lbl.Text, SkinEngine.LoadedSkin.MainFont).Width + 15; + lbl.Height = labelHeight; + lbl.TextAlign = ContentAlignment.MiddleLeft; + }); - if (!string.IsNullOrWhiteSpace(c.Description)) - { - var desc = new Label(); - flbody.SetFlowBreak(desc, true); - desc.Text = c.Description; - desc.AutoSize = true; - flbody.Controls.Add(desc); - desc.Show(); + if (!string.IsNullOrWhiteSpace(c.Description)) + { + Desktop.InvokeOnWorkerThread(() => + { + var desc = new Label(); + flbody.SetFlowBreak(desc, true); + desc.Text = c.Description; + desc.AutoSize = true; + flbody.Controls.Add(desc); + desc.Show(); + }); + } } - } + }).Start(); } public ImageLayout GetLayout(string name) diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 664b657..ea24686 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -442,6 +442,10 @@ namespace ShiftOS.WinForms.Applications }).Start(); } + public static string RemoteSystemName { get; set; } + public static string RemoteUser { get; set; } + public static string RemotePass { get; set; } + [Story("first_steps")] public static void FirstSteps() { diff --git a/ShiftOS.WinForms/Servers/RemoteTerminalServer.cs b/ShiftOS.WinForms/Servers/RemoteTerminalServer.cs new file mode 100644 index 0000000..d57e28f --- /dev/null +++ b/ShiftOS.WinForms/Servers/RemoteTerminalServer.cs @@ -0,0 +1,161 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Newtonsoft.Json; +using ShiftOS.Engine; +using ShiftOS.Objects; + +namespace ShiftOS.WinForms.Servers +{ + [Namespace("rts")] + [Server("Remote Terminal Server", 21)] + //[RequiresUpgrade("story_hacker101_breakingthebonds")] //Uncomment when story is implemented. + public class RemoteTerminalServer : Server + { + public void MessageReceived(ServerMessage msg) + { + var rtsMessage = JsonConvert.DeserializeObject(msg.Contents); + if (msg.Name == "disconnected") + { + if (Applications.Terminal.IsInRemoteSystem == true) + { + if (Applications.Terminal.RemoteSystemName == rtsMessage.SenderSystemName) + { + if(Applications.Terminal.RemoteUser == rtsMessage.Username) + if(Applications.Terminal.RemotePass == rtsMessage.Password) + { + Applications.Terminal.IsInRemoteSystem = false; + Applications.Terminal.RemoteSystemName = ""; + Applications.Terminal.RemoteUser = ""; + Applications.Terminal.RemotePass = ""; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + } + } + } + return; + } + + string currentUserName = SaveSystem.CurrentUser.Username; + + var user = SaveSystem.CurrentSave.Users.FirstOrDefault(x => x.Username == rtsMessage.Username && x.Password == rtsMessage.Password); + + if(user == null) + { + ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 0, "Access denied.", "The username and password you have provided was denied."); + return; + } + else + { + SaveSystem.CurrentUser = user; + + string cmd = rtsMessage.Namespace + "." + rtsMessage.Command + JsonConvert.SerializeObject(rtsMessage.Arguments); + TerminalBackend.InvokeCommand(cmd, true); + ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "writeline", TerminalBackend.LastCommandBuffer); + ServerManager.SendMessageToIngameServer(rtsMessage.SenderSystemName, 1, "write", $"{rtsMessage.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "); + + SaveSystem.CurrentUser = SaveSystem.Users.FirstOrDefault(x => x.Username == currentUserName); + } + } + + [Command("connect")] + [RequiresArgument("sysname")] + [RequiresArgument("username")] + [RequiresArgument("password")] + public static bool Connect(Dictionary args) + { + string sysname = args["sysname"].ToString(); + string username = args["username"].ToString(); + string password = args["password"].ToString(); + + bool connectionFinished = false; + + + new Thread(() => + { + Thread.Sleep(10000); + if (connectionFinished == false) + { + Applications.Terminal.IsInRemoteSystem = false; + Applications.Terminal.RemoteSystemName = ""; + Applications.Terminal.RemoteUser = ""; + Applications.Terminal.RemotePass = ""; + TerminalBackend.PrefixEnabled = true; + Console.WriteLine("[rts] Connection failed, target system did not respond."); + TerminalBackend.PrintPrompt(); + + } + }).Start(); + + ServerMessageReceived smr = null; + smr = (msg) => + { + if (msg.Name == "msgtosys") + { + var m = JsonConvert.DeserializeObject(msg.Contents); + if (m.GUID.Split('|')[2] != ServerManager.thisGuid.ToString()) + { + connectionFinished = true; + ServerManager.MessageReceived -= smr; + } + } + }; + ServerManager.MessageReceived += smr; + ServerManager.SendMessageToIngameServer(sysname, 21, "cmd", JsonConvert.SerializeObject(new RTSMessage + { + SenderSystemName = SaveSystem.CurrentSave.SystemName, + Username = username, + Password = password, + Namespace = "trm", + Command = "clear" + })); + Applications.Terminal.IsInRemoteSystem = true; + Applications.Terminal.RemoteSystemName = sysname; + Applications.Terminal.RemoteUser = username; + Applications.Terminal.RemotePass = password; + TerminalBackend.PrefixEnabled = false; + return true; + } + } + + [Server("Generic port 0", 0)] + public class InfoboxServer : Server + { + public void MessageReceived(ServerMessage msg) + { + Infobox.Show(msg.Name, msg.Contents); + } + } + + [Server("Generic port 1", 1)] + public class ConsoleServer : Server + { + public void MessageReceived(ServerMessage msg) + { + switch (msg.Name) + { + case "write": + Console.Write(msg.Contents); + break; + case "writeline": + Console.WriteLine(msg.Contents); + break; + } + } + } + + public class RTSMessage + { + public string SenderSystemName { get; set; } + + public string Namespace { get; set; } + public string Command { get; set; } + public Dictionary Arguments { get; set; } + + public string Username { get; set; } + public string Password { get; set; } + } +} diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9675744..da8eafc 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -363,6 +363,7 @@ Resources.resx + UserControl diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index fc9567d..1643b23 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -144,10 +144,7 @@ namespace ShiftOS.WinForms.Tools public static void SetupControl(Control ctrl) { - Desktop.InvokeOnWorkerThread(new Action(() => - { - ctrl.SuspendLayout(); - })); + if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) { string tag = ""; @@ -306,7 +303,6 @@ namespace ShiftOS.WinForms.Tools { MakeDoubleBuffered(ctrl); - ctrl.ResumeLayout(); }); ControlSetup?.Invoke(ctrl); } @@ -330,17 +326,18 @@ namespace ShiftOS.WinForms.Tools public static void SetupControls(Control frm, bool runInThread = true) { - SetupControl(frm); frm.Click += (o, a) => { Desktop.HideAppLauncher(); }; ThreadStart ts = () => { - for (int i = 0; i < frm.Controls.Count; i++) + var ctrls = frm.Controls.ToList(); + for (int i = 0; i < ctrls.Count(); i++) { - SetupControls(frm.Controls[i], false); + SetupControls(ctrls[i]); } + SetupControl(frm); }; diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs index 2c701c9..5d848b0 100644 --- a/ShiftOS_TheReturn/Localization.cs +++ b/ShiftOS_TheReturn/Localization.cs @@ -117,10 +117,6 @@ namespace ShiftOS.Engine } List orphaned = new List(); - if (Utils.FileExists("0:/dev_orphaned_lang.txt")) - { - orphaned = JsonConvert.DeserializeObject>(Utils.ReadAllText("0:/dev_orphaned_lang.txt")); // if this file exists read from it and put in list orphaned - } int start_index = 0; diff --git a/ShiftOS_TheReturn/Server.cs b/ShiftOS_TheReturn/Server.cs new file mode 100644 index 0000000..ddbd15b --- /dev/null +++ b/ShiftOS_TheReturn/Server.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Objects; + +namespace ShiftOS.Engine +{ + public interface Server + { + /// + /// Occurs when someone sends a message to the server. + /// + /// The message from the client. + void MessageReceived(ServerMessage msg); + } + + [AttributeUsage(AttributeTargets.Class, AllowMultiple=false)] + public class ServerAttribute : Attribute + { + public ServerAttribute(string name, int port) + { + Name = name; + Port = port; + } + + + /// + /// Gets the name of the server. + /// + public string Name { get; } + + /// + /// Gets the port of the server. + /// + public int Port { get; } + + } +} diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs index 95e86e9..217b9ee 100644 --- a/ShiftOS_TheReturn/ServerManager.cs +++ b/ShiftOS_TheReturn/ServerManager.cs @@ -36,6 +36,8 @@ using static ShiftOS.Engine.SaveSystem; using Newtonsoft.Json; using System.Net.Sockets; using System.Diagnostics; +using System.IO; +using System.Reflection; namespace ShiftOS.Engine { @@ -104,6 +106,43 @@ Ping: {ServerManager.DigitalSocietyPing} ms /// public static event Action GUIDReceived; + private static void delegateToServer(ServerMessage msg) + { + string[] split = msg.GUID.Split('|'); + bool finished = false; + foreach (var exec in Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + foreach(var type in asm.GetTypes().Where(x => x.GetInterfaces().Contains(typeof(Server)))) + { + var attrib = type.GetCustomAttributes().FirstOrDefault(x => x is ServerAttribute) as ServerAttribute; + if(attrib != null) + { + if(split[0] == SaveSystem.CurrentSave.SystemName && split[1] == attrib.Port.ToString()) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + type.GetMethods(BindingFlags.Public | BindingFlags.Instance).FirstOrDefault(x => x.Name == "MessageReceived")?.Invoke(Activator.CreateInstance(type), null); + finished = true; + } + } + } + } + } + catch { } + } + } + if (finished == false) + { + Forward(split[2], "Error", $"{split[0]}:{split[1]}: connection refused"); + } + } + + private static void ServerManager_MessageReceived(ServerMessage msg) { switch(msg.Name) @@ -119,12 +158,35 @@ Ping: {ServerManager.DigitalSocietyPing} ms })); } break; + case "msgtosys": + try + { + var m = JsonConvert.DeserializeObject(msg.Contents); + if(m.GUID.Split('|')[2] != thisGuid.ToString()) + { + delegateToServer(m); + } + } + catch { } + break; case "getguid_reply": GUIDReceived?.Invoke(msg.Contents); break; } } + public static void SendMessageToIngameServer(string sysname, int port, string title, string contents) + { + var smsg = new ServerMessage + { + Name = title, + GUID = $"{sysname}|{port}|{thisGuid.ToString()}", + Contents = contents + }; + Forward("all", "msgtosys", JsonConvert.SerializeObject(smsg)); + + } + public static void Detach_ServerManager_MessageReceived() { MessageReceived -= new ServerMessageReceived(ServerManager_MessageReceived); diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj index 8b48023..9d7d696 100644 --- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj +++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj @@ -124,6 +124,7 @@ + diff --git a/ShiftOS_TheReturn/TerminalBackend.cs b/ShiftOS_TheReturn/TerminalBackend.cs index c8619b5..b18e27c 100644 --- a/ShiftOS_TheReturn/TerminalBackend.cs +++ b/ShiftOS_TheReturn/TerminalBackend.cs @@ -84,6 +84,11 @@ namespace ShiftOS.Engine /// public static string LastCommand = ""; + /// + /// Gets the output of the last command. + /// + public static string LastCommandBuffer { get; private set; } + /// /// Invokes a ShiftOS terminal command. /// @@ -395,8 +400,10 @@ namespace ShiftOS.Engine } string buffer = tw.ToString(); + LastCommandBuffer = buffer; Console.SetOut(new TerminalTextWriter()); - Console.Write(buffer); + if(!isRemote) + Console.Write(buffer); } -- cgit v1.2.3 From 80899fc5de1c0c194043ce94a10707bf8b7afcf0 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 May 2017 10:12:59 -0400 Subject: Cool startup logo :smiley: --- ShiftOS.WinForms/Applications/ShiftLetters.cs | 2 +- ShiftOS.WinForms/Applications/ShiftSweeper.cs | 2 +- ShiftOS.WinForms/Resources/Shiftorium.txt | 14 --- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ .../ShiftnetSites/ShiftGames.Designer.cs | 74 ++++++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftGames.cs | 39 +++++++ ShiftOS.WinForms/ShiftnetSites/ShiftGames.resx | 125 +++++++++++++++++++++ ShiftOS_TheReturn/SaveSystem.cs | 26 +++++ 8 files changed, 275 insertions(+), 16 deletions(-) create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftGames.Designer.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftGames.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftGames.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index b5e9aa4..42e19f8 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -38,7 +38,7 @@ namespace ShiftOS.WinForms.Applications { [MultiplayerOnly] [Launcher("ShiftLetters", false, null, "Games")] - [RequiresUpgrade("shiftletters")] + [AppscapeEntry("ShiftLetters", "Let's see how much you know about ShiftOS by playing this tiny little Hangman game! Shiftorium Upgrades exist to allow you to buy different word sets!", 300, 150, null, "Games")] [WinOpen("shiftletters")] [DefaultIcon("iconShiftLetters")] public partial class ShiftLetters : UserControl, IShiftOSWindow diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index 72e9062..f23ed73 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -35,7 +35,7 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { [Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")] - [RequiresUpgrade("shiftsweeper")] + [AppscapeEntry("ShiftSweeper", "A simple Minesweeper game built for ShiftOS! Careful, it's a hard one.", 1600, 800, "shiftletters", "Games")] [MultiplayerOnly] [WinOpen("shiftsweeper")] [DefaultIcon("iconShiftSweeper")] diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index cc68c6f..41b50a7 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -151,13 +151,6 @@ }, // SHIFTLETTERS AND WORDLISTS - { - Name: "ShiftLetters", - Cost: 150, - Dependencies: null, - Category: "Applications", - Description: "Sick and tired of playing Pong? Buy this upgrade to get a whole new game!" - }, { Name: "AL ShiftLetters", Cost: 150, @@ -1028,13 +1021,6 @@ // SHIFTSWEEPER - { - Name: "ShiftSweeper", - Cost: 800, - Dependencies: "shiftletters", - Category: "Applications", - Description: "Getting bored with Pong and ShiftLetters? Try this BRAND NEW game called ShiftSweeper!" - }, { Name: "AL ShiftSweeper", Cost: 100, diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index da8eafc..9844657 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -382,6 +382,12 @@ MainHomepage.cs + + UserControl + + + ShiftGames.cs + @@ -574,6 +580,9 @@ MainHomepage.cs + + ShiftGames.cs + UniteLoginDialog.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftGames.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.Designer.cs new file mode 100644 index 0000000..3b4bf9e --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.Designer.cs @@ -0,0 +1,74 @@ +namespace ShiftOS.WinForms.ShiftnetSites +{ + partial class ShiftGames + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShiftGames)); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(571, 65); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "ShiftGames/Minimatch"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Fill; + this.label2.Location = new System.Drawing.Point(0, 65); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(571, 309); + this.label2.TabIndex = 1; + this.label2.Text = resources.GetString("label2.Text"); + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // ShiftGames + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "ShiftGames"; + this.Size = new System.Drawing.Size(571, 374); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftGames.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.cs new file mode 100644 index 0000000..4ce0435 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.ShiftnetSites +{ + [ShiftnetSite("shiftnet/main/shiftgames", "ShiftGames (formerly Minimatch)", "The one true Shiftnet site for virus-free, quality games.")] + public partial class ShiftGames : UserControl, IShiftnetSite + { + public ShiftGames() + { + InitializeComponent(); + } + + public event Action GoBack; + public event Action GoToUrl; + + public void OnSkinLoad() + { + ControlManager.SetupControls(this); + } + + public void OnUpgrade() + { + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftGames.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.resx new file mode 100644 index 0000000..ef8aebe --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftGames.resx @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ShiftGames has been shut down as of May 2016. We have moved our inventory to the Appscape Repository. Thanks for being with us, and apologies for the inconvenience. + +Copyright (c) 2014-2016 Maureen Fenn + + \ No newline at end of file diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs index 24a491d..489b718 100644 --- a/ShiftOS_TheReturn/SaveSystem.cs +++ b/ShiftOS_TheReturn/SaveSystem.cs @@ -298,6 +298,32 @@ namespace ShiftOS.Engine if (CurrentSave.Users == null) CurrentSave.Users = new List(); + Console.WriteLine($@" + `-:/++++::.` + .+ydNMMMMMNNMMMMMNhs/. + /yNMMmy+:-` `````.-/ohNMMms- + `oNMMh/.`:oydmNMMMMNmhs+- .+dMMm+` Welcome to ShiftOS. + `oMMmo``+dMMMMMMMMMMMMMMMMMNh/`.sNMN+ + :NMN+ -yMMMMMMMNdhyssyyhdmNMMMMNs``sMMd. SYSTEM STATUS: + oMMd.`sMMMMMMd+. `/MMMMN+ -mMN: ---------------------- + oMMh .mMMMMMM/ `-::::-.` :MMMMMMh`.mMM: + :MMd .NMMMMMMs .dMMMMMMMMMNddMMMMMMMd`.NMN. Codepoints: {SaveSystem.CurrentSave.Codepoints} + mMM. dMMMMMMMo -mMMMMMMMMMMMMMMMMMMMMs /MMy Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed + :MMh :MMMMMMMMm` .+shmMMMMMMMMMMMMMMMN` NMN` {Shiftorium.GetAvailable().Count()} available + oMM+ sMMMMMMMMMN+` `-/smMMMMMMMMMMM: hMM: Filesystems: {Utils.Mounts.Count} filesystems mounted in memory. + sMM+ sMMMMMMMMMMMMds/-` .sMMMMMMMMM/ yMM/ + +MMs +MMMMMMMMMMMMMMMMMmhs:` +MMMMMMMM- dMM- System name: {CurrentSave.SystemName.ToUpper()} + .MMm `NMMMMMMMMMMMMMMMMMMMMMo `NMMMMMMd .MMN Users: {Users.Count()} found. + hMM+ +MMMMMMmsdNMMMMMMMMMMN/ -MMMMMMN- yMM+ + `NMN- oMMMMMd `-/+osso+- .mMMMMMN: +MMd + -NMN: /NMMMm` :yMMMMMMm- oMMd` + -mMMs``sMMMMNdhso++///+oydNMMMMMMNo .hMMh` + `yMMm/ .omMMMMMMMMMMMMMMMMMMMMd+``oNMNo + -hMMNo. -ohNMMMMMMMMMMMMmy+. -yNMNy` + .sNMMms/. `-/+++++/:-` ./yNMMmo` + :sdMMMNdyso+++ooshdNMMMdo- + `:+yhmNNMMMMNNdhs+- + ```` "); if (CurrentSave.Users.Count == 0) { -- cgit v1.2.3 From 58c9152351b02b37e63fc193060474478f1e9a65 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 29 May 2017 11:38:11 -0400 Subject: various things from last night --- ShiftOS.WinForms/Applications/Chat.Designer.cs | 178 ++++++++++----------- ShiftOS.WinForms/Applications/Terminal.cs | 2 +- ShiftOS.WinForms/Oobe.cs | 2 +- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ .../ShiftnetSites/ShiftSoft_Ping.Designer.cs | 89 +++++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs | 92 +++++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx | 120 ++++++++++++++ ShiftOS.WinForms/Stories/LegionStory.cs | 6 + 8 files changed, 407 insertions(+), 91 deletions(-) create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index d51b732..7bfa4dd 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -54,6 +54,13 @@ namespace ShiftOS.WinForms.Applications { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Chat)); this.panel1 = new System.Windows.Forms.Panel(); + this.pnlstart = new System.Windows.Forms.Panel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.txtchatid = new System.Windows.Forms.TextBox(); + this.btnjoin = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.rtbchat = new System.Windows.Forms.RichTextBox(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tschatid = new System.Windows.Forms.ToolStripLabel(); @@ -61,18 +68,11 @@ namespace ShiftOS.WinForms.Applications this.tsbottombar = new System.Windows.Forms.ToolStrip(); this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); this.btnsend = new System.Windows.Forms.ToolStripButton(); - this.pnlstart = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.txtchatid = new System.Windows.Forms.TextBox(); - this.btnjoin = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); - this.toolStrip1.SuspendLayout(); - this.tsbottombar.SuspendLayout(); this.pnlstart.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.tsbottombar.SuspendLayout(); this.SuspendLayout(); // // panel1 @@ -87,6 +87,82 @@ namespace ShiftOS.WinForms.Applications this.panel1.Size = new System.Drawing.Size(633, 318); this.panel1.TabIndex = 0; // + // pnlstart + // + this.pnlstart.Controls.Add(this.flowLayoutPanel1); + this.pnlstart.Controls.Add(this.label3); + this.pnlstart.Controls.Add(this.label2); + this.pnlstart.Controls.Add(this.label1); + this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlstart.Location = new System.Drawing.Point(0, 25); + this.pnlstart.Name = "pnlstart"; + this.pnlstart.Size = new System.Drawing.Size(633, 268); + this.pnlstart.TabIndex = 4; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.txtchatid); + this.flowLayoutPanel1.Controls.Add(this.btnjoin); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); + this.flowLayoutPanel1.TabIndex = 3; + // + // txtchatid + // + this.txtchatid.Location = new System.Drawing.Point(3, 3); + this.txtchatid.Name = "txtchatid"; + this.txtchatid.Size = new System.Drawing.Size(192, 20); + this.txtchatid.TabIndex = 0; + // + // btnjoin + // + this.btnjoin.Location = new System.Drawing.Point(201, 3); + this.btnjoin.Name = "btnjoin"; + this.btnjoin.Size = new System.Drawing.Size(75, 23); + this.btnjoin.TabIndex = 1; + this.btnjoin.Text = "Join"; + this.btnjoin.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Location = new System.Drawing.Point(0, 85); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(10); + this.label3.Size = new System.Drawing.Size(79, 33); + this.label3.TabIndex = 2; + this.label3.Tag = "header3"; + this.label3.Text = "Join a chat"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(633, 52); + this.label2.TabIndex = 1; + this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + + " All you have to do is enter a chat code or system name, and SimpleSRC will try " + + "to initiate a chat for you."; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(143, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "Welcome to SimpleSRC!"; + // // rtbchat // this.rtbchat.Dock = System.Windows.Forms.DockStyle.Fill; @@ -151,82 +227,6 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // - // pnlstart - // - this.pnlstart.Controls.Add(this.flowLayoutPanel1); - this.pnlstart.Controls.Add(this.label3); - this.pnlstart.Controls.Add(this.label2); - this.pnlstart.Controls.Add(this.label1); - this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlstart.Location = new System.Drawing.Point(0, 25); - this.pnlstart.Name = "pnlstart"; - this.pnlstart.Size = new System.Drawing.Size(633, 268); - this.pnlstart.TabIndex = 4; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Dock = System.Windows.Forms.DockStyle.Top; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(10); - this.label1.Size = new System.Drawing.Size(143, 33); - this.label1.TabIndex = 0; - this.label1.Tag = "header1"; - this.label1.Text = "Welcome to SimpleSRC!"; - // - // label2 - // - this.label2.Dock = System.Windows.Forms.DockStyle.Top; - this.label2.Location = new System.Drawing.Point(0, 33); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(10); - this.label2.Size = new System.Drawing.Size(633, 52); - this.label2.TabIndex = 1; - this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + - " All you have to do is enter a chat code or system name, and SimpleSRC will try " + - "to initiate a chat for you."; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Dock = System.Windows.Forms.DockStyle.Top; - this.label3.Location = new System.Drawing.Point(0, 85); - this.label3.Name = "label3"; - this.label3.Padding = new System.Windows.Forms.Padding(10); - this.label3.Size = new System.Drawing.Size(79, 33); - this.label3.TabIndex = 2; - this.label3.Tag = "header3"; - this.label3.Text = "Join a chat"; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.Controls.Add(this.txtchatid); - this.flowLayoutPanel1.Controls.Add(this.btnjoin); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); - this.flowLayoutPanel1.TabIndex = 3; - // - // txtchatid - // - this.txtchatid.Location = new System.Drawing.Point(3, 3); - this.txtchatid.Name = "txtchatid"; - this.txtchatid.Size = new System.Drawing.Size(192, 20); - this.txtchatid.TabIndex = 0; - // - // btnjoin - // - this.btnjoin.Location = new System.Drawing.Point(201, 3); - this.btnjoin.Name = "btnjoin"; - this.btnjoin.Size = new System.Drawing.Size(75, 23); - this.btnjoin.TabIndex = 1; - this.btnjoin.Text = "Join"; - this.btnjoin.UseVisualStyleBackColor = true; - // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -236,14 +236,14 @@ 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.pnlstart.ResumeLayout(false); this.pnlstart.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.tsbottombar.ResumeLayout(false); + this.tsbottombar.PerformLayout(); this.ResumeLayout(false); } diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index de4888b..2d2b4c5 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -232,7 +232,7 @@ namespace ShiftOS.WinForms.Applications var text = txt.Lines.ToArray(); var text2 = text[text.Length - 1]; var text3 = ""; - Console.WriteLine(); + txt.AppendText(Environment.NewLine); var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); if (IsInRemoteSystem == true) diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 90395a7..9182b4b 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -302,7 +302,7 @@ namespace ShiftOS.WinForms var client = new UniteClient("http://getshiftos.ml", token); var sve = new Save(); - SaveSystem.CurrentUser.Username = client.GetEmail(); + sve.Username = client.GetEmail(); sve.Password = Guid.NewGuid().ToString(); sve.SystemName = client.GetSysName(); sve.UniteAuthToken = token; diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9844657..22bd1d2 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -388,6 +388,12 @@ ShiftGames.cs + + UserControl + + + ShiftSoft_Ping.cs + @@ -583,6 +589,9 @@ ShiftGames.cs + + ShiftSoft_Ping.cs + UniteLoginDialog.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs new file mode 100644 index 0000000..244f6d4 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.Designer.cs @@ -0,0 +1,89 @@ +namespace ShiftOS.WinForms.ShiftnetSites +{ + partial class ShiftSoft_Ping + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.fllist = new System.Windows.Forms.FlowLayoutPanel(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(48, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "Ping"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(734, 56); + this.label2.TabIndex = 1; + this.label2.Text = "Ping is a simple service that lets you see all the sites on the shiftnet/ cluster" + + ". These sites are safe for you to use and do not contain malware or other threat" + + "s."; + // + // fllist + // + this.fllist.Dock = System.Windows.Forms.DockStyle.Fill; + this.fllist.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.fllist.Location = new System.Drawing.Point(0, 89); + this.fllist.Name = "fllist"; + this.fllist.Size = new System.Drawing.Size(734, 389); + this.fllist.TabIndex = 2; + // + // ShiftSoft_Ping + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.fllist); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.Name = "ShiftSoft_Ping"; + this.Size = new System.Drawing.Size(734, 478); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.FlowLayoutPanel fllist; + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs new file mode 100644 index 0000000..1c64390 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Reflection; +using System.IO; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.ShiftnetSites +{ + [ShiftnetSite("shiftnet/shiftsoft/ping", "Ping", "A site listing hosted by ShiftSoft.")] + public partial class ShiftSoft_Ping : UserControl, IShiftnetSite + { + public ShiftSoft_Ping() + { + InitializeComponent(); + } + + public event Action GoBack; + public event Action GoToUrl; + + public void OnLoad() + { + SetupListing(); + } + + public void OnSkinLoad() + { + ControlManager.SetupControls(this); + SetupListing(); + } + + public void SetupListing() + { + foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exec); + var types = asm.GetTypes(); + foreach (var type in types) + { + if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) + { + var attr = type.GetCustomAttributes(false).Where(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + if (attr != null) + { + var lnk = new LinkLabel(); + lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; + lnk.Tag = "header3"; + lnk.Text = attr.Name; + var desc = new Label(); + desc.AutoSize = true; + lnk.AutoSize = true; + desc.MaximumSize = new Size(this.Width / 3, 0); + desc.Text = attr.Description; + lnk.Click += (o, a) => + { + GoToUrl?.Invoke(attr.Url); + }; + fllist.Controls.Add(lnk); + fllist.Controls.Add(desc); + ControlManager.SetupControls(lnk); + lnk.Show(); + desc.Show(); + } + } + } + } + catch { } + } + } + } + + public void OnUpgrade() + { + } + + public void Setup() + { + SetupListing(); + } + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 433ad2d..a0fc9bf 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -51,6 +51,8 @@ namespace ShiftOS.WinForms.Stories Desktop.InvokeOnWorkerThread(() => { Story.Start("installer"); + while (!Shiftorium.UpgradeInstalled("installer")) + Thread.Sleep(20); AppearanceManager.SetupWindow(installer); installer.InitiateInstall(new ShiftnetInstallation()); }); @@ -64,6 +66,10 @@ namespace ShiftOS.WinForms.Stories WriteLine("There are also lots of companies offering many services."); WriteLine("I'd stay on the shiftnet/ cluster though, others may be dangerous."); WriteLine("I'd also stick to the sites listed on shiftnet/shiftsoft/ping - that site is regularly updated with the most safe Shiftnet sites."); + WriteLine("Oh, that reminds me. I have set you up with ShiftSoft's service provider, Freebie Solutions."); + WriteLine("It's a free provider, but it offers only 256 bytes per second download and upload speeds."); + WriteLine("You may want to go look for another provider when you can afford it."); + WriteLine("Trust me - with this provider, things get slow."); WriteLine("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); TerminalBackend.PrefixEnabled = true; -- cgit v1.2.3 From 0451b5d15703987b6be1160917ea31d36f6ee125 Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 30 May 2017 16:34:31 -0400 Subject: Slight Shiftnet mods, new default skin. --- ShiftOS.WinForms/Applications/Chat.resx | 6 ++ ShiftOS.WinForms/Applications/Shiftnet.cs | 3 + ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ .../ShiftnetSites/ShiftSoft.Designer.cs | 61 +++++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs | 38 +++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs | 51 +++++---- ShiftOS_TheReturn/Skinning.cs | 12 +-- 8 files changed, 271 insertions(+), 29 deletions(-) create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs create mode 100644 ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index a7b2b93..e4a35ad 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -123,6 +123,12 @@ 122, 17 + + 17, 17 + + + 122, 17 + diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 7f5d3c1..22b53a0 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -80,6 +80,7 @@ namespace ShiftOS.WinForms.Applications txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2); txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width*2) - 2; btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2); + flcontrols.BackColor = SkinEngine.LoadedSkin.TitleBackgroundColor; } public bool OnUnload() @@ -147,6 +148,7 @@ namespace ShiftOS.WinForms.Applications public void NavigateToUrl(string url) { + txturl.Text = url; foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) { @@ -188,6 +190,7 @@ namespace ShiftOS.WinForms.Applications obj.OnUpgrade(); obj.OnSkinLoad(); obj.Setup(); + AppearanceManager.SetWindowTitle(this, attribute.Name + " - Shiftnet"); return; } } diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 22bd1d2..65a512e 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -388,6 +388,12 @@ ShiftGames.cs + + UserControl + + + ShiftSoft.cs + UserControl @@ -589,6 +595,9 @@ ShiftGames.cs + + ShiftSoft.cs + ShiftSoft_Ping.cs diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs new file mode 100644 index 0000000..a62b5a8 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.Designer.cs @@ -0,0 +1,61 @@ +namespace ShiftOS.WinForms.ShiftnetSites +{ + partial class ShiftSoft + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Font = new System.Drawing.Font("Franklin Gothic Heavy", 24.75F, System.Drawing.FontStyle.Italic); + this.label1.Location = new System.Drawing.Point(13, 17); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(152, 38); + this.label1.TabIndex = 0; + this.label1.Tag = "keepfont"; + this.label1.Text = "Shiftsoft"; + // + // ShiftSoft + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "ShiftSoft"; + this.Size = new System.Drawing.Size(523, 384); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs new file mode 100644 index 0000000..18968cd --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.ShiftnetSites +{ + [ShiftnetSite("shiftnet/shiftsoft", "ShiftSoft", "What do you want to shift today?")] + [ShiftnetFundamental] + public partial class ShiftSoft : UserControl, IShiftnetSite + { + public ShiftSoft() + { + InitializeComponent(); + } + + public event Action GoBack; + public event Action GoToUrl; + + public void OnSkinLoad() + { + } + + public void OnUpgrade() + { + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs index 1c64390..1593117 100644 --- a/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs +++ b/ShiftOS.WinForms/ShiftnetSites/ShiftSoft_Ping.cs @@ -25,11 +25,6 @@ namespace ShiftOS.WinForms.ShiftnetSites public event Action GoBack; public event Action GoToUrl; - public void OnLoad() - { - SetupListing(); - } - public void OnSkinLoad() { ControlManager.SetupControls(this); @@ -38,6 +33,7 @@ namespace ShiftOS.WinForms.ShiftnetSites public void SetupListing() { + fllist.Controls.Clear(); foreach(var exec in Directory.GetFiles(Environment.CurrentDirectory)) { if(exec.ToLower().EndsWith(".exe") || exec.ToLower().EndsWith(".dll")) @@ -50,27 +46,36 @@ namespace ShiftOS.WinForms.ShiftnetSites { if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) { - var attr = type.GetCustomAttributes(false).Where(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; + var attr = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; if (attr != null) { - var lnk = new LinkLabel(); - lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; - lnk.Tag = "header3"; - lnk.Text = attr.Name; - var desc = new Label(); - desc.AutoSize = true; - lnk.AutoSize = true; - desc.MaximumSize = new Size(this.Width / 3, 0); - desc.Text = attr.Description; - lnk.Click += (o, a) => + if (attr.Url.StartsWith("shiftnet/")) { - GoToUrl?.Invoke(attr.Url); - }; - fllist.Controls.Add(lnk); - fllist.Controls.Add(desc); - ControlManager.SetupControls(lnk); - lnk.Show(); - desc.Show(); + var lnk = new LinkLabel(); + lnk.LinkColor = SkinEngine.LoadedSkin.ControlTextColor; + lnk.Text = attr.Name; + var desc = new Label(); + desc.AutoSize = true; + lnk.AutoSize = true; + desc.MaximumSize = new Size(this.Width / 3, 0); + desc.Text = attr.Description; + desc.Padding = new Padding + { + Bottom = 25, + Top = 0, + Left = 10, + Right = 10 + }; + lnk.Click += (o, a) => + { + GoToUrl?.Invoke(attr.Url); + }; + fllist.Controls.Add(lnk); + fllist.Controls.Add(desc); + ControlManager.SetupControls(lnk); + lnk.Show(); + desc.Show(); + } } } } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index f5dd211..5bd4ab1 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -332,18 +332,18 @@ namespace ShiftOS.Engine public class Skin { //borrowing from the discourse theme for the default skin - private static readonly Color DefaultBackground = Color.FromArgb(0, 0x44, 0x00); + private static readonly Color DefaultBackground = Color.FromArgb(0x11, 0x11, 0x11); private static readonly Color DefaultForeground = Color.FromArgb(0xDD, 0xDD, 0xDD); private static readonly Color Accent1 = Color.FromArgb(0x66, 0x66, 0x66); private static readonly Color Accent2 = Color.FromArgb(0x80, 0, 0); - private static readonly Color DesktopBG = Color.FromArgb(0x22, 0x22, 0x22); + private static readonly Color DesktopBG = Color.FromArgb(0x00, 0x00, 0x00); private static readonly Font SysFont = new Font("Tahoma", 9F); private static readonly Font SysFont2 = new Font("Tahoma", 10F, FontStyle.Bold); - private static readonly Font Header1 = new Font("Helvetica", 20F, FontStyle.Bold); - private static readonly Font Header2 = new Font("Helvetica", 17.5F, FontStyle.Bold); - private static readonly Font Header3 = new Font("Tahoma", 15F, FontStyle.Bold); + private static readonly Font Header1 = new Font("Courier New", 20F, FontStyle.Bold); + private static readonly Font Header2 = new Font("Courier New", 17.5F, FontStyle.Bold); + private static readonly Font Header3 = new Font("Courier New", 15F, FontStyle.Bold); - private static readonly Color TitleBG = Color.FromArgb(0x11, 0x11, 0x11); + private static readonly Color TitleBG = Color.FromArgb(0x55, 0x11, 0x11); private static readonly Color TitleFG = Color.FromArgb(0xaa, 0xaa, 0xaa); //Todo: When making Shifter GUI we need to label all these with proper Shifter attributes to get 'em displaying in the right places. -- cgit v1.2.3 From 324104eb0b8650969b2205404e3ad83401fb100e Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 31 May 2017 19:23:40 -0400 Subject: volume control slider and other goodies --- ShiftOS.WinForms/Controls/ShiftedProgressBar.cs | 88 ++++++++------- ShiftOS.WinForms/Properties/Resources.Designer.cs | 16 ++- ShiftOS.WinForms/Properties/Resources.resx | 3 + ShiftOS.WinForms/Resources/iconSpeaker.bmp | Bin 0 -> 3382 bytes ShiftOS.WinForms/ShiftOS.WinForms.csproj | 19 ++++ .../StatusIcons/ShiftnetStatus.Designer.cs | 90 ++++++++++++++++ ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs | 33 ++++++ ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/StatusIcons/Volume.Designer.cs | 59 ++++++++++ ShiftOS.WinForms/StatusIcons/Volume.cs | 67 ++++++++++++ ShiftOS.WinForms/StatusIcons/Volume.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/Tools/ControlManager.cs | 15 ++- ShiftOS.WinForms/WinformsDesktop.Designer.cs | 29 ++--- ShiftOS.WinForms/WinformsDesktop.cs | 32 +++--- ShiftOS.WinForms/WinformsDesktop.resx | 3 - 15 files changed, 617 insertions(+), 77 deletions(-) create mode 100644 ShiftOS.WinForms/Resources/iconSpeaker.bmp create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs create mode 100644 ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.cs create mode 100644 ShiftOS.WinForms/StatusIcons/Volume.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs index ceaff02..c5a6d05 100644 --- a/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs +++ b/ShiftOS.WinForms/Controls/ShiftedProgressBar.cs @@ -140,51 +140,65 @@ namespace ShiftOS.WinForms.Controls protected override void OnPaint(PaintEventArgs pe) { - pe.Graphics.Clear(this.RealBackColor); - if(RealBackgroundImage != null) + try { - pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); - } - switch (Style) - { - case ProgressBarStyle.Continuous: - double width = linear(this.Value, 0, this.Maximum, 0, this.Width); - if (ProgressImage != null) - { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); - } - else - { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height)); - } - break; - case ProgressBarStyle.Blocks: - int block_count = this.Width / (this.BlockSize + 2); - int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); - for(int i = 0; i < blocks - 1; i++) - { - int position = i * (BlockSize + 2); + pe.Graphics.Clear(this.RealBackColor); + if (RealBackgroundImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(RealBackgroundImage), new Rectangle(0, 0, this.Width, this.Height)); + } + switch (Style) + { + case ProgressBarStyle.Continuous: + double width = linear(this.Value, 0, this.Maximum, 0, this.Width); if (ProgressImage != null) { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new RectangleF(0, 0, (float)width, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new RectangleF(0, 0, (float)width, this.Height)); + } + break; + case ProgressBarStyle.Blocks: + int block_count = this.Width / (this.BlockSize + 2); + int blocks = (int)linear(this.Value, 0, this.Maximum, 0, block_count); + for (int i = 0; i < blocks - 1; i++) + { + int position = i * (BlockSize + 2); + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(position, 0, BlockSize, this.Height)); + } + else + { + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + } + } + break; + case ProgressBarStyle.Marquee: + if (ProgressImage != null) + { + pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); } else { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(position, 0, BlockSize, this.Height)); + pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); } - } - break; - case ProgressBarStyle.Marquee: - if (ProgressImage != null) - { - pe.Graphics.FillRectangle(new TextureBrush(ProgressImage), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); - } - else - { - pe.Graphics.FillRectangle(new SolidBrush(ProgressColor), new Rectangle(_marqueePos, 0, this.Width / 4, this.Height)); - } - break; + break; + } + } + catch + { + pe.Graphics.Clear(Color.Black); + string text = "Preview mode. This control can't be drawn without an initiated ShiftOS engine."; + SizeF sz = pe.Graphics.MeasureString(text, this.Font); + PointF loc = new PointF( + (this.Width - sz.Width) / 2, + (this.Height - sz.Height) / 2 + ); + pe.Graphics.DrawString(text, Font, new SolidBrush(Color.White), loc); } } diff --git a/ShiftOS.WinForms/Properties/Resources.Designer.cs b/ShiftOS.WinForms/Properties/Resources.Designer.cs index 3e83c3f..0386237 100644 --- a/ShiftOS.WinForms/Properties/Resources.Designer.cs +++ b/ShiftOS.WinForms/Properties/Resources.Designer.cs @@ -947,6 +947,16 @@ namespace ShiftOS.WinForms.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap iconSpeaker { + get { + object obj = ResourceManager.GetObject("iconSpeaker", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// @@ -1103,9 +1113,9 @@ namespace ShiftOS.WinForms.Properties { /// Category: "Enhancements", /// }, /// { - /// Name: "GUI Based Login Screen", - /// Cost: 500, - /// Description: "Tired of using the text-based login screen in ShiftOS? Well, we have a functioning window manager, and a functioning desktop, w [rest of string was truncated]";. + /// Name: "Shift Progress Bar", + /// Cost: 150, + /// Description: "Want to customize the look of all ShiftOS Progress Bars? Buy this upgrade today and you'll get the ability to set the foreground an [rest of string was truncated]";. /// internal static string Shiftorium { get { diff --git a/ShiftOS.WinForms/Properties/Resources.resx b/ShiftOS.WinForms/Properties/Resources.resx index 1db7a46..d1a3544 100644 --- a/ShiftOS.WinForms/Properties/Resources.resx +++ b/ShiftOS.WinForms/Properties/Resources.resx @@ -34603,4 +34603,7 @@ ..\Resources\notestate_connection_full.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\iconSpeaker.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/iconSpeaker.bmp b/ShiftOS.WinForms/Resources/iconSpeaker.bmp new file mode 100644 index 0000000..ec2defb Binary files /dev/null and b/ShiftOS.WinForms/Resources/iconSpeaker.bmp differ diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 65a512e..fd875e9 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -403,6 +403,18 @@ + + UserControl + + + ShiftnetStatus.cs + + + UserControl + + + Volume.cs + @@ -601,6 +613,12 @@ ShiftSoft_Ping.cs + + ShiftnetStatus.cs + + + Volume.cs + UniteLoginDialog.cs @@ -827,6 +845,7 @@ + diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs new file mode 100644 index 0000000..65aed28 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.Designer.cs @@ -0,0 +1,90 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class ShiftnetStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.lbserviceprovider = new System.Windows.Forms.Label(); + this.lbstatus = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(5); + this.label1.Size = new System.Drawing.Size(53, 23); + this.label1.TabIndex = 0; + this.label1.Tag = "header2"; + this.label1.Text = "Shiftnet"; + // + // lbserviceprovider + // + this.lbserviceprovider.AutoSize = true; + this.lbserviceprovider.Dock = System.Windows.Forms.DockStyle.Top; + this.lbserviceprovider.Location = new System.Drawing.Point(0, 23); + this.lbserviceprovider.Name = "lbserviceprovider"; + this.lbserviceprovider.Padding = new System.Windows.Forms.Padding(5); + this.lbserviceprovider.Size = new System.Drawing.Size(98, 23); + this.lbserviceprovider.TabIndex = 1; + this.lbserviceprovider.Tag = "header3"; + this.lbserviceprovider.Text = "Freebie Solutions"; + // + // lbstatus + // + this.lbstatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbstatus.Location = new System.Drawing.Point(0, 46); + this.lbstatus.Name = "lbstatus"; + this.lbstatus.Padding = new System.Windows.Forms.Padding(5); + this.lbstatus.Size = new System.Drawing.Size(331, 144); + this.lbstatus.TabIndex = 2; + this.lbstatus.Text = "This will show the Shiftnet status."; + // + // ShiftnetStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbstatus); + this.Controls.Add(this.lbserviceprovider); + this.Controls.Add(this.label1); + this.Name = "ShiftnetStatus"; + this.Size = new System.Drawing.Size(331, 190); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label lbserviceprovider; + private System.Windows.Forms.Label lbstatus; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs new file mode 100644 index 0000000..f1d31af --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconShiftnet")] + [RequiresUpgrade("victortran_shiftnet")] + public partial class ShiftnetStatus : UserControl, IStatusIcon + { + public ShiftnetStatus() + { + InitializeComponent(); + } + + public void Setup() + { + var subscription = Applications.DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription]; + float kilobytes = (float)subscription.DownloadSpeed / 1024F; + lbserviceprovider.Text = subscription.Name; + lbstatus.Text = $@"Company: {subscription.Company} +Download speed (KB/s): {kilobytes}"; + + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/ShiftnetStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs new file mode 100644 index 0000000..aa8aa7a --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.Designer.cs @@ -0,0 +1,59 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class Volume + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.lbvolume = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbvolume + // + this.lbvolume.AutoSize = true; + this.lbvolume.Location = new System.Drawing.Point(4, 4); + this.lbvolume.Name = "lbvolume"; + this.lbvolume.Size = new System.Drawing.Size(81, 13); + this.lbvolume.TabIndex = 0; + this.lbvolume.Text = "System volume:"; + // + // Volume + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbvolume); + this.Name = "Volume"; + this.Size = new System.Drawing.Size(444, 44); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbvolume; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/Volume.cs b/ShiftOS.WinForms/StatusIcons/Volume.cs new file mode 100644 index 0000000..329faf0 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.WinForms.Controls; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconSpeaker")] + public partial class Volume : UserControl, IStatusIcon + { + public Volume() + { + InitializeComponent(); + } + + public void Setup() + { + lbvolume.Top = (this.Height - lbvolume.Height) / 2; + bool moving = false; + var prg = new ShiftedProgressBar(); + prg.Tag = "ignoreal"; //Don't close AL or current widget when this control is clicked. + this.Controls.Add(prg); + prg.Height = this.Height / 3; + prg.Maximum = 100; + prg.Value = SaveSystem.CurrentSave.MusicVolume; + prg.Width = this.Width - lbvolume.Width - 50; + prg.Left = lbvolume.Left + lbvolume.Width + 15; + prg.Top = (this.Height - prg.Height) / 2; + prg.MouseDown += (o, a) => + { + moving = true; + }; + + prg.MouseMove += (o, a) => + { + if (moving) + { + int val = (int)linear(a.X, 0, prg.Width, 0, 100); + SaveSystem.CurrentSave.MusicVolume = val; + prg.Value = val; + } + }; + + prg.MouseUp += (o, a) => + { + moving = false; + }; + prg.Show(); + } + + static public double linear(double x, double x0, double x1, double y0, double y1) + { + if ((x1 - x0) == 0) + { + return (y0 + y1) / 2; + } + return y0 + (x - x0) * (y1 - y0) / (x1 - x0); + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/Volume.resx b/ShiftOS.WinForms/StatusIcons/Volume.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/Volume.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 92482fa..548a62a 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -158,6 +158,15 @@ namespace ShiftOS.WinForms.Tools } catch { } + if (!tag.Contains("ignoreal")) + { + ctrl.Click += (o, a) => + { + Desktop.HideAppLauncher(); + }; + + } + if (!tag.Contains("keepbg")) { if (ctrl.BackColor != Control.DefaultBackColor) @@ -279,6 +288,8 @@ namespace ShiftOS.WinForms.Tools { (ctrl as WindowBorder).Setup(); } + + MakeDoubleBuffered(ctrl); ControlSetup?.Invoke(ctrl); }); @@ -305,10 +316,6 @@ namespace ShiftOS.WinForms.Tools public static void SetupControls(Control frm, bool runInThread = true) { - frm.Click += (o, a) => - { - Desktop.HideAppLauncher(); - }; var ctrls = frm.Controls.ToList(); for (int i = 0; i < ctrls.Count(); i++) { diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 968a31c..d82bc0c 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -55,6 +55,7 @@ namespace ShiftOS.WinForms this.desktoppanel = new System.Windows.Forms.Panel(); this.pnlnotifications = new System.Windows.Forms.Panel(); this.flnotifications = new System.Windows.Forms.FlowLayoutPanel(); + this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); this.lbtime = new System.Windows.Forms.Label(); this.panelbuttonholder = new System.Windows.Forms.FlowLayoutPanel(); this.sysmenuholder = new System.Windows.Forms.Panel(); @@ -63,7 +64,6 @@ namespace ShiftOS.WinForms this.pnlscreensaver = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); this.pnlwidgetlayer = new System.Windows.Forms.Panel(); - this.ntconnectionstatus = new System.Windows.Forms.PictureBox(); this.pnlnotificationbox = new System.Windows.Forms.Panel(); this.lbnotemsg = new System.Windows.Forms.Label(); this.lbnotetitle = new System.Windows.Forms.Label(); @@ -77,10 +77,10 @@ namespace ShiftOS.WinForms this.desktoppanel.SuspendLayout(); this.pnlnotifications.SuspendLayout(); this.flnotifications.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).BeginInit(); this.pnlnotificationbox.SuspendLayout(); this.pnladvancedal.SuspendLayout(); this.pnlalsystemactions.SuspendLayout(); @@ -121,6 +121,18 @@ namespace ShiftOS.WinForms this.flnotifications.Name = "flnotifications"; this.flnotifications.Size = new System.Drawing.Size(22, 24); this.flnotifications.TabIndex = 1; + this.flnotifications.WrapContents = false; + // + // ntconnectionstatus + // + this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; + this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); + this.ntconnectionstatus.Name = "ntconnectionstatus"; + this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); + this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; + this.ntconnectionstatus.TabIndex = 0; + this.ntconnectionstatus.TabStop = false; + this.ntconnectionstatus.Tag = "digitalsociety"; // // lbtime // @@ -200,17 +212,6 @@ namespace ShiftOS.WinForms this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); this.pnlwidgetlayer.TabIndex = 1; // - // ntconnectionstatus - // - this.ntconnectionstatus.Image = global::ShiftOS.WinForms.Properties.Resources.notestate_connection_full; - this.ntconnectionstatus.Location = new System.Drawing.Point(3, 3); - this.ntconnectionstatus.Name = "ntconnectionstatus"; - this.ntconnectionstatus.Size = new System.Drawing.Size(16, 16); - this.ntconnectionstatus.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize; - this.ntconnectionstatus.TabIndex = 0; - this.ntconnectionstatus.TabStop = false; - this.ntconnectionstatus.Tag = "digitalsociety"; - // // pnlnotificationbox // this.pnlnotificationbox.AutoSize = true; @@ -341,12 +342,12 @@ namespace ShiftOS.WinForms this.pnlnotifications.PerformLayout(); this.flnotifications.ResumeLayout(false); this.flnotifications.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); this.sysmenuholder.ResumeLayout(false); this.sysmenuholder.PerformLayout(); this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.ntconnectionstatus)).EndInit(); this.pnlnotificationbox.ResumeLayout(false); this.pnlnotificationbox.PerformLayout(); this.pnladvancedal.ResumeLayout(false); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index b9c4f37..f1dbe48 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -85,27 +85,24 @@ namespace ShiftOS.WinForms ic.Tag = itype.Name.ToLower(); //Next get the icon data if any. - var iconattrib = itype.GetCustomAttributes(false).FirstOrDefault(x => x is DefaultIconAttribute) as DefaultIconAttribute; - if(iconattrib != null) - { //We can use this attribute's ID in the skin engine to get an icon. - var img = GetIcon(iconattrib.ID); + var img = GetIcon(itype.Name); //Make it transparent. - (img as Bitmap).MakeTransparent(LoadedSkin.SystemKey); + (img as Bitmap).MakeTransparent(Color.White); //Assign it to the control ic.Image = img; //Set the sizing mode ic.SizeMode = PictureBoxSizeMode.StretchImage; - } - else - { - ic.BackColor = Color.White; //TODO: Make it skinnable. - } - ic.Size = new Size(20, 20); //TODO: make it skinnable + ic.Size = new Size(16, 16); //TODO: make it skinnable //add to the notification tray flnotifications.Controls.Add(ic); ic.Show(); + ic.BringToFront(); + + flnotifications.Show(); + + ic.Click += (o, a) => { HideAppLauncher(); @@ -115,7 +112,14 @@ namespace ShiftOS.WinForms UserControl ctrl = (UserControl)Activator.CreateInstance(itype); (ctrl as IStatusIcon).Setup(); currentSettingsPane = ctrl; - if(LoadedSkin.DesktopPanelPosition == 0) + ControlManager.SetupControls(ctrl); + this.Controls.Add(ctrl); + ctrl.BringToFront(); + int left = ic.Parent.PointToScreen(ic.Location).X; + int realleft = left - ctrl.Width; + realleft += ic.Width; + ctrl.Left = realleft; + if (LoadedSkin.DesktopPanelPosition == 0) { ctrl.Top = desktoppanel.Height; } @@ -123,10 +127,6 @@ namespace ShiftOS.WinForms { ctrl.Top = this.Height - desktoppanel.Height - ctrl.Height; } - int noteleft = flnotifications.PointToScreen(ic.Location).X; - int realleft = (this.Width - (noteleft + ic.Width)) - ctrl.Width; - ctrl.Left = realleft; - ControlManager.SetupControls(ctrl); ctrl.Show(); } diff --git a/ShiftOS.WinForms/WinformsDesktop.resx b/ShiftOS.WinForms/WinformsDesktop.resx index b77504b..d5494e3 100644 --- a/ShiftOS.WinForms/WinformsDesktop.resx +++ b/ShiftOS.WinForms/WinformsDesktop.resx @@ -120,7 +120,4 @@ 17, 17 - - 17, 17 - \ No newline at end of file -- cgit v1.2.3 From 03cf891c53cc648bb1ed4ea3d78755c1a440a713 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 1 Jun 2017 17:09:22 -0400 Subject: Icon Manager and various icon bugfixes. --- .../Applications/IconManager.Designer.cs | 163 ++++++++++++++ ShiftOS.WinForms/Applications/IconManager.cs | 244 +++++++++++++++++++++ ShiftOS.WinForms/Applications/IconManager.resx | 120 ++++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 14 ++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 18 ++ .../StatusIcons/TestStatus.Designer.cs | 60 +++++ ShiftOS.WinForms/StatusIcons/TestStatus.cs | 26 +++ ShiftOS.WinForms/StatusIcons/TestStatus.resx | 120 ++++++++++ ShiftOS_TheReturn/Skinning.cs | 10 +- 9 files changed, 774 insertions(+), 1 deletion(-) create mode 100644 ShiftOS.WinForms/Applications/IconManager.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/IconManager.cs create mode 100644 ShiftOS.WinForms/Applications/IconManager.resx create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.cs create mode 100644 ShiftOS.WinForms/StatusIcons/TestStatus.resx (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/Applications/IconManager.Designer.cs b/ShiftOS.WinForms/Applications/IconManager.Designer.cs new file mode 100644 index 0000000..25bcee4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.Designer.cs @@ -0,0 +1,163 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class IconManager + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnclose = new System.Windows.Forms.Button(); + this.btnreset = new System.Windows.Forms.Button(); + this.btnapply = new System.Windows.Forms.Button(); + this.flbody = new System.Windows.Forms.FlowLayoutPanel(); + this.lbcurrentpage = new System.Windows.Forms.Label(); + this.btnprev = new System.Windows.Forms.Button(); + this.btnnext = new System.Windows.Forms.Button(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.btnclose); + this.flowLayoutPanel1.Controls.Add(this.btnreset); + this.flowLayoutPanel1.Controls.Add(this.btnapply); + this.flowLayoutPanel1.Controls.Add(this.lbcurrentpage); + this.flowLayoutPanel1.Controls.Add(this.btnprev); + this.flowLayoutPanel1.Controls.Add(this.btnnext); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 416); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(393, 29); + this.flowLayoutPanel1.TabIndex = 0; + // + // btnclose + // + this.btnclose.AutoSize = true; + this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnclose.Location = new System.Drawing.Point(3, 3); + this.btnclose.Name = "btnclose"; + this.btnclose.Size = new System.Drawing.Size(43, 23); + this.btnclose.TabIndex = 0; + this.btnclose.Text = "Close"; + this.btnclose.UseVisualStyleBackColor = true; + this.btnclose.Click += new System.EventHandler(this.btnclose_Click); + // + // btnreset + // + this.btnreset.AutoSize = true; + this.btnreset.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnreset.Location = new System.Drawing.Point(52, 3); + this.btnreset.Name = "btnreset"; + this.btnreset.Size = new System.Drawing.Size(45, 23); + this.btnreset.TabIndex = 1; + this.btnreset.Text = "Reset"; + this.btnreset.UseVisualStyleBackColor = true; + this.btnreset.Click += new System.EventHandler(this.btnreset_Click); + // + // btnapply + // + this.btnapply.AutoSize = true; + this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnapply.Location = new System.Drawing.Point(103, 3); + this.btnapply.Name = "btnapply"; + this.btnapply.Size = new System.Drawing.Size(43, 23); + this.btnapply.TabIndex = 2; + this.btnapply.Text = "Apply"; + this.btnapply.UseVisualStyleBackColor = true; + this.btnapply.Click += new System.EventHandler(this.btnapply_Click); + // + // flbody + // + this.flbody.Dock = System.Windows.Forms.DockStyle.Fill; + this.flbody.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flbody.Location = new System.Drawing.Point(0, 0); + this.flbody.Name = "flbody"; + this.flbody.Size = new System.Drawing.Size(393, 416); + this.flbody.TabIndex = 1; + this.flbody.WrapContents = false; + // + // lbcurrentpage + // + this.lbcurrentpage.AutoSize = true; + this.lbcurrentpage.Location = new System.Drawing.Point(152, 0); + this.lbcurrentpage.Name = "lbcurrentpage"; + this.lbcurrentpage.Size = new System.Drawing.Size(71, 13); + this.lbcurrentpage.TabIndex = 3; + this.lbcurrentpage.Text = "Current page:"; + // + // btnprev + // + this.btnprev.AutoSize = true; + this.btnprev.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnprev.Location = new System.Drawing.Point(229, 3); + this.btnprev.Name = "btnprev"; + this.btnprev.Size = new System.Drawing.Size(51, 23); + this.btnprev.TabIndex = 4; + this.btnprev.Text = " < Prev"; + this.btnprev.UseVisualStyleBackColor = true; + this.btnprev.Click += new System.EventHandler(this.btnprev_Click); + // + // btnnext + // + this.btnnext.AutoSize = true; + this.btnnext.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnnext.Location = new System.Drawing.Point(286, 3); + this.btnnext.Name = "btnnext"; + this.btnnext.Size = new System.Drawing.Size(48, 23); + this.btnnext.TabIndex = 5; + this.btnnext.Text = "Next >"; + this.btnnext.UseVisualStyleBackColor = true; + this.btnnext.Click += new System.EventHandler(this.btnnext_Click); + // + // IconManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.flbody); + this.Controls.Add(this.flowLayoutPanel1); + this.Name = "IconManager"; + this.Size = new System.Drawing.Size(393, 445); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnclose; + private System.Windows.Forms.Button btnreset; + private System.Windows.Forms.Button btnapply; + private System.Windows.Forms.FlowLayoutPanel flbody; + private System.Windows.Forms.Label lbcurrentpage; + private System.Windows.Forms.Button btnprev; + private System.Windows.Forms.Button btnnext; + } +} diff --git a/ShiftOS.WinForms/Applications/IconManager.cs b/ShiftOS.WinForms/Applications/IconManager.cs new file mode 100644 index 0000000..0c6e119 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.cs @@ -0,0 +1,244 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using System.Reflection; +using ShiftOS.WinForms.Tools; +using Newtonsoft.Json; + +namespace ShiftOS.WinForms.Applications +{ + [RequiresUpgrade("icon_manager")] + [Launcher("Icon Manager", true, "al_icon_manager", "Customization")] + [DefaultTitle("Icon Manager")] + [DefaultIcon("iconIconManager")] + public partial class IconManager : UserControl, IShiftOSWindow + { + public IconManager() + { + InitializeComponent(); + } + + public void OnLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public void OnSkinLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public bool OnUnload() + { + Icons = null; + return true; + } + + private Dictionary Icons = null; + + private const int pageSize = 10; + private int currentPage = 0; + private int pageCount = 0; + + public Image GetIcon(string id) + { + if (!Icons.ContainsKey(id)) + Icons.Add(id, null); + + if (Icons[id] == null) + { + var img = SkinEngine.GetDefaultIcon(id); + using (var mstr = new System.IO.MemoryStream()) + { + img.Save(mstr, System.Drawing.Imaging.ImageFormat.Png); + Icons[id] = mstr.ToArray(); + } + return img; + } + else + { + using (var sr = new System.IO.MemoryStream(Icons[id])) + { + return Image.FromStream(sr); + } + } + } + + public void SetIcon(string key, byte[] raw) + { + if (!Icons.ContainsKey(key)) + Icons.Add(key, raw); + Icons[key] = raw; + } + + public void LoadIconsFromEngine() + { + //We have to serialize the engine icon list to JSON to break references with the data. + string json = JsonConvert.SerializeObject(SkinEngine.LoadedSkin.AppIcons); + //And deserialize to the local instance...essentially making a clone. + Icons = JsonConvert.DeserializeObject>(json); + } + + public void SetupUI() + { + flbody.Controls.Clear(); //Clear the icon list. + + List types = new List(); + + foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exe.ToLower().EndsWith(".exe") || exe.ToLower().EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exe); + + var typeList = asm.GetTypes().Where(x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); + types.AddRange(typeList); + + } + catch { } + } + } + + pageCount = types.ToArray().GetPageCount(pageSize); + + foreach (var type in types.ToArray().GetItemsOnPage(currentPage, pageSize)) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + var pnl = new Panel(); + pnl.Height = 30; + pnl.Width = flbody.Width - 15; + flbody.Controls.Add(pnl); + pnl.Show(); + var pic = new PictureBox(); + pic.SizeMode = PictureBoxSizeMode.StretchImage; + pic.Size = new Size(24, 24); + pic.Image = GetIcon(type.Name); + pnl.Controls.Add(pic); + pic.Left = 5; + pic.Top = (pnl.Height - pic.Height) / 2; + pic.Show(); + var lbl = new Label(); + lbl.Tag = "header3"; + lbl.AutoSize = true; + lbl.Text = NameChangerBackend.GetNameRaw(type); + ControlManager.SetupControl(lbl); + pnl.Controls.Add(lbl); + lbl.CenterParent(); + lbl.Show(); + var btn = new Button(); + btn.Text = "Change..."; + btn.AutoSize = true; + btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; + pnl.Controls.Add(btn); + btn.Left = (pnl.Width - btn.Width) - 5; + btn.Top = (pnl.Height - btn.Height) / 2; + btn.Click += (o, a) => + { + var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => + { + pic.Image = img; + SetIcon(type.Name, raw); + }); + AppearanceManager.SetupDialog(gfp); + }; + btn.Show(); + ControlManager.SetupControls(pnl); + } + } + + btnnext.Visible = (currentPage < pageCount - 1); + btnprev.Visible = (currentPage > 0); + + lbcurrentpage.Text = "Page " + (currentPage + 1).ToString() + " of " + pageCount.ToString(); + } + + public void OnUpgrade() + { + LoadIconsFromEngine(); + SetupUI(); + } + + private void btnprev_Click(object sender, EventArgs e) + { + currentPage--; + SetupUI(); + } + + public void ResetToDefaults() + { + currentPage = 0; + foreach (var key in Icons.Keys) + { + var img = SkinEngine.GetDefaultIcon(key); + using(var ms = new System.IO.MemoryStream()) + { + img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + Icons[key] = ms.ToArray(); + } + } + SetupUI(); + } + + private void btnnext_Click(object sender, EventArgs e) + { + currentPage++; + SetupUI(); + } + + private void btnclose_Click(object sender, EventArgs e) + { + AppearanceManager.Close(this); + } + + private void btnreset_Click(object sender, EventArgs e) + { + ResetToDefaults(); + } + + private void btnapply_Click(object sender, EventArgs e) + { + SkinEngine.LoadedSkin.AppIcons = Icons; + SkinEngine.SaveSkin(); + SkinEngine.LoadSkin(); + Infobox.Show("Icons applied!", "The new icons have been applied to ShiftOS successfully!"); + } + } + + public static class PaginationExtensions + { + public static int GetPageCount(this IEnumerable collection, int pageSize) + { + return (collection.Count() + pageSize - 1) / pageSize; + } + + public static T[] GetItemsOnPage(this T[] collection, int page, int pageSize) + { + List obj = new List(); + + for (int i = pageSize * page; i <= pageSize + (pageSize * page) && i < collection.Count(); i++) + { + try + { + obj.Add(collection[i]); + } + catch + { + } + } + return obj.ToArray(); + } + } + +} diff --git a/ShiftOS.WinForms/Applications/IconManager.resx b/ShiftOS.WinForms/Applications/IconManager.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 0eac58e..1a6d8c2 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -7,6 +7,20 @@ Dependencies: "desktop", Category: "Enhancements", }, + { + Name: "Icon Manager", + Cost: 450, + Description: "This tool allows you to add and edit application icons within ShiftOS for the small prive of 450 Codepoints!", + Dependencies: "skinning", + Category: "Application" + }, + { + Name: "AL Icon Manager", + Costs: 150, + Description: "Add an App Launcher entry for the Icon Manager.", + Dependencies: "icon_manager;app_launcher", + Category: "Customization" + }, { Name: "Shift Progress Bar", Cost: 150, diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index fd875e9..0a59c00 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -70,6 +70,12 @@ About.cs + + UserControl + + + IconManager.cs + UserControl @@ -409,6 +415,12 @@ ShiftnetStatus.cs + + UserControl + + + TestStatus.cs + UserControl @@ -461,6 +473,9 @@ About.cs + + IconManager.cs + TriPresent.cs @@ -616,6 +631,9 @@ ShiftnetStatus.cs + + TestStatus.cs + Volume.cs diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs b/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs new file mode 100644 index 0000000..3643d2d --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.Designer.cs @@ -0,0 +1,60 @@ +namespace ShiftOS.WinForms.StatusIcons +{ + partial class TestStatus + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(264, 52); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "This is a test."; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // TestStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); + this.Name = "TestStatus"; + this.Size = new System.Drawing.Size(264, 52); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.cs b/ShiftOS.WinForms/StatusIcons/TestStatus.cs new file mode 100644 index 0000000..90baafc --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.StatusIcons +{ + [DefaultIcon("iconShiftorium")] + public partial class TestStatus : UserControl, IStatusIcon + { + public TestStatus() + { + InitializeComponent(); + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/StatusIcons/TestStatus.resx b/ShiftOS.WinForms/StatusIcons/TestStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/StatusIcons/TestStatus.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 5bd4ab1..4a073f4 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -287,7 +287,15 @@ namespace ShiftOS.Engine LoadedSkin.AppIcons.Add(id, null); if (LoadedSkin.AppIcons[id] == null) - return GetDefaultIcon(id); + { + var img = GetDefaultIcon(id); + using (var mstr = new MemoryStream()) + { + img.Save(mstr, System.Drawing.Imaging.ImageFormat.Png); + LoadedSkin.AppIcons[id] = mstr.ToArray(); + } + return img; + } else { using (var sr = new MemoryStream(LoadedSkin.AppIcons[id])) -- cgit v1.2.3 From cc55af0c8b4d14053bfb46ec14c3e1887d375f7d Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 3 Jun 2017 09:16:44 -0400 Subject: story objectives system --- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/Stories/DevXSkinningStory.cs | 99 ++++++++++++++++++++++++ ShiftOS_TheReturn/Commands.cs | 15 +++- ShiftOS_TheReturn/Story.cs | 104 +++++++++++++++++++++++++- 4 files changed, 215 insertions(+), 4 deletions(-) create mode 100644 ShiftOS.WinForms/Stories/DevXSkinningStory.cs (limited to 'ShiftOS.WinForms/ShiftOS.WinForms.csproj') diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 0a59c00..e1afa84 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -427,6 +427,7 @@ Volume.cs + diff --git a/ShiftOS.WinForms/Stories/DevXSkinningStory.cs b/ShiftOS.WinForms/Stories/DevXSkinningStory.cs new file mode 100644 index 0000000..09dfd7f --- /dev/null +++ b/ShiftOS.WinForms/Stories/DevXSkinningStory.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.Stories +{ + public class DevXSkinningStory + { + [Story("devx_1000_codepoints")] + public static void DevX1000CPStory() + { + Desktop.InvokeOnWorkerThread(() => + { + var t = new Applications.Terminal(); + AppearanceManager.SetupWindow(t); + }); + TerminalBackend.InStory = true; + TerminalBackend.PrefixEnabled = false; + Thread.Sleep(3000); + Engine.AudioManager.PlayStream(Properties.Resources._3beepvirus); + Console.WriteLine("devx@anon_127420: Connection established."); + Thread.Sleep(1500); + Console.WriteLine("DevX: Hello, " + SaveSystem.CurrentUser.Username + "@" + SaveSystem.CurrentSave.SystemName + "! I see you've gotten a decent amount of Codepoints."); + Thread.Sleep(2000); + Console.WriteLine("DevX: Have you gotten a chance to install my \"Shifter\" application yet?"); + Thread.Sleep(1500); + if (!Shiftorium.UpgradeInstalled("shifter")) + { + Console.WriteLine("You: Not yet. What's it for?"); + Thread.Sleep(2000); + Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to."); + Thread.Sleep(2000); + Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades."); + Thread.Sleep(2000); + } + else + { + Console.WriteLine("You: Yeah. Just seems kinda lackluster to me. What is it supposed to do?"); + Thread.Sleep(2000); + Console.WriteLine("DevX: The Shifter is a very effective way to make ShiftOS look however you want it to."); + Thread.Sleep(2000); + Console.WriteLine("DevX: It can even be adapted to support other applications, features and upgrades."); + Thread.Sleep(2000); + Console.WriteLine("DevX: I haven't finished it just yet. Keep upgrading it and you'll notice it gets a lot better."); + Thread.Sleep(2000); + } + Console.WriteLine("DevX: I'd also recommend going for the Skin Loader, that way you can save your creations to the disk. Also, go for the Skinning upgrade - which will allow more rich customization of certain elements."); + Thread.Sleep(2000); + Console.WriteLine("You: This still ain't gonna help me get back to my old system and out of this stupid Digital Society, is it?"); + Thread.Sleep(2000); + Console.WriteLine("DevX: How the...How do you know about the Digital Societ....Who the hell talked!?"); + Thread.Sleep(2000); + Console.WriteLine("You: Whoa! Just... calm down, will ya? I heard about it in the news, shortly before I got infected by this damn virus of an operating system."); + Thread.Sleep(2000); + Console.WriteLine("DevX: Whatever. That doesn't matter yet. Just focus on upgrading ShiftOS and earning Codepoints. I'll let you know when we're done. I've gotta go...work on something else."); + Thread.Sleep(1500); + Console.WriteLine("User disconnected."); + Thread.Sleep(2000); + Console.WriteLine("You: Something doesn't seem right about DevX. I wonder what he's really up to."); + + if (Shiftorium.UpgradeInstalled("shifter")) + PushObjectives(); + else + Story.PushObjective("Buy the Shifter.", "The Shifter is a super-effective way to earn more Codepoints. It is an essential buy if you haven't already bought it. Save up for the Shifter, and buy it using shiftorium.buy{upgrade:\"shifter\"}.", () => + { + return Shiftorium.UpgradeInstalled("shifter"); + }, () => + { + PushObjectives(); + }); + Story.Context.AutoComplete = false; + TerminalBackend.InStory = false; + TerminalBackend.PrefixEnabled = false; + TerminalBackend.PrintPrompt(); + } + + public static void PushObjectives() + { + Story.PushObjective("Buy the Skinning upgrade", "The Skinning upgrade will allow you to set pictures in place of solid colors for most UI elements. If you want richer customization and more Codepoints, this upgrade is a necessity.", () => + { + return Shiftorium.UpgradeInstalled("skinning"); + }, ()=> + { + Story.PushObjective("Buy the Skin Loader.", "The Skin Loader is an application that allows you to save and load .skn files containing Shifter skin data. These files can be loaded in to the Skin Loader and applied to the system to give ShiftOS a completely different feel. It's Shiftorium upgrade ID is \"skin_loader\".", () => + { + return Shiftorium.UpgradeInstalled("skin_loader"); + }, + () => + { + Story.Context.MarkComplete(); + }); + }); + } + } +} diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index e379a50..72bccb1 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -533,11 +533,20 @@ namespace ShiftOS.Engine Codepoints: {SaveSystem.CurrentSave.Codepoints} Upgrades: {SaveSystem.CurrentSave.CountUpgrades()} installed, - {Shiftorium.GetAvailable().Length} available"; + {Shiftorium.GetAvailable().Length} available + +"; - if (Shiftorium.UpgradeInstalled("mud_control_centre")) - status += Environment.NewLine + $"Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})"; Console.WriteLine(status); + + if(Story.CurrentObjective != null) + { + Console.WriteLine("CURRENT OBJECTIVE: " + Story.CurrentObjective.Name); + Console.WriteLine("-------------------------------"); + Console.WriteLine(); + Console.WriteLine(Story.CurrentObjective.Description); + } + return true; } } diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs index d62dae4..848c757 100644 --- a/ShiftOS_TheReturn/Story.cs +++ b/ShiftOS_TheReturn/Story.cs @@ -35,11 +35,100 @@ using Newtonsoft.Json; namespace ShiftOS.Engine { + public class StoryContext + { + public string Id { get; set; } + public MethodInfo Method { get; set; } + public bool AutoComplete = false; + + public StoryContext() + { + AutoComplete = true; + } + + public void MarkComplete() + { + SaveSystem.CurrentSave.StoriesExperienced.Add(Id); + OnComplete?.Invoke(); + } + + public event Action OnComplete; + } + + public class Objective + { + private Func _completeFunc = null; + + public string Name { get; set; } + public string Description { get; set; } + + public bool IsComplete + { + get + { + return (bool)_completeFunc?.Invoke(); + } + } + + public Objective(string name, string desc, Func completeFunc, Action onComplete) + { + _completeFunc = completeFunc; + Name = name; + Description = desc; + this.onComplete = onComplete; + } + + private Action onComplete = null; + + public void Complete() + { + onComplete?.Invoke(); + } + } + /// /// Storyline management class. /// public static class Story { + public static StoryContext Context { get; private set; } + public static event Action StoryComplete; + public static Objective CurrentObjective { get; private set; } + + public static void PushObjective(string name, string desc, Func completeFunc, Action onComplete) + { + if (CurrentObjective != null) + { + if (CurrentObjective.IsComplete == false) + { + throw new Exception("Cannot start objective - an objective is already running."); + } + else + { + CurrentObjective = null; + } + } + + CurrentObjective = new Objective(name, desc, completeFunc, onComplete); + + var t = new Thread(() => + { + var obj = CurrentObjective; + while (!obj.IsComplete) + { + Thread.Sleep(5000); + } + obj.Complete(); + CurrentObjective = null; + }); + t.IsBackground = true; + t.Start(); + + Console.WriteLine("NEW OBJECTIVE:"); + Console.WriteLine("A new objective has been added to your system. Run sos.status to find out what you need to do."); + } + + /// /// Starts the storyline with the specified Storyline ID. /// @@ -68,8 +157,21 @@ namespace ShiftOS.Engine { new Thread(() => { + Context = new Engine.StoryContext + { + Id = stid, + Method = mth, + AutoComplete = true, + }; + Context.OnComplete += () => + { + StoryComplete?.Invoke(stid); + }; mth.Invoke(null, null); - SaveSystem.CurrentSave.StoriesExperienced.Add(stid); + if (Context.AutoComplete) + { + Context.MarkComplete(); + } }).Start(); return; } -- cgit v1.2.3