From bb4a3801623579296cf081f4e9172080d852bc7b Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 28 Feb 2017 17:01:14 -0500 Subject: Beginning screensaver work --- ShiftOS.WinForms/WinformsDesktop.cs | 83 ++++++++++++++++++++++++++++++++++++- 1 file changed, 82 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 899eb0d..70910d8 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -37,6 +37,7 @@ using ShiftOS.WinForms.Tools; using ShiftOS.WinForms.Applications; using Newtonsoft.Json; using ShiftOS.Engine.Scripting; +using System.Threading; /// /// Winforms desktop. @@ -48,6 +49,9 @@ namespace ShiftOS.WinForms /// public partial class WinformsDesktop : Form, IDesktop { + private bool InScreensaver = false; + private int millisecondsUntilScreensaver = 300000; + /// /// Initializes a new instance of the class. /// @@ -100,7 +104,7 @@ namespace ShiftOS.WinForms if (this.Visible == true) this.Invoke(new Action(() => SetupDesktop())); }; - var time = new Timer(); + var time = new System.Windows.Forms.Timer(); time.Interval = 100; this.KeyDown += (o, a) => { @@ -139,9 +143,86 @@ namespace ShiftOS.WinForms }; time.Start(); + var ssThread = new Thread(() => + { + while(this.Visible == true) + { + var mousePos = Cursor.Position; + while(Cursor.Position == mousePos) + { + if(millisecondsUntilScreensaver <= 0) + { + ShowScreensaver(); + InScreensaver = true; + } + millisecondsUntilScreensaver--; + Thread.Sleep(1); + } + millisecondsUntilScreensaver = 300000; + InScreensaver = false; + HideScreensaver(); + } + }); + ssThread.IsBackground = true; + ssThread.Start(); + this.DoubleBuffered = true; } + public void HideScreensaver() + { + this.Invoke(new Action(() => + { + this.TopMost = false; + pnlscreensaver.Hide(); + Cursor.Show(); + SetupDesktop(); + })); + } + + private void ShowScreensaver() + { + if (Shiftorium.UpgradeInstalled("screensavers")) + { + this.Invoke(new Action(() => + { + pnlscreensaver.Show(); + this.TopMost = true; + pnlssicon.Show(); + pnlssicon.BackColor = Color.Green; + pnlssicon.BackgroundImage = GetImage("screensaver"); + pnlssicon.BackgroundImageLayout = GetImageLayout("screensaver"); + + if (pnlssicon.BackgroundImage != null) + { + pnlssicon.Size = pnlssicon.BackgroundImage.Size; + } + + Cursor.Hide(); + + var t = new Thread(() => + { + var rnd = new Random(); + while (InScreensaver == true) + { + int x = rnd.Next(0, this.Width); + int y = rnd.Next(0, this.Height); + + this.Invoke(new Action(() => + { + pnlssicon.Location = new Point(x, y); + })); + + Thread.Sleep(5000); + } + }); + t.IsBackground = true; + t.Start(); + })); + } + } + + /// /// Populates the panel buttons. /// -- cgit v1.2.3 From 6fa7a0837381e92ecca62faa19708b4d8a1e1515 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 2 Mar 2017 08:52:55 -0500 Subject: Optimize screensavers --- ShiftOS.WinForms/ScriptingTestFunctions.cs | 34 ++++++++++++++++++++++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 1 + ShiftOS.WinForms/WinformsDesktop.cs | 20 ++++++++++++------ 3 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 ShiftOS.WinForms/ScriptingTestFunctions.cs (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/ScriptingTestFunctions.cs b/ShiftOS.WinForms/ScriptingTestFunctions.cs new file mode 100644 index 0000000..745f0ca --- /dev/null +++ b/ShiftOS.WinForms/ScriptingTestFunctions.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine.Scripting; + +namespace ShiftOS.WinForms +{ + [Exposed("scriptingtests")] + public class ScriptingTestFunctions + { + public int testVar = 127; + + public void testFunction() + { + Console.WriteLine("testFunction() called."); + } + + public string testFunctionWithReturn(string arg) + { + return arg + "!"; + } + + public event Action testEvent; + + public string testProperty { get; set; } + + public void invokeTestEvent() + { + testEvent?.Invoke(); + } + } +} diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 3cc9541..61174dc 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -256,6 +256,7 @@ True Resources.resx + diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 70910d8..42fe2c2 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -171,15 +171,22 @@ namespace ShiftOS.WinForms public void HideScreensaver() { - this.Invoke(new Action(() => + if (ResetDesktop == true) { - this.TopMost = false; - pnlscreensaver.Hide(); - Cursor.Show(); - SetupDesktop(); - })); + this.Invoke(new Action(() => + { + this.TopMost = false; + pnlscreensaver.Hide(); + Cursor.Show(); + SetupDesktop(); + ResetDesktop = false; + + })); + } } + private bool ResetDesktop = false; + private void ShowScreensaver() { if (Shiftorium.UpgradeInstalled("screensavers")) @@ -215,6 +222,7 @@ namespace ShiftOS.WinForms Thread.Sleep(5000); } + ResetDesktop = true; }); t.IsBackground = true; t.Start(); -- cgit v1.2.3 From 909873af65113a5808e509741a3f37f849d425ca Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 6 Mar 2017 11:52:42 -0500 Subject: All client-side for paid subscriptions is done. --- ShiftOS.WinForms/Applications/Shiftnet.cs | 2 +- ShiftOS.WinForms/WinformsDesktop.cs | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index af14f27..9540794 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -151,7 +151,7 @@ namespace ShiftOS.WinForms.Applications { })); } } - break; + return; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 42fe2c2..4f3328b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -138,6 +138,24 @@ namespace ShiftOS.WinForms } } + if(SaveSystem.CurrentSave != null) + { + if(SaveSystem.CurrentSave.LastMonthPaid != DateTime.Now.Month) + { + if(SaveSystem.CurrentSave.Codepoints >= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth) + { + SaveSystem.CurrentSave.Codepoints -= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth; + SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; + } + else + { + SaveSystem.CurrentSave.ShiftnetSubscription = 0; + SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; + Infobox.Show("Shiftnet", "You do not have enough Codepoints to pay for your Shiftnet subscription this month. You have been downgraded to the free plan."); + } + } + } + btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2; btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2; }; -- cgit v1.2.3 From 2d49d6e7679776d01d6eb0d15fc25d2e266d1fa1 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 6 Mar 2017 12:14:41 -0500 Subject: One last little bug. --- ShiftOS.WinForms/WinformsDesktop.cs | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 4f3328b..a53ae3a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -138,23 +138,28 @@ namespace ShiftOS.WinForms } } - if(SaveSystem.CurrentSave != null) + try { - if(SaveSystem.CurrentSave.LastMonthPaid != DateTime.Now.Month) + if (SaveSystem.CurrentSave != null) { - if(SaveSystem.CurrentSave.Codepoints >= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth) + if (SaveSystem.CurrentSave.LastMonthPaid != DateTime.Now.Month) { - SaveSystem.CurrentSave.Codepoints -= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth; - SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; - } - else - { - SaveSystem.CurrentSave.ShiftnetSubscription = 0; - SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; - Infobox.Show("Shiftnet", "You do not have enough Codepoints to pay for your Shiftnet subscription this month. You have been downgraded to the free plan."); + if (SaveSystem.CurrentSave.Codepoints >= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth) + { + SaveSystem.CurrentSave.Codepoints -= DownloadManager.GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].CostPerMonth; + SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; + } + else + { + SaveSystem.CurrentSave.ShiftnetSubscription = 0; + SaveSystem.CurrentSave.LastMonthPaid = DateTime.Now.Month; + Infobox.Show("Shiftnet", "You do not have enough Codepoints to pay for your Shiftnet subscription this month. You have been downgraded to the free plan."); + } } } } + catch { } + btnnotifications.Left = lbtime.Left - btnnotifications.Width - 2; btnnotifications.Top = (desktoppanel.Height - btnnotifications.Height) / 2; -- cgit v1.2.3 From 449d43d22c1d12ce6aa0243fbb4ea94481ff8f4c Mon Sep 17 00:00:00 2001 From: Michael Date: Tue, 7 Mar 2017 16:13:53 -0500 Subject: Finish user hacking. --- ShiftOS.WinForms/HackerCommands.cs | 9 ++++++--- ShiftOS.WinForms/WinformsDesktop.cs | 6 ++++-- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/HackerCommands.cs b/ShiftOS.WinForms/HackerCommands.cs index 7938fd0..7861981 100644 --- a/ShiftOS.WinForms/HackerCommands.cs +++ b/ShiftOS.WinForms/HackerCommands.cs @@ -386,12 +386,13 @@ namespace ShiftOS.WinForms Console.WriteLine(pass); Console.WriteLine(); Console.WriteLine("--password breached. Operation took " + sw.ElapsedMilliseconds + " milliseconds."); + ServerManager.MessageReceived -= msgReceived; } else if(msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + ServerManager.MessageReceived -= msgReceived; } - ServerManager.MessageReceived -= msgReceived; }; Console.WriteLine("--beginning brute-force attack on " + usr + "@" + sys + "..."); @@ -440,13 +441,14 @@ namespace ShiftOS.WinForms { Console.WriteLine("--access denied."); } + ServerManager.MessageReceived -= msgReceived; } else if (msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + ServerManager.MessageReceived -= msgReceived; } - ServerManager.MessageReceived -= msgReceived; }; Console.WriteLine("--contacting multi-user domain..."); @@ -508,12 +510,13 @@ namespace ShiftOS.WinForms Console.WriteLine("--access denied."); } + ServerManager.MessageReceived -= msgReceived; } else if (msg.Name == "user_data_not_found") { Console.WriteLine("--access denied."); + ServerManager.MessageReceived -= msgReceived; } - ServerManager.MessageReceived -= msgReceived; }; Console.WriteLine("--contacting multi-user domain..."); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index a53ae3a..8900a69 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -70,8 +70,10 @@ namespace ShiftOS.WinForms NotificationDaemon.NotificationRead += () => { //Soon this will pop a balloon note. - btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; - + this.Invoke(new Action(() => + { + btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + })); }; this.LocationChanged += (o, a) => -- cgit v1.2.3 From 2ff261328740cbb628678605b09800f22c9b67a9 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 8 Mar 2017 19:23:40 -0500 Subject: Fix notification bug. --- ShiftOS.WinForms/WinformsDesktop.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 8900a69..d30adb4 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -63,8 +63,10 @@ namespace ShiftOS.WinForms NotificationDaemon.NotificationMade += (note) => { //Soon this will pop a balloon note. - btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; - + this.Invoke(new Action(() => + { + btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + })); }; NotificationDaemon.NotificationRead += () => -- cgit v1.2.3 From f89cd092830a8e88bd9aaf8048c18b0dda7dea25 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 2 Apr 2017 14:26:25 -0400 Subject: Various bugfixes. --- ShiftOS.WinForms/Controls/TerminalBox.cs | 8 +++ ShiftOS.WinForms/Oobe.cs | 22 +++---- ShiftOS.WinForms/WinformsDesktop.cs | 5 +- ShiftOS.WinForms/WinformsWindowManager.cs | 104 +++++++++++++++++++++++++++++- ShiftOS_TheReturn/AudioManager.cs | 2 +- ShiftOS_TheReturn/TerminalTextWriter.cs | 8 +-- 6 files changed, 129 insertions(+), 20 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index 9e4c61c..bc2bcc0 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -47,6 +47,14 @@ namespace ShiftOS.WinForms.Controls catch { } } + protected override void Dispose(bool disposing) + { + if (disposing == true) + if(AppearanceManager.ConsoleOut == this) + AppearanceManager.ConsoleOut = null; + base.Dispose(disposing); + } + protected override void OnClick(EventArgs e) { base.OnClick(e); diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 7370396..898f60b 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -419,7 +419,7 @@ namespace ShiftOS.WinForms Clear(); textgeninput = lblhackwords; Clear(); - + this.Invoke(new Action(() => { textgeninput.Font = SkinEngine.LoadedSkin.TerminalFont; @@ -450,7 +450,7 @@ namespace ShiftOS.WinForms TextType("In ShiftOS, the Terminal is your main control centre for the operating system. You can see system status, check Codepoints, open other programs, buy upgrades, and more."); Thread.Sleep(500); TextType("Go ahead and type 'sos.help' to see a list of commands."); - while(TutorialProgress == 0) + while (TutorialProgress == 0) { } @@ -459,7 +459,7 @@ namespace ShiftOS.WinForms TextType("You can run any command, by typing in their Namespace, followed by a period (.), followed by their Command Name."); Thread.Sleep(500); TextType("Go ahead and run the 'status' command within the 'sos' namespace to see what the command does."); - while(TutorialProgress == 1) + while (TutorialProgress == 1) { } @@ -476,7 +476,7 @@ namespace ShiftOS.WinForms TextType("You can easily get upgrades using the Shiftorium - a repository of approved ShiftOS upgrades."); Thread.Sleep(500); TextType("To start using the Shiftorium, simply type 'shiftorium.list' to see available upgrades."); - while(TutorialProgress == 2) + while (TutorialProgress == 2) { } @@ -500,17 +500,17 @@ namespace ShiftOS.WinForms TextType("If you want to escape a backslash inside a string, simply type two backslashes instead of one - for example key:\"Back\\\\slash.\""); Thread.Sleep(500); TextType("shiftorium.info requires an upgrade argument, which is a string type. Go ahead and give shiftorium.info's upgrade argument the 'mud_fundamentals' upgrade's ID."); - while(TutorialProgress == 3) + while (TutorialProgress == 3) { - } + } TextType("As you can see, mud_fundamentals is very useful. In fact, a lot of useful upgrades depend on it. You should buy it!"); Thread.Sleep(500); TextType("shiftorium.info already gave you a command that will let you buy the upgrade - go ahead and run that command!"); while (!Shiftorium.UpgradeInstalled("mud_fundamentals")) { - } + } TextType("Hooray! You now have the MUD Fundamentals upgrade."); Thread.Sleep(500); TextType("You can also earn more Codepoints by playing Pong. To open Pong, you can use the win.open command."); @@ -518,20 +518,20 @@ namespace ShiftOS.WinForms TextType("If you run win.open without arguments, you can see a list of applications that you can open."); Thread.Sleep(500); TextType("Just run win.open without arguments, and this tutorial will be completed!"); - while(TutorialProgress == 4) + while (TutorialProgress == 4) { } TextType("This concludes the ShiftOS beginners' guide brought to you by the multi-user domain. Stay safe in a connected world."); Thread.Sleep(2000); - this.Invoke(new Action(() => + Desktop.InvokeOnWorkerThread(() => { OnComplete?.Invoke(this, EventArgs.Empty); - this.Close(); SaveSystem.CurrentSave.StoryPosition = 2; SaveSystem.SaveGame(); AppearanceManager.SetupWindow(new Applications.Terminal()); - })); + }); + }); t.IsBackground = true; t.Start(); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index d30adb4..06f103e 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -664,7 +664,10 @@ namespace ShiftOS.WinForms /// Act. public void InvokeOnWorkerThread(Action act) { - this.Invoke(act); + this.Invoke(new Action(()=> + { + act?.Invoke(); + })); } public void OpenAppLauncher(Point loc) diff --git a/ShiftOS.WinForms/WinformsWindowManager.cs b/ShiftOS.WinForms/WinformsWindowManager.cs index eeaa6c9..40177be 100644 --- a/ShiftOS.WinForms/WinformsWindowManager.cs +++ b/ShiftOS.WinForms/WinformsWindowManager.cs @@ -36,6 +36,24 @@ namespace ShiftOS.WinForms { internal class WinformsWindowManager : WindowManager { + public int DesktopHeight + { + get + { + return Desktop.Size.Height - ((Shiftorium.UpgradeInstalled("desktop_panel") == true) ? SkinEngine.LoadedSkin.DesktopPanelHeight : 0); + } + } + + public int TopLocation + { + get + { + if (!Shiftorium.UpgradeInstalled("desktop_panel")) + return 0; + return ((SkinEngine.LoadedSkin.DesktopPanelPosition == 0) ? SkinEngine.LoadedSkin.DesktopPanelHeight : 0); + } + } + public override void Close(IShiftOSWindow win) { (win as UserControl).Close(); @@ -160,9 +178,11 @@ namespace ShiftOS.WinForms { List formstoclose = new List(); - foreach (WindowBorder frm in AppearanceManager.OpenForms) + for (int i = 0; i < maxWindows && i < AppearanceManager.OpenForms.Count; i++) { - formstoclose.Add(frm); + var frm = AppearanceManager.OpenForms[i] as WindowBorder; + if(!frm.IsDialog) + formstoclose.Add(frm); } @@ -177,7 +197,85 @@ namespace ShiftOS.WinForms var wb = new WindowBorder(form as UserControl); - ControlManager.SetupWindows(); + SetupWindows(); + } + + public void SetupWindows() + { + var windows = new List(); + foreach(var win in AppearanceManager.OpenForms) + { + if (win is WindowBorder) + if ((win as WindowBorder).IsDialog == false) + windows.Add(win as WindowBorder); + } + + if (Shiftorium.UpgradeInstalled("wm_free_placement")) + return; + + else if (windows.Count == 4) + { + var w1 = windows[0]; + var w2 = windows[1]; + var w3 = windows[2]; + var w4 = windows[3]; + w1.Location = new Point(0, TopLocation); + w1.Width = Desktop.Size.Width / 2; + w1.Height = DesktopHeight / 2; + w2.Left = w1.Width; + w2.Width = w1.Width; + w2.Height = w1.Height; + w2.Top = w1.Top; + w3.Top = w2.Height; + w3.Height = w1.Height; + w3.Left = 0; + w3.Width = w1.Width; + w4.Width = w3.Width; + w4.Top = w3.Top; + w4.Left = w3.Width; + w4.Height = w3.Height; + } + else if(windows.Count == 3) + { + var w1 = windows[0]; + var w2 = windows[1]; + var w3 = windows[2]; + w1.Location = new Point(0, TopLocation); + w1.Width = Desktop.Size.Width / 2; + w1.Height = DesktopHeight / 2; + w2.Left = w1.Width; + w2.Width = w1.Width; + w2.Height = w1.Height; + w2.Top = w1.Top; + w3.Top = w2.Height; + w3.Height = w1.Height; + w3.Left = 0; + w3.Width = w1.Width + w2.Width; + } + else if (windows.Count == 2) + { + var w1 = windows[0]; + var w2 = windows[1]; + + w1.Location = new Point(0, TopLocation); + w1.Width = Desktop.Size.Width / 2; + w1.Height = DesktopHeight; + w2.Left = w1.Width; + w2.Width = w1.Width; + w2.Height = w1.Height; + w2.Top = w1.Top; + + } + else if(windows.Count == 1) + { + var win = windows.FirstOrDefault(); + if(win != null) + { + win.Size = new Size(Desktop.Size.Width, DesktopHeight); + win.Location = new Point(0, this.TopLocation); + } + } + } } } diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs index 7f6f5e9..7466eeb 100644 --- a/ShiftOS_TheReturn/AudioManager.cs +++ b/ShiftOS_TheReturn/AudioManager.cs @@ -22,7 +22,7 @@ * SOFTWARE. */ -//#define NOSOUND +#define NOSOUND using System; using System.Collections.Generic; diff --git a/ShiftOS_TheReturn/TerminalTextWriter.cs b/ShiftOS_TheReturn/TerminalTextWriter.cs index bc242a9..55e27cf 100644 --- a/ShiftOS_TheReturn/TerminalTextWriter.cs +++ b/ShiftOS_TheReturn/TerminalTextWriter.cs @@ -58,7 +58,7 @@ namespace ShiftOS.Engine { Desktop.InvokeOnWorkerThread(new Action(() => { - UnderlyingControl.SelectBottom(); + UnderlyingControl?.SelectBottom(); })); } @@ -76,7 +76,7 @@ namespace ShiftOS.Engine { Desktop.InvokeOnWorkerThread(new Action(() => { - UnderlyingControl.Write(value.ToString()); + UnderlyingControl?.Write(value.ToString()); select(); })); } @@ -96,7 +96,7 @@ namespace ShiftOS.Engine Desktop.InvokeOnWorkerThread(new Action(() => { - UnderlyingControl.WriteLine(value); + UnderlyingControl?.WriteLine(value); select(); })); } @@ -120,7 +120,7 @@ namespace ShiftOS.Engine Desktop.InvokeOnWorkerThread(new Action(() => { - UnderlyingControl.Write(value.ToString()); + UnderlyingControl?.Write(value.ToString()); select(); })); } -- cgit v1.2.3 From f43f6fe17d054f83c686b552201d6b4bfc83524d Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 3 Apr 2017 18:36:13 -0400 Subject: LOADS of optimizations and Pong fixes. --- ShiftOS.Objects/ShiftOS.Objects.csproj | 1 - ShiftOS.Objects/ShiftOSMenuRenderer.cs | 51 ------- ShiftOS.WinForms/Applications/Pong.Designer.cs | 177 +++++++++++++------------ ShiftOS.WinForms/Applications/Pong.cs | 36 ++++- ShiftOS.WinForms/Oobe.cs | 30 ++++- ShiftOS.WinForms/Tools/ControlManager.cs | 107 +++------------ ShiftOS.WinForms/WinformsDesktop.cs | 13 +- ShiftOS.WinForms/WinformsWindowManager.cs | 17 +-- ShiftOS_TheReturn/Shiftorium.cs | 28 +++- 9 files changed, 217 insertions(+), 243 deletions(-) delete mode 100644 ShiftOS.Objects/ShiftOSMenuRenderer.cs (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.Objects/ShiftOS.Objects.csproj b/ShiftOS.Objects/ShiftOS.Objects.csproj index 3dc0c33..4514b68 100644 --- a/ShiftOS.Objects/ShiftOS.Objects.csproj +++ b/ShiftOS.Objects/ShiftOS.Objects.csproj @@ -54,7 +54,6 @@ - diff --git a/ShiftOS.Objects/ShiftOSMenuRenderer.cs b/ShiftOS.Objects/ShiftOSMenuRenderer.cs deleted file mode 100644 index c76bd35..0000000 --- a/ShiftOS.Objects/ShiftOSMenuRenderer.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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. - */ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace ShiftOS.Objects -{ - class ShiftOSMenuRenderer : ToolStripProfessionalRenderer - { - public ShiftOSMenuRenderer() : base(new ShiftOSColorTable()) - { - - } - - protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e) - { - - } - } - - public class ShiftOSColorTable : ProfessionalColorTable - { - - } -} diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index faaf0f5..e619eaa 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -79,6 +79,11 @@ namespace ShiftOS.WinForms.Applications this.tmrcountdown = new System.Windows.Forms.Timer(this.components); this.tmrstoryline = new System.Windows.Forms.Timer(this.components); this.pgcontents = new ShiftOS.WinForms.Controls.Canvas(); + this.pnlhighscore = new System.Windows.Forms.Panel(); + this.lbhighscore = new System.Windows.Forms.ListBox(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.button2 = new System.Windows.Forms.Button(); + this.label10 = new System.Windows.Forms.Label(); this.pnlgamestats = new System.Windows.Forms.Panel(); this.button1 = new System.Windows.Forms.Button(); this.label12 = new System.Windows.Forms.Label(); @@ -91,9 +96,6 @@ namespace ShiftOS.WinForms.Applications this.btncashout = new System.Windows.Forms.Button(); this.Label2 = new System.Windows.Forms.Label(); this.lbllevelreached = new System.Windows.Forms.Label(); - this.pnlhighscore = new System.Windows.Forms.Panel(); - this.lbhighscore = new System.Windows.Forms.ListBox(); - this.label10 = new System.Windows.Forms.Label(); this.pnlfinalstats = new System.Windows.Forms.Panel(); this.btnplayagain = new System.Windows.Forms.Button(); this.lblfinalcodepoints = new System.Windows.Forms.Label(); @@ -122,16 +124,14 @@ namespace ShiftOS.WinForms.Applications this.lblstatscodepoints = new System.Windows.Forms.Label(); this.lblstatsY = new System.Windows.Forms.Label(); this.lblstatsX = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.button2 = new System.Windows.Forms.Button(); this.pgcontents.SuspendLayout(); - this.pnlgamestats.SuspendLayout(); this.pnlhighscore.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.pnlgamestats.SuspendLayout(); this.pnlfinalstats.SuspendLayout(); this.pnllose.SuspendLayout(); this.pnlintro.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit(); - this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // gameTimer @@ -174,11 +174,67 @@ namespace ShiftOS.WinForms.Applications this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; this.pgcontents.Location = new System.Drawing.Point(0, 0); this.pgcontents.Name = "pgcontents"; - this.pgcontents.Size = new System.Drawing.Size(700, 400); + this.pgcontents.Size = new System.Drawing.Size(1867, 819); this.pgcontents.TabIndex = 20; this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint); this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); // + // pnlhighscore + // + this.pnlhighscore.Controls.Add(this.lbhighscore); + this.pnlhighscore.Controls.Add(this.flowLayoutPanel1); + this.pnlhighscore.Controls.Add(this.label10); + this.pnlhighscore.Location = new System.Drawing.Point(688, 302); + this.pnlhighscore.Name = "pnlhighscore"; + this.pnlhighscore.Size = new System.Drawing.Size(539, 311); + this.pnlhighscore.TabIndex = 14; + this.pnlhighscore.Visible = false; + // + // lbhighscore + // + this.lbhighscore.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbhighscore.FormattingEnabled = true; + this.lbhighscore.Location = new System.Drawing.Point(0, 36); + this.lbhighscore.MultiColumn = true; + this.lbhighscore.Name = "lbhighscore"; + this.lbhighscore.SelectionMode = System.Windows.Forms.SelectionMode.None; + this.lbhighscore.Size = new System.Drawing.Size(539, 246); + this.lbhighscore.TabIndex = 1; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.button2); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 282); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(539, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // button2 + // + this.button2.AutoSize = true; + this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.button2.Location = new System.Drawing.Point(476, 3); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(60, 23); + this.button2.TabIndex = 0; + this.button2.Text = "{CLOSE}"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // label10 + // + this.label10.Dock = System.Windows.Forms.DockStyle.Top; + this.label10.Location = new System.Drawing.Point(0, 0); + this.label10.Name = "label10"; + this.label10.Size = new System.Drawing.Size(539, 36); + this.label10.TabIndex = 0; + this.label10.Text = "{HIGH_SCORES}"; + this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // // pnlgamestats // this.pnlgamestats.Controls.Add(this.button1); @@ -192,7 +248,7 @@ namespace ShiftOS.WinForms.Applications this.pnlgamestats.Controls.Add(this.btncashout); this.pnlgamestats.Controls.Add(this.Label2); this.pnlgamestats.Controls.Add(this.lbllevelreached); - this.pnlgamestats.Location = new System.Drawing.Point(56, 76); + this.pnlgamestats.Location = new System.Drawing.Point(104, 375); this.pnlgamestats.Name = "pnlgamestats"; this.pnlgamestats.Size = new System.Drawing.Size(466, 284); this.pnlgamestats.TabIndex = 6; @@ -307,38 +363,6 @@ namespace ShiftOS.WinForms.Applications this.lbllevelreached.TabIndex = 0; this.lbllevelreached.Text = "You Reached Level 2!"; // - // pnlhighscore - // - this.pnlhighscore.Controls.Add(this.lbhighscore); - this.pnlhighscore.Controls.Add(this.flowLayoutPanel1); - this.pnlhighscore.Controls.Add(this.label10); - this.pnlhighscore.Location = new System.Drawing.Point(67, 29); - this.pnlhighscore.Name = "pnlhighscore"; - this.pnlhighscore.Size = new System.Drawing.Size(539, 311); - this.pnlhighscore.TabIndex = 14; - this.pnlhighscore.Visible = false; - // - // lbhighscore - // - this.lbhighscore.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbhighscore.FormattingEnabled = true; - this.lbhighscore.Location = new System.Drawing.Point(0, 36); - this.lbhighscore.MultiColumn = true; - this.lbhighscore.Name = "lbhighscore"; - this.lbhighscore.SelectionMode = System.Windows.Forms.SelectionMode.None; - this.lbhighscore.Size = new System.Drawing.Size(539, 246); - this.lbhighscore.TabIndex = 1; - // - // label10 - // - this.label10.Dock = System.Windows.Forms.DockStyle.Top; - this.label10.Location = new System.Drawing.Point(0, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(539, 36); - this.label10.TabIndex = 0; - this.label10.Text = "{HIGH_SCORES}"; - this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // // pnlfinalstats // this.pnlfinalstats.Controls.Add(this.btnplayagain); @@ -373,6 +397,7 @@ namespace ShiftOS.WinForms.Applications this.lblfinalcodepoints.Name = "lblfinalcodepoints"; this.lblfinalcodepoints.Size = new System.Drawing.Size(356, 73); this.lblfinalcodepoints.TabIndex = 15; + this.lblfinalcodepoints.Tag = "header1"; this.lblfinalcodepoints.Text = "134 CP"; this.lblfinalcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -384,6 +409,7 @@ namespace ShiftOS.WinForms.Applications this.Label11.Name = "Label11"; this.Label11.Size = new System.Drawing.Size(33, 33); this.Label11.TabIndex = 14; + this.Label11.Tag = "header2"; this.Label11.Text = "+"; this.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -394,6 +420,7 @@ namespace ShiftOS.WinForms.Applications this.lblfinalcomputerreward.Name = "lblfinalcomputerreward"; this.lblfinalcomputerreward.Size = new System.Drawing.Size(151, 52); this.lblfinalcomputerreward.TabIndex = 12; + this.lblfinalcomputerreward.Tag = "header2"; this.lblfinalcomputerreward.Text = "34"; this.lblfinalcomputerreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -413,6 +440,7 @@ namespace ShiftOS.WinForms.Applications this.lblfinallevelreward.Name = "lblfinallevelreward"; this.lblfinallevelreward.Size = new System.Drawing.Size(151, 52); this.lblfinallevelreward.TabIndex = 10; + this.lblfinallevelreward.Tag = "header2"; this.lblfinallevelreward.Text = "100"; this.lblfinallevelreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -432,6 +460,7 @@ namespace ShiftOS.WinForms.Applications this.lblfinalcodepointswithtext.Name = "lblfinalcodepointswithtext"; this.lblfinalcodepointswithtext.Size = new System.Drawing.Size(356, 26); this.lblfinalcodepointswithtext.TabIndex = 1; + this.lblfinalcodepointswithtext.Tag = "header2"; this.lblfinalcodepointswithtext.Text = "You cashed out with 134 codepoints!"; this.lblfinalcodepointswithtext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // @@ -502,10 +531,11 @@ namespace ShiftOS.WinForms.Applications this.pnlintro.Controls.Add(this.Label6); this.pnlintro.Controls.Add(this.btnstartgame); this.pnlintro.Controls.Add(this.Label8); - this.pnlintro.Location = new System.Drawing.Point(52, 29); + this.pnlintro.Location = new System.Drawing.Point(1139, 41); this.pnlintro.Name = "pnlintro"; this.pnlintro.Size = new System.Drawing.Size(595, 303); this.pnlintro.TabIndex = 13; + this.pnlintro.Tag = "header2"; // // Label6 // @@ -548,6 +578,7 @@ namespace ShiftOS.WinForms.Applications this.lblbeatai.Name = "lblbeatai"; this.lblbeatai.Size = new System.Drawing.Size(600, 30); this.lblbeatai.TabIndex = 8; + this.lblbeatai.Tag = "header2"; this.lblbeatai.Text = "You got 2 codepoints for beating the Computer!"; this.lblbeatai.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.lblbeatai.Visible = false; @@ -577,7 +608,6 @@ namespace ShiftOS.WinForms.Applications // this.paddleHuman.BackColor = System.Drawing.Color.Black; this.paddleHuman.Location = new System.Drawing.Point(10, 134); - this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 150); this.paddleHuman.Name = "paddleHuman"; this.paddleHuman.Size = new System.Drawing.Size(20, 100); this.paddleHuman.TabIndex = 3; @@ -587,7 +617,7 @@ namespace ShiftOS.WinForms.Applications // this.paddleComputer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.paddleComputer.BackColor = System.Drawing.Color.Black; - this.paddleComputer.Location = new System.Drawing.Point(666, 134); + this.paddleComputer.Location = new System.Drawing.Point(1833, 134); this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 150); this.paddleComputer.Name = "paddleComputer"; this.paddleComputer.Size = new System.Drawing.Size(20, 100); @@ -599,69 +629,52 @@ namespace ShiftOS.WinForms.Applications this.lbllevelandtime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lbllevelandtime.Location = new System.Drawing.Point(0, 0); this.lbllevelandtime.Name = "lbllevelandtime"; - this.lbllevelandtime.Size = new System.Drawing.Size(700, 22); + this.lbllevelandtime.Size = new System.Drawing.Size(1867, 22); this.lbllevelandtime.TabIndex = 4; + this.lbllevelandtime.Tag = "header1"; this.lbllevelandtime.Text = "Level: 1 - 58 Seconds Left"; this.lbllevelandtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // lblstatscodepoints // - this.lblstatscodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + this.lblstatscodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.lblstatscodepoints.AutoSize = true; this.lblstatscodepoints.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatscodepoints.Location = new System.Drawing.Point(239, 356); + this.lblstatscodepoints.Location = new System.Drawing.Point(239, 775); this.lblstatscodepoints.Name = "lblstatscodepoints"; - this.lblstatscodepoints.Size = new System.Drawing.Size(219, 35); + this.lblstatscodepoints.Size = new System.Drawing.Size(116, 23); this.lblstatscodepoints.TabIndex = 12; + this.lblstatscodepoints.Tag = "header2"; this.lblstatscodepoints.Text = "Codepoints: "; this.lblstatscodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // lblstatsY // this.lblstatsY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.lblstatsY.AutoSize = true; this.lblstatsY.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatsY.Location = new System.Drawing.Point(542, 356); + this.lblstatsY.Location = new System.Drawing.Point(1395, 775); this.lblstatsY.Name = "lblstatsY"; - this.lblstatsY.Size = new System.Drawing.Size(144, 35); + this.lblstatsY.Size = new System.Drawing.Size(76, 23); this.lblstatsY.TabIndex = 11; + this.lblstatsY.Tag = "header2"; this.lblstatsY.Text = "Yspeed:"; this.lblstatsY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // lblstatsX // this.lblstatsX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lblstatsX.AutoSize = true; this.lblstatsX.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatsX.Location = new System.Drawing.Point(3, 356); + this.lblstatsX.Location = new System.Drawing.Point(3, 775); this.lblstatsX.Name = "lblstatsX"; - this.lblstatsX.Size = new System.Drawing.Size(144, 35); + this.lblstatsX.Size = new System.Drawing.Size(83, 23); this.lblstatsX.TabIndex = 5; + this.lblstatsX.Tag = "header2"; this.lblstatsX.Text = "Xspeed: "; this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.Controls.Add(this.button2); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 282); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(539, 29); - this.flowLayoutPanel1.TabIndex = 2; - // - // button2 - // - this.button2.AutoSize = true; - this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.button2.Location = new System.Drawing.Point(476, 3); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(60, 23); - this.button2.TabIndex = 0; - this.button2.Text = "{CLOSE}"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // // Pong // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -670,23 +683,23 @@ namespace ShiftOS.WinForms.Applications this.Controls.Add(this.pgcontents); this.DoubleBuffered = true; this.Name = "Pong"; - this.Text = "{PONG_NAME}"; - this.Size = new System.Drawing.Size(820, 500); + this.Size = new System.Drawing.Size(1867, 819); this.Load += new System.EventHandler(this.Pong_Load); this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); this.pgcontents.ResumeLayout(false); - this.pnlgamestats.ResumeLayout(false); - this.pnlgamestats.PerformLayout(); + this.pgcontents.PerformLayout(); this.pnlhighscore.ResumeLayout(false); this.pnlhighscore.PerformLayout(); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.pnlgamestats.ResumeLayout(false); + this.pnlgamestats.PerformLayout(); this.pnlfinalstats.ResumeLayout(false); this.pnlfinalstats.PerformLayout(); this.pnllose.ResumeLayout(false); this.pnlintro.ResumeLayout(false); this.pnlintro.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); this.ResumeLayout(false); } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 157ce8c..a7b1aeb 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -34,6 +34,7 @@ using System.Windows.Forms; using Newtonsoft.Json; using ShiftOS.Engine; using ShiftOS.Objects; +using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { @@ -83,6 +84,26 @@ namespace ShiftOS.WinForms.Applications paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2)); } + private void CenterPanels() + { + pnlfinalstats.CenterParent(); + pnlgamestats.CenterParent(); + pnlhighscore.CenterParent(); + pnlintro.CenterParent(); + pnllose.CenterParent(); + lblcountdown.CenterParent(); + lblbeatai.Left = (this.Width - lblbeatai.Width) / 2; + SetupStats(); + } + + public void SetupStats() + { + lblstatsX.Location = new Point(5, this.Height - lblstatsX.Height - 5); + lblstatsY.Location = new Point(this.Width - lblstatsY.Width - 5, this.Height - lblstatsY.Height - 5); + lblstatscodepoints.Top = this.Height - lblstatscodepoints.Height - 5; + lblstatscodepoints.Left = (this.Width - lblstatscodepoints.Width) / 2; + } + // ERROR: Handles clauses are not supported in C# private void gameTimer_Tick(object sender, EventArgs e) @@ -102,7 +123,7 @@ namespace ShiftOS.WinForms.Applications //Set the computer player to move according to the ball's position. if (aiShouldIsbeEnabled) - if (ball.Location.X > 500 - xVel * 10 && xVel > 0) + if (ball.Location.X > (this.Width - (this.Width / 3)) - xVel * 10 && xVel > 0) { if (ball.Location.Y > paddleComputer.Location.Y + 50) { @@ -116,12 +137,12 @@ namespace ShiftOS.WinForms.Applications } else { - //used to be me.location.y + //used to be me.location.y - except it's fucking C# and this comment is misleading as fuck. OH WAIT! I didn't write it! And none of the current devs did either! - Michael if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition) { paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); } - //used to be me.location.y + //Rylan is hot. Used to be //used to be me.location.y if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition) { paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); @@ -269,6 +290,7 @@ namespace ShiftOS.WinForms.Applications } lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString(); } + SetupStats(); } public void SendHighscores() @@ -652,10 +674,17 @@ namespace ShiftOS.WinForms.Applications pnlhighscore.Hide(); pnlgamestats.Hide(); pnlfinalstats.Hide(); + CenterPanels(); + lblbeatai.Hide(); } public void OnSkinLoad() { + CenterPanels(); + this.SizeChanged += (o, a) => + { + CenterPanels(); + }; } public bool OnUnload() @@ -665,6 +694,7 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { + CenterPanels(); } private void button2_Click(object sender, EventArgs e) diff --git a/ShiftOS.WinForms/Oobe.cs b/ShiftOS.WinForms/Oobe.cs index 898f60b..d6d3b92 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -64,7 +64,10 @@ namespace ShiftOS.WinForms { while(typing == true) { + //JESUS CHRIST PAST MICHAEL. + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } charcount = texttotype.Length; @@ -452,6 +455,10 @@ namespace ShiftOS.WinForms TextType("Go ahead and type 'sos.help' to see a list of commands."); while (TutorialProgress == 0) { + //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } TextType("As you can see, sos.help gives you a list of all commands in the system."); @@ -461,6 +468,10 @@ namespace ShiftOS.WinForms TextType("Go ahead and run the 'status' command within the 'sos' namespace to see what the command does."); while (TutorialProgress == 1) { + //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } TextType("Brilliant. The sos.status command will tell you how many Codepoints you have, as well as how many upgrades you have installed and how many are available."); @@ -478,6 +489,10 @@ namespace ShiftOS.WinForms TextType("To start using the Shiftorium, simply type 'shiftorium.list' to see available upgrades."); while (TutorialProgress == 2) { + //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } Clear(); @@ -502,13 +517,21 @@ namespace ShiftOS.WinForms TextType("shiftorium.info requires an upgrade argument, which is a string type. Go ahead and give shiftorium.info's upgrade argument the 'mud_fundamentals' upgrade's ID."); while (TutorialProgress == 3) { + //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } TextType("As you can see, mud_fundamentals is very useful. In fact, a lot of useful upgrades depend on it. You should buy it!"); Thread.Sleep(500); TextType("shiftorium.info already gave you a command that will let you buy the upgrade - go ahead and run that command!"); while (!Shiftorium.UpgradeInstalled("mud_fundamentals")) - { + { //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); + } TextType("Hooray! You now have the MUD Fundamentals upgrade."); @@ -520,6 +543,10 @@ namespace ShiftOS.WinForms TextType("Just run win.open without arguments, and this tutorial will be completed!"); while (TutorialProgress == 4) { + //JESUS CHRIST PAST MICHAEL. + + //We should PROBABLY block the thread... You know... not everyone has a 10-core processor. + Thread.Sleep(100); } TextType("This concludes the ShiftOS beginners' guide brought to you by the multi-user domain. Stay safe in a connected world."); @@ -528,6 +555,7 @@ namespace ShiftOS.WinForms { OnComplete?.Invoke(this, EventArgs.Empty); SaveSystem.CurrentSave.StoryPosition = 2; + this.Close(); SaveSystem.SaveGame(); AppearanceManager.SetupWindow(new Applications.Terminal()); }); diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 52663d7..a2a76b7 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -67,91 +67,6 @@ namespace ShiftOS.WinForms.Tools } - public static void SetupWindows() - { - if (SaveSystem.CurrentSave != null) - { - int screen_height_start = 0; - if (Shiftorium.UpgradeInstalled("wm_free_placement")) - { - } - else if (Shiftorium.UpgradeInstalled("wm_4_windows")) - { - int screen_width_half = Screen.PrimaryScreen.Bounds.Width / 2; - int screen_height_half = (Screen.PrimaryScreen.Bounds.Height - screen_height_start) / 2; - - for (int i = 0; i < OpenForms.Count; i++) - { - var frm = OpenForms[i] as WindowBorder; - - switch (i) - { - case 0: - frm.Location = new System.Drawing.Point(0, screen_height_start); - frm.Size = new System.Drawing.Size((OpenForms.Count > 1) ? screen_width_half : screen_width_half * 2, (OpenForms.Count > 2) ? screen_height_half : screen_height_half * 2); - - break; - case 1: - frm.Location = new System.Drawing.Point(screen_width_half, screen_height_start); - frm.Size = new System.Drawing.Size(screen_width_half, (OpenForms.Count > 2) ? screen_height_half : screen_height_half * 2); - break; - case 2: - frm.Location = new System.Drawing.Point(0, screen_height_half + screen_height_start); - frm.Size = new System.Drawing.Size((OpenForms.Count > 3) ? screen_width_half : screen_width_half * 2, screen_height_half); - break; - case 3: - frm.Location = new System.Drawing.Point(screen_width_half, screen_height_half + screen_height_start); - frm.Size = new System.Drawing.Size(screen_width_half, (OpenForms.Count > 2) ? screen_height_half : screen_height_half * 2); - break; - } - } - - } - else if (Shiftorium.UpgradeInstalled("window_manager")) - { - int screen_width_half = Screen.PrimaryScreen.Bounds.Width / 2; - int screen_height = (Screen.PrimaryScreen.Bounds.Height) - screen_height_start; - - - - for (int i = 0; i < OpenForms.Count; i++) - { - - - var frm = OpenForms[i] as WindowBorder; - switch (i) - { - case 0: - frm.Location = new System.Drawing.Point(0, screen_height_start); - frm.Size = new System.Drawing.Size((OpenForms.Count > 1) ? screen_width_half : screen_width_half * 2, screen_height); - break; - case 1: - frm.Location = new System.Drawing.Point(screen_width_half, screen_height_start); - frm.Size = new System.Drawing.Size(screen_width_half, screen_height); - break; - } - OpenForms[i] = frm; - } - } - else - { - var frm = OpenForms[0] as WindowBorder; - frm.Location = new Point(0, 0); - frm.Size = Desktop.Size; - OpenForms[0] = frm; - - } - } - else - { - var frm = OpenForms[0] as WindowBorder; - frm.Location = new Point(0, 0); - frm.Size = Desktop.Size; - OpenForms[0] = frm; - - } - } - internal static Color ConvertColor(ConsoleColor cCol) { switch (cCol) @@ -214,9 +129,22 @@ namespace ShiftOS.WinForms.Tools #endif } + /// + /// Centers the control along its parent. + /// + /// The control to center (this is an extension method - you can call it on a control as though it was a method in that control) + public static void CenterParent(this Control ctrl) + { + ctrl.Location = new Point( + (ctrl.Parent.Width - ctrl.Width) / 2, + (ctrl.Parent.Height - ctrl.Height) / 2 + ); + } + public static void SetupControl(Control ctrl) { SuspendDrawing(ctrl); + ctrl.SuspendLayout(); SetCursor(ctrl); if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) { @@ -270,13 +198,7 @@ namespace ShiftOS.WinForms.Tools a.SuppressKeyPress = true; - if (SaveSystem.CurrentSave != null) - { - if (Shiftorium.UpgradeInstalled("window_manager")) - { - Engine.AppearanceManager.SetupWindow(new Applications.Terminal()); - } - } + Engine.AppearanceManager.SetupWindow(new Applications.Terminal()); } ShiftOS.Engine.Scripting.LuaInterpreter.RaiseEvent("on_key_down", a); @@ -293,6 +215,7 @@ namespace ShiftOS.WinForms.Tools } MakeDoubleBuffered(ctrl); + ctrl.ResumeLayout(); ResumeDrawing(ctrl); } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 06f103e..033802e 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -664,10 +664,17 @@ namespace ShiftOS.WinForms /// Act. public void InvokeOnWorkerThread(Action act) { - this.Invoke(new Action(()=> + try { - act?.Invoke(); - })); + this.Invoke(new Action(() => + { + act?.Invoke(); + })); + } + catch + { + + } } public void OpenAppLauncher(Point loc) diff --git a/ShiftOS.WinForms/WinformsWindowManager.cs b/ShiftOS.WinForms/WinformsWindowManager.cs index 26438bf..cfcb6d3 100644 --- a/ShiftOS.WinForms/WinformsWindowManager.cs +++ b/ShiftOS.WinForms/WinformsWindowManager.cs @@ -184,20 +184,21 @@ namespace ShiftOS.WinForms if (maxWindows > 0) { - List formstoclose = new List(); - - for (int i = 0; i < maxWindows && i < AppearanceManager.OpenForms.Count; i++) + var windows = new List(); + foreach(var WB in AppearanceManager.OpenForms) { - var frm = AppearanceManager.OpenForms[i] as WindowBorder; - if(!frm.IsDialog) - formstoclose.Add(frm); - + if (WB is WindowBorder) + windows.Add(WB as WindowBorder); } + List formstoclose = new List(windows.Where(x => x.IsDialog == false).ToArray()); + while (formstoclose.Count > maxWindows - 1) { - formstoclose[0].Close(); + this.Close(formstoclose[0].ParentWindow); + AppearanceManager.OpenForms.Remove(formstoclose[0]); formstoclose.RemoveAt(0); + } } } diff --git a/ShiftOS_TheReturn/Shiftorium.cs b/ShiftOS_TheReturn/Shiftorium.cs index 0bdd9f4..4556cd6 100644 --- a/ShiftOS_TheReturn/Shiftorium.cs +++ b/ShiftOS_TheReturn/Shiftorium.cs @@ -46,6 +46,23 @@ namespace ShiftOS.Engine Installed?.Invoke(); } + public static string GetCategory(string id) + { + var upg = GetDefaults().FirstOrDefault(x => x.ID == id); + if (upg == null) + return "Other"; + return (upg.Category == null) ? "Other" : upg.Category; + } + + public static IEnumerable GetAllInCategory(string cat) + { + return GetDefaults().Where(x => x.Category == cat); + } + + public static bool IsCategoryEmptied(string cat) + { + return GetDefaults().Where(x => x.Category == cat).FirstOrDefault(x => x.Installed == false) == null; + } public static bool Buy(string id, int cost) { @@ -278,8 +295,15 @@ namespace ShiftOS.Engine public string Description { get; set; } public int Cost { get; set; } public string ID { get { return (this.Id != null ? this.Id : (Name.ToLower().Replace(" ", "_"))); } } - public string Id { get; } - + public string Id { get; set; } + public string Category { get; set; } + public bool Installed + { + get + { + return Shiftorium.UpgradeInstalled(ID); + } + } public string Dependencies { get; set; } } } -- cgit v1.2.3 From 5308c1cd4807edb2ec33f75923e609e8a382f1af Mon Sep 17 00:00:00 2001 From: lempamo Date: Thu, 6 Apr 2017 11:58:00 -0400 Subject: german translations aint showin halp --- ShiftOS.WinForms/Resources/strings_de.txt | 9 +++++---- ShiftOS.WinForms/Resources/strings_en.txt | 1 + ShiftOS.WinForms/WinformsDesktop.cs | 6 +++--- ShiftOS_TheReturn/Commands.cs | 1 - 4 files changed, 9 insertions(+), 8 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Resources/strings_de.txt b/ShiftOS.WinForms/Resources/strings_de.txt index 0602612..139ed69 100644 --- a/ShiftOS.WinForms/Resources/strings_de.txt +++ b/ShiftOS.WinForms/Resources/strings_de.txt @@ -48,7 +48,7 @@ Wenn eine Systemdatei von dem Virenscanner erkannt wird, wird sie ersetzt.", "{UPGRADES}":"Upgrades", "{APPLICATION}":"Anwendung", "{SCRIPT}":"Skript", - "{ERROR}":"Error", + "{ERROR}":"Fehler", "{SCRIPTS}":"Skripts", "{NULL}":"null", "{ID}":"ID Num", @@ -109,7 +109,7 @@ Wenn eine Systemdatei von dem Virenscanner erkannt wird, wird sie ersetzt.", "{UPGRADE_DEVELOPMENT_DESCRIPTION}":"Development Upgrade Don't Buy", "{SECONDS_LEFT}":"sekunden übrig", "{CASH_OUT_WITH_CODEPOINTS}":"Cash out with your codepoints", - "{PONG_PLAY_ON_FOR_MORE}":"Play on for more!", + "{PONG_PLAY_ON_FOR_MORE}":"Spiel für mehr!", "{YOU_REACHED_LEVEL}":"You've reached level", "{PONG_BEAT_AI_REWARD}":"Reward for beating AI (CP)", "{PONG_BEAT_AI_REWARD_SECONDARY}":"Codepoints for beating AI:", @@ -121,7 +121,7 @@ Wenn eine Systemdatei von dem Virenscanner erkannt wird, wird sie ersetzt.", "{TERMINAL_FORMATTING_DRIVE}":"Formatting drive... %percent %", "{INSTALLING_SHIFTOS}":"Installing ShiftOS on %domain.", "{YOU_MISSED_OUT_ON}":"You missed out on", - "{BUT_YOU_GAINED}":"But you gained", + "{BUT_YOU_GAINED}":"Aber du hast gewonnen", "{PONG_PLAYON_DESC}":"Or do you want to try your luck on the next level to increase your reward?", "{PONG_CASHOUT_DESC}":"Would you like the end the game now and cash out with your reward?", "{INITIAL_H_VEL}":"Initial H Vel", @@ -131,7 +131,7 @@ Wenn eine Systemdatei von dem Virenscanner erkannt wird, wird sie ersetzt.", "{MULTIPLAYER_ONLY}":"Program not compatible with single-user domain.", "{MULTIPLAYER_ONLY_EXP}":"This program cannot run within a single-user domain. You must be within a multi-user domain to use this program.", "{SHIFTER_SKIN_APPLIED}":"Shifter - Settings applied!", - "{YOU_HAVE_EARNED}":"You have earned", + "{YOU_HAVE_EARNED}":"Du hast bekommen", "{CREATING_PATH}":"Creating directory: %path", "{CREATING_FILE}":"Creating file: %path", "{SHIFTORIUM_HELP_DESCRIPTION}": "Help Descriptions", @@ -240,5 +240,6 @@ Wenn eine Systemdatei von dem Virenscanner erkannt wird, wird sie ersetzt.", "{DIALOG_NAME}":"Dialog", "{COLOR_PICKER_NAME}":"Color Picker", "{CHAT_NAME}":"Chat", + "{NOTIFICATIONS}":"Benachrichtigungen", "{GERMAN_SECRET}":"guten tag polen ist anschluss", } \ No newline at end of file diff --git a/ShiftOS.WinForms/Resources/strings_en.txt b/ShiftOS.WinForms/Resources/strings_en.txt index cc4bd1a..f63f0e0 100644 --- a/ShiftOS.WinForms/Resources/strings_en.txt +++ b/ShiftOS.WinForms/Resources/strings_en.txt @@ -240,4 +240,5 @@ If a system file is deleted by the virus scanner, it will be replaced.", "{DIALOG_NAME}":"Dialog", "{COLOR_PICKER_NAME}":"Color Picker", "{CHAT_NAME}":"Chat", + "{NOTIFICATIONS}":"Notifications", } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 033802e..182c607 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -65,7 +65,7 @@ namespace ShiftOS.WinForms //Soon this will pop a balloon note. this.Invoke(new Action(() => { - btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); })); }; @@ -74,7 +74,7 @@ namespace ShiftOS.WinForms //Soon this will pop a balloon note. this.Invoke(new Action(() => { - btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); })); }; @@ -100,7 +100,7 @@ namespace ShiftOS.WinForms this.Invoke(new Action(() => SetupDesktop())); this.Invoke(new Action(() => { - btnnotifications.Text = "Notifications (" + NotificationDaemon.GetUnreadCount().ToString() + ")"; + btnnotifications.Text = Localization.Parse("{NOTIFICATIONS} (" + NotificationDaemon.GetUnreadCount().ToString() + ")"); })); }; Shiftorium.Installed += () => diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index fedff19..c4f0c7a 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -357,7 +357,6 @@ namespace ShiftOS.Engine return true; } - [Command("lang", usage = "{{COMMAND_SOS_LANG_USAGE}}", description = "{{COMMAND_SOS_LANG_DESCRIPTION}}")] [RequiresArgument("language")] public static bool SetLanguage(Dictionary userArgs) { -- cgit v1.2.3 From fc9b618fafb6389a0dca714b79834ec024b0be2f Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 20:08:17 -0400 Subject: Basics for Advanced App Launcher. --- .../Applications/UpdateManager.Designer.cs | 44 +++++----- ShiftOS.WinForms/Resources/Shiftorium.txt | 9 +++ ShiftOS.WinForms/WinformsDesktop.Designer.cs | 94 ++++++++++++++++++++++ ShiftOS.WinForms/WinformsDesktop.cs | 85 +++++++++++++++++++ 4 files changed, 210 insertions(+), 22 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs index 466151a..0b23b8e 100644 --- a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs +++ b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs @@ -30,9 +30,9 @@ { this.lbupdatetitle = new System.Windows.Forms.Label(); this.pnlupdatebar = new System.Windows.Forms.Panel(); - this.btnclose = new System.Windows.Forms.Button(); - this.btnaction = new System.Windows.Forms.Button(); this.pgdownload = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); + this.btnaction = new System.Windows.Forms.Button(); + this.btnclose = new System.Windows.Forms.Button(); this.wbstatus = new System.Windows.Forms.WebBrowser(); this.pnlupdatebar.SuspendLayout(); this.SuspendLayout(); @@ -60,26 +60,6 @@ this.pnlupdatebar.Size = new System.Drawing.Size(597, 33); this.pnlupdatebar.TabIndex = 1; // - // btnclose - // - this.btnclose.Location = new System.Drawing.Point(4, 4); - this.btnclose.Name = "btnclose"; - this.btnclose.Size = new System.Drawing.Size(75, 23); - this.btnclose.TabIndex = 0; - this.btnclose.Text = "{CLOSE}"; - this.btnclose.UseVisualStyleBackColor = true; - this.btnclose.Click += new System.EventHandler(this.btnclose_Click); - // - // btnaction - // - this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.btnaction.Location = new System.Drawing.Point(519, 4); - this.btnaction.Name = "btnaction"; - this.btnaction.Size = new System.Drawing.Size(75, 23); - this.btnaction.TabIndex = 1; - this.btnaction.Text = "Update"; - this.btnaction.UseVisualStyleBackColor = true; - // // pgdownload // this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -94,6 +74,26 @@ this.pgdownload.Text = "Updating..."; this.pgdownload.Value = 0; // + // btnaction + // + this.btnaction.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnaction.Location = new System.Drawing.Point(519, 4); + this.btnaction.Name = "btnaction"; + this.btnaction.Size = new System.Drawing.Size(75, 23); + this.btnaction.TabIndex = 1; + this.btnaction.Text = "Update"; + this.btnaction.UseVisualStyleBackColor = true; + // + // btnclose + // + this.btnclose.Location = new System.Drawing.Point(4, 4); + this.btnclose.Name = "btnclose"; + this.btnclose.Size = new System.Drawing.Size(75, 23); + this.btnclose.TabIndex = 0; + this.btnclose.Text = "{CLOSE}"; + this.btnclose.UseVisualStyleBackColor = true; + this.btnclose.Click += new System.EventHandler(this.btnclose_Click); + // // wbstatus // this.wbstatus.Dock = System.Windows.Forms.DockStyle.Fill; diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 5310c40..adf187e 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -945,6 +945,15 @@ Description: "In the shiftorium GUI but dont know what you can spend because you can't see how many code points are on hand? Well shop easy, because with this upgrade that is now possible! You have to restart the shiftorium for it to work." }, + //ADVANCED APP LAUNCHER + { + Name: "Advanced App Launcher", + Cost: 10000, + Description: "The app launcher can categorize items and is quite clean, but let's make it even more advanced by adding more than just a traditional menu as the app launcher.", + Dependencies: "app_launcher_categories", + Category: "GUI" + }, + //UPDATE MANAGER { Name: "AL Update Manager", diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 2348320..3d24c3d 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -61,10 +61,20 @@ namespace ShiftOS.WinForms this.apps = new System.Windows.Forms.ToolStripMenuItem(); this.pnlscreensaver = new System.Windows.Forms.Panel(); this.pnlssicon = new System.Windows.Forms.Panel(); + this.pnladvancedal = new System.Windows.Forms.Panel(); + this.pnlalsystemactions = new System.Windows.Forms.Panel(); + this.btnshutdown = new System.Windows.Forms.Button(); + this.pnlstatus = new System.Windows.Forms.Panel(); + this.lbalstatus = new System.Windows.Forms.Label(); + this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); + this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.desktoppanel.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.pnlscreensaver.SuspendLayout(); + this.pnladvancedal.SuspendLayout(); + this.pnlalsystemactions.SuspendLayout(); + this.pnlstatus.SuspendLayout(); this.SuspendLayout(); // // desktoppanel @@ -108,6 +118,7 @@ namespace ShiftOS.WinForms this.lbtime.TabIndex = 0; this.lbtime.Text = "label1"; this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight; + this.lbtime.Click += new System.EventHandler(this.lbtime_Click); // // panelbuttonholder // @@ -146,6 +157,7 @@ namespace ShiftOS.WinForms this.apps.Size = new System.Drawing.Size(58, 20); this.apps.Tag = "applauncherbutton"; this.apps.Text = "ShiftOS"; + this.apps.Click += new System.EventHandler(this.apps_Click); // // pnlscreensaver // @@ -164,12 +176,83 @@ namespace ShiftOS.WinForms this.pnlssicon.Size = new System.Drawing.Size(200, 100); this.pnlssicon.TabIndex = 0; // + // pnladvancedal + // + this.pnladvancedal.Controls.Add(this.flapps); + this.pnladvancedal.Controls.Add(this.flcategories); + this.pnladvancedal.Controls.Add(this.pnlalsystemactions); + this.pnladvancedal.Controls.Add(this.pnlstatus); + this.pnladvancedal.Location = new System.Drawing.Point(0, 24); + this.pnladvancedal.Name = "pnladvancedal"; + this.pnladvancedal.Size = new System.Drawing.Size(433, 417); + this.pnladvancedal.TabIndex = 1; + this.pnladvancedal.Visible = false; + // + // pnlalsystemactions + // + this.pnlalsystemactions.Controls.Add(this.btnshutdown); + this.pnlalsystemactions.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pnlalsystemactions.Location = new System.Drawing.Point(0, 386); + this.pnlalsystemactions.Name = "pnlalsystemactions"; + this.pnlalsystemactions.Size = new System.Drawing.Size(433, 31); + this.pnlalsystemactions.TabIndex = 1; + // + // btnshutdown + // + this.btnshutdown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.btnshutdown.AutoSize = true; + this.btnshutdown.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnshutdown.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnshutdown.Location = new System.Drawing.Point(355, 3); + this.btnshutdown.Name = "btnshutdown"; + this.btnshutdown.Size = new System.Drawing.Size(75, 26); + this.btnshutdown.TabIndex = 0; + this.btnshutdown.Text = "Shutdown"; + this.btnshutdown.UseVisualStyleBackColor = true; + this.btnshutdown.Click += new System.EventHandler(this.btnshutdown_Click); + // + // pnlstatus + // + this.pnlstatus.Controls.Add(this.lbalstatus); + this.pnlstatus.Dock = System.Windows.Forms.DockStyle.Top; + this.pnlstatus.Location = new System.Drawing.Point(0, 0); + this.pnlstatus.Name = "pnlstatus"; + this.pnlstatus.Size = new System.Drawing.Size(433, 58); + this.pnlstatus.TabIndex = 0; + // + // lbalstatus + // + this.lbalstatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbalstatus.Location = new System.Drawing.Point(0, 0); + this.lbalstatus.Name = "lbalstatus"; + this.lbalstatus.Size = new System.Drawing.Size(433, 58); + this.lbalstatus.TabIndex = 0; + this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available"; + this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // flcategories + // + this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; + this.flcategories.Location = new System.Drawing.Point(0, 58); + this.flcategories.Name = "flcategories"; + this.flcategories.Size = new System.Drawing.Size(221, 328); + this.flcategories.TabIndex = 2; + // + // flapps + // + this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; + this.flapps.Location = new System.Drawing.Point(221, 58); + this.flapps.Name = "flapps"; + this.flapps.Size = new System.Drawing.Size(212, 328); + this.flapps.TabIndex = 3; + // // WinformsDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); 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.pnladvancedal); this.Controls.Add(this.pnlscreensaver); this.Controls.Add(this.desktoppanel); this.Font = new System.Drawing.Font("Consolas", 9F); @@ -185,6 +268,10 @@ namespace ShiftOS.WinForms this.menuStrip1.ResumeLayout(false); this.menuStrip1.PerformLayout(); this.pnlscreensaver.ResumeLayout(false); + this.pnladvancedal.ResumeLayout(false); + this.pnlalsystemactions.ResumeLayout(false); + this.pnlalsystemactions.PerformLayout(); + this.pnlstatus.ResumeLayout(false); this.ResumeLayout(false); } @@ -200,6 +287,13 @@ namespace ShiftOS.WinForms private System.Windows.Forms.Button btnnotifications; private System.Windows.Forms.Panel pnlscreensaver; private System.Windows.Forms.Panel pnlssicon; + private System.Windows.Forms.Panel pnladvancedal; + private System.Windows.Forms.Panel pnlalsystemactions; + private System.Windows.Forms.Button btnshutdown; + private System.Windows.Forms.Panel pnlstatus; + private System.Windows.Forms.Label lbalstatus; + private System.Windows.Forms.FlowLayoutPanel flapps; + private System.Windows.Forms.FlowLayoutPanel flcategories; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 182c607..a808dd8 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -459,6 +459,8 @@ namespace ShiftOS.WinForms return itm; } + public Dictionary> LauncherItemList = new Dictionary>(); + /// /// Populates the app launcher. /// @@ -472,6 +474,9 @@ namespace ShiftOS.WinForms Dictionary> sortedItems = new Dictionary>(); + flcategories.Controls.Clear(); + + LauncherItemList.Clear(); foreach (var kv in items) @@ -495,11 +500,13 @@ namespace ShiftOS.WinForms if (sortedItems.ContainsKey(kv.DisplayData.Category)) { sortedItems[kv.DisplayData.Category].Add(item); + LauncherItemList[kv.DisplayData.Category].Add(kv); } else { sortedItems.Add(kv.DisplayData.Category, new List()); sortedItems[kv.DisplayData.Category].Add(item); + LauncherItemList.Add(kv.DisplayData.Category, new List { kv }); } } @@ -514,6 +521,22 @@ namespace ShiftOS.WinForms { cat.DropDownItems.Add(subItem); } + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + var catbtn = new Button(); + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = kv.Key; + catbtn.Width = flcategories.Width; + catbtn.Height = 24; + flcategories.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => SetupAdvancedCategory(catbtn.Text); + } } else @@ -545,6 +568,47 @@ namespace ShiftOS.WinForms LuaInterpreter.RaiseEvent("on_al_populate", items); } + public void SetupAdvancedCategory(string cat) + { + flapps.Controls.Clear(); + + foreach(var app in LauncherItemList[cat]) + { + var catbtn = new Button(); + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); + catbtn.Width = flapps.Width; + catbtn.Height = 24; + catbtn.ImageAlign = ContentAlignment.MiddleLeft; + catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); + + flapps.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => + { + pnladvancedal.Hide(); + if(app is LuaLauncherItem) + { + var interp = new LuaInterpreter(); + interp.ExecuteFile((app as LuaLauncherItem).LaunchPath); + } + else + { + IShiftOSWindow win = Activator.CreateInstance(app.LaunchType) as IShiftOSWindow; + AppearanceManager.SetupWindow(win); + } + + + + }; + + } + } /// /// Desktops the load. @@ -702,6 +766,27 @@ namespace ShiftOS.WinForms { e.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality; } + + private void lbtime_Click(object sender, EventArgs e) + { + } + + private void apps_Click(object sender, EventArgs e) + { + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + flapps.Controls.Clear(); + apps.DropDown.Hide(); + pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); + pnladvancedal.Visible = !pnladvancedal.Visible; + } + + } + + private void btnshutdown_Click(object sender, EventArgs e) + { + TerminalBackend.InvokeCommand("sos.shutdown"); + } } [ShiftOS.Engine.Scripting.Exposed("desktop")] -- cgit v1.2.3 From e315fc15b392d0aeb4c016aa9cafd0742ce74970 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 20:10:48 -0400 Subject: Populate Advanced AL status text. --- ShiftOS.WinForms/WinformsDesktop.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index a808dd8..96dadc3 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -775,6 +775,10 @@ namespace ShiftOS.WinForms { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { + lbalstatus.Text = $@"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName} +{SaveSystem.CurrentSave.Codepoints} Codepoints +{Shiftorium.GetAvailable().Length} available, {SaveSystem.CurrentSave.CountUpgrades()} installed."; + flapps.Controls.Clear(); apps.DropDown.Hide(); pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); -- cgit v1.2.3 From 70557ebe5dd72d95dc06eb4c628733054e58a7d1 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 7 Apr 2017 20:20:45 -0400 Subject: Finish AAL layout --- ShiftOS.WinForms/WinformsDesktop.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 96dadc3..7a346e3 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -468,6 +468,17 @@ namespace ShiftOS.WinForms /// Items. public void PopulateAppLauncher(LauncherItem[] items) { + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + ControlManager.SetupControls(pnladvancedal); + pnladvancedal.Visible = false; + flapps.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + flcategories.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + pnlalsystemactions.BackColor = LoadedSkin.DesktopPanelColor; + lbalstatus.BackColor = LoadedSkin.DesktopPanelColor; + } + + if (DesktopFunctions.ShowDefaultElements == true) { apps.DropDownItems.Clear(); -- cgit v1.2.3 From ef64da6c1b814e7888ff0fc8753095f184bfc471 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 19:40:41 -0400 Subject: Start DevX MCC story properly --- ShiftOS.WinForms/Resources/Shiftorium.txt | 2 +- ShiftOS.WinForms/WinformsDesktop.cs | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index adf187e..ae4cb0a 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -220,7 +220,7 @@ { Name: "AL MUD Control Centre", Cost: 150, - Dependencies: "mud_fundamentals;app_launcher", + Dependencies: "mud_control_centre;app_launcher", Category: "Device Drivers", Description: "Want to access your MUD profile, legions, jobs and shops, but don't want to open your Terminal? This upgrade is for you!" }, diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 7a346e3..5a42106 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -58,6 +58,23 @@ namespace ShiftOS.WinForms public WinformsDesktop() { InitializeComponent(); + Shiftorium.Installed += () => + { + //Only if the DevX Legions story hasn't been experienced yet. + if (!Shiftorium.UpgradeInstalled("devx_legions")) + { + //Check for shiftnet story experience + if (Shiftorium.UpgradeInstalled("shiftnet")) + { + //Check for saturation of the "GUI" upgrade set + if (Shiftorium.IsCategoryEmptied("GUI")) + { + //Start the MUD Control Centre story. + Story.Start("devx_legions"); + } + } + } + }; this.TopMost = false; NotificationDaemon.NotificationMade += (note) => -- cgit v1.2.3 From a9a9beaf63e5a8dc63e8ec8388373e3868d11cfb Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 9 Apr 2017 20:46:56 -0400 Subject: finish the smiley's first story --- ShiftOS.WinForms/Applications/Downloader.cs | 5 +- ShiftOS.WinForms/Applications/Installer.cs | 5 ++ ShiftOS.WinForms/Applications/Shiftnet.cs | 5 +- ShiftOS.WinForms/Resources/Shiftorium.txt | 23 ++++- ShiftOS.WinForms/Stories/LegionStory.cs | 135 +++++++++++++++++++++++++++- ShiftOS.WinForms/WinformsDesktop.cs | 11 +++ 6 files changed, 179 insertions(+), 5 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index 1f240bf..b3d2cea 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -42,8 +42,11 @@ using System.IO.Compression; namespace ShiftOS.WinForms.Applications { [MultiplayerOnly] - [Launcher("Downloader", false, null, "Networking")] + [Launcher("Downloader", true, "al_downloader", "Networking")] [DefaultIcon("iconDownloader")] + [WinOpen("downloader")] + [DefaultTitle("Downloader")] + [RequiresUpgrade("downloader")] public partial class Downloader : UserControl, IShiftOSWindow { public Downloader() diff --git a/ShiftOS.WinForms/Applications/Installer.cs b/ShiftOS.WinForms/Applications/Installer.cs index 1b5521e..2193f8a 100644 --- a/ShiftOS.WinForms/Applications/Installer.cs +++ b/ShiftOS.WinForms/Applications/Installer.cs @@ -11,6 +11,11 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { + [WinOpen("installer")] + [RequiresUpgrade("installer")] + [MultiplayerOnly] + [DefaultTitle("Installer")] + [Launcher("Installer", true, "al_installer", "Utilities")] public partial class Installer : UserControl, IShiftOSWindow { public Installer() diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 501fa56..54a8aa6 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -44,8 +44,11 @@ namespace ShiftOS.WinForms.Applications // //READ THE DAMN SHIFTOS CODING GUIDELINES. - [Launcher("Shiftnet", false, null, "Networking")] + [Launcher("Shiftnet", true, "al_shiftnet", "Networking")] [MultiplayerOnly] + [DefaultTitle("Shiftnet")] + [WinOpen("shiftnet")] + [RequiresUpgrade("victortran_shiftnet")] [DefaultIcon("iconShiftnet")] public partial class Shiftnet : UserControl, IShiftOSWindow { diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index ae4cb0a..fd03677 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -160,7 +160,28 @@ Category: "GUI", Description: "This upgrade allows you to find ShiftLotto in your App Launcher." }, - + //STORY-DRIVEN AL UPGRADES + { + Name: "AL Shiftnet", + Cost: 150, + Dependencies: "app_launcher;victortran_shiftnet", + Category: "GUI", + Description: "This upgrade puts a Shiftnet entry into your app launcher - you know, for those times when you just feel like surfing the net." + }, + { + Name: "AL Installer", + Cost: 150, + Dependencies: "installer;app_launcher", + Category: "GUI", + Description: "Got a new .stp file and want to set it up, from your App Launcher? This upgrade is for you! It adds an AL entry for the Installer." + }, + { + Name: "AL Downloader", + Cost: 150, + Dependencies: "app_launcher;downloader", + Category: "GUI", + Description: "The Downloader is an easy, central way to check all your downloads' progress. This upgrade adds an app launcher entry for it." + }, // COLOR DEPTH AND DITHERING { diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 00c7544..9b4966f 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -10,6 +10,72 @@ namespace ShiftOS.WinForms.Stories { public static class LegionStory { + private static string CharacterName = "DevX"; + private static string SysName = "mud"; + + [Story("victortran_shiftnet")] + public static void ShiftnetStoryFeaturingTheBlueSmileyFaceHolyFuckThisFunctionNameIsLong() + { + CharacterName = "victor_tran"; + SysName = "theos"; + bool waiting = false; + var installer = new Applications.Installer(); + installer.InstallCompleted += () => + { + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.Close(installer); + }); + waiting = false; + }; + + if (!terminalOpen()) + { + var term = new Applications.Terminal(); + AppearanceManager.SetupWindow(term); + } + + var t = new Thread(() => + { + WriteLine("victortran@theos - user connecting to your system.", false); + Thread.Sleep(2000); + WriteLine("Hey there - yes, I am not just a sentient being. I am indeed Victor Tran."); + WriteLine("I am the creator of a Linux desktop environment called theShell."); + WriteLine("I'm in the middle of working on a ShiftOS version of it."); + WriteLine("However, before I start, I feel I need to show you something."); + WriteLine("You have a lot of ShiftOS applications, and you can earn lots of Codepoints - and you already have lots."); + WriteLine("Well, you'd be a perfect candidate for me to install the Shiftnet Client on your system."); + WriteLine("I'll begin the installation right now."); + //Set up an Installer. + waiting = true; + Desktop.InvokeOnWorkerThread(() => + { + Story.Start("installer"); + AppearanceManager.SetupWindow(installer); + installer.InitiateInstall(new ShiftnetInstallation()); + }); + while (waiting == true) + Thread.Sleep(25); + + WriteLine("All installed! Once I disconnect, type win.open to see a list of your new apps."); + WriteLine("The Shiftnet is a vast network of websites only accessible through ShiftOS."); + WriteLine("Think of it as the DarkNet, but much darker, and much more secretive."); + WriteLine("There are lots of apps, games, skins and utilities on the Shiftnet."); + 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("Anyways, it was nice meeting you, hopefully someday you'll give theShell a try."); + + TerminalBackend.PrefixEnabled = true; + TerminalBackend.PrintPrompt(); + }); + t.IsBackground = true; + t.Start(); + + TerminalBackend.PrefixEnabled = false; + + } + private static void WriteLine(string text, bool showCharacterName=true) { Console.WriteLine(); @@ -17,11 +83,11 @@ namespace ShiftOS.WinForms.Stories { ConsoleEx.Bold = true; ConsoleEx.ForegroundColor = ConsoleColor.DarkMagenta; - Console.Write("DevX"); + Console.Write(CharacterName); Console.ForegroundColor = ConsoleColor.White; Console.Write("@"); ConsoleEx.ForegroundColor = ConsoleColor.Yellow; - Console.Write("mud: "); + Console.Write(SysName + ": "); } ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; @@ -56,6 +122,8 @@ namespace ShiftOS.WinForms.Stories [Story("devx_legions")] public static void DevXLegionStory() { + CharacterName = "DevX"; + SysName = "mud"; bool waiting = false; //Used for DevX dialogue. //Used for legion selection. @@ -198,5 +266,68 @@ namespace ShiftOS.WinForms.Stories SetProgress(100); } } + + /// + /// Stub: Used for story-driven Shiftorium dependency "installer". + /// + [Story("installer")] + public static void InstallerPlaceholder() + { + + } + + /// + /// Stub: Used for story-driven Shiftorium dependency: "downloader" + /// + [Story("downloader")] + public static void DownloaderPlaceholder() + { + + } + + public class ShiftnetInstallation : Applications.Installation + { + protected override void Run() + { + SetStatus("Preparing to install dependency: installer_user_agent"); + SetProgress(0); + Thread.Sleep(5000); + for(int i = 0; i < 100; i++) + { + SetStatus("Installing installer_user_agent"); + SetProgress(i); + Thread.Sleep(50); + } + SetProgress(0); + SetStatus("Preparing to install dependency: downloader"); + Thread.Sleep(3500); + for(int i = 0; i < 100; i++) + { + SetStatus("Installing dependency: downloader"); + SetProgress(i); + Thread.Sleep(100); + } + Story.Start("downloader"); + SetProgress(0); + SetStatus("Dependencies installed."); + Thread.Sleep(2000); + SetStatus("Installing Shiftnet."); + Thread.Sleep(3000); + for(int i = 0; i < 100; i++) + { + SetProgress(i); + string dots = ""; + if ((i % 2) == 0) + dots = "."; + if ((i % 3) == 0) + dots = ".."; + if ((i % 4) == 0) + dots = "..."; + SetStatus($"Installing Shiftnet{dots}"); + Thread.Sleep(100); + } + + } + } } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 5a42106..8704b94 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -74,6 +74,17 @@ namespace ShiftOS.WinForms } } } + + if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) + { + if (SaveSystem.CurrentSave.Codepoints >= 50000) + { + if (Shiftorium.IsCategoryEmptied("Applications")) + { + Story.Start("victortran_shiftnet"); + } + } + } }; this.TopMost = false; -- cgit v1.2.3 From 56e216a430694d86c242df763484deba682f3302 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Apr 2017 20:21:11 -0400 Subject: Hide AL when clicking on window ctrls --- .../Applications/MUDControlCentre.Designer.cs | 184 ++++++++--------- ShiftOS.WinForms/Resources/Shiftorium.txt | 7 + ShiftOS.WinForms/Tools/ControlManager.cs | 5 +- ShiftOS.WinForms/WindowBorder.cs | 12 ++ ShiftOS.WinForms/WinformsDesktop.cs | 112 +++++++---- ShiftOS_TheReturn/Desktop.cs | 8 + ShiftOS_TheReturn/Skinning.cs | 224 ++++++++++++++++----- 7 files changed, 358 insertions(+), 194 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs index e2c0af3..125ea99 100644 --- a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs +++ b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs @@ -66,9 +66,13 @@ namespace ShiftOS.WinForms.Applications this.createLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.joinLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.myLegionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.chatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.joinAChatToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer(); + this.pnlclasses = new System.Windows.Forms.Panel(); + this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnchooseclass = new System.Windows.Forms.Button(); + this.lbclasses = new System.Windows.Forms.ListBox(); + this.lbclassdesc = new System.Windows.Forms.Label(); + this.lbclasstitle = new System.Windows.Forms.Label(); this.you_systemstatus = new System.Windows.Forms.Panel(); this.btndeletesave = new System.Windows.Forms.Button(); this.lblsysstatus = new System.Windows.Forms.Label(); @@ -144,16 +148,12 @@ namespace ShiftOS.WinForms.Applications this.you_memos = new System.Windows.Forms.Panel(); this.flmemos = new System.Windows.Forms.FlowLayoutPanel(); this.label3 = new System.Windows.Forms.Label(); - this.pnlclasses = new System.Windows.Forms.Panel(); - this.lbclasstitle = new System.Windows.Forms.Label(); - this.lbclassdesc = new System.Windows.Forms.Label(); - this.lbclasses = new System.Windows.Forms.ListBox(); - this.flowLayoutPanel6 = new System.Windows.Forms.FlowLayoutPanel(); - this.btnchooseclass = new System.Windows.Forms.Button(); this.menuStrip1.SuspendLayout(); this.toolStripContainer1.ContentPanel.SuspendLayout(); this.toolStripContainer1.TopToolStripPanel.SuspendLayout(); this.toolStripContainer1.SuspendLayout(); + this.pnlclasses.SuspendLayout(); + this.flowLayoutPanel6.SuspendLayout(); this.you_systemstatus.SuspendLayout(); this.shop_all.SuspendLayout(); this.shop_view.SuspendLayout(); @@ -178,8 +178,6 @@ namespace ShiftOS.WinForms.Applications this.panel3.SuspendLayout(); this.flowLayoutPanel2.SuspendLayout(); this.you_memos.SuspendLayout(); - this.pnlclasses.SuspendLayout(); - this.flowLayoutPanel6.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -188,8 +186,7 @@ namespace ShiftOS.WinForms.Applications this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.youToolStripMenuItem, this.shopsToolStripMenuItem, - this.legionsToolStripMenuItem, - this.chatToolStripMenuItem}); + this.legionsToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; this.menuStrip1.Size = new System.Drawing.Size(756, 24); @@ -289,21 +286,6 @@ namespace ShiftOS.WinForms.Applications this.myLegionToolStripMenuItem.Text = "My Legion"; this.myLegionToolStripMenuItem.Click += new System.EventHandler(this.myLegionToolStripMenuItem_Click); // - // chatToolStripMenuItem - // - this.chatToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.joinAChatToolStripMenuItem}); - this.chatToolStripMenuItem.Name = "chatToolStripMenuItem"; - this.chatToolStripMenuItem.Size = new System.Drawing.Size(44, 20); - this.chatToolStripMenuItem.Text = "Chat"; - // - // joinAChatToolStripMenuItem - // - this.joinAChatToolStripMenuItem.Name = "joinAChatToolStripMenuItem"; - this.joinAChatToolStripMenuItem.Size = new System.Drawing.Size(130, 22); - this.joinAChatToolStripMenuItem.Text = "Join a chat"; - this.joinAChatToolStripMenuItem.Click += new System.EventHandler(this.joinAChatToolStripMenuItem_Click); - // // toolStripContainer1 // // @@ -331,6 +313,75 @@ namespace ShiftOS.WinForms.Applications // this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1); // + // pnlclasses + // + this.pnlclasses.Controls.Add(this.flowLayoutPanel6); + this.pnlclasses.Controls.Add(this.lbclasses); + this.pnlclasses.Controls.Add(this.lbclassdesc); + this.pnlclasses.Controls.Add(this.lbclasstitle); + this.pnlclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlclasses.Location = new System.Drawing.Point(0, 0); + this.pnlclasses.Name = "pnlclasses"; + this.pnlclasses.Size = new System.Drawing.Size(756, 464); + this.pnlclasses.TabIndex = 3; + // + // flowLayoutPanel6 + // + this.flowLayoutPanel6.AutoSize = true; + this.flowLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel6.Controls.Add(this.btnchooseclass); + this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 415); + this.flowLayoutPanel6.Name = "flowLayoutPanel6"; + this.flowLayoutPanel6.Padding = new System.Windows.Forms.Padding(10); + this.flowLayoutPanel6.Size = new System.Drawing.Size(756, 49); + this.flowLayoutPanel6.TabIndex = 3; + // + // btnchooseclass + // + this.btnchooseclass.AutoSize = true; + this.btnchooseclass.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnchooseclass.Location = new System.Drawing.Point(13, 13); + this.btnchooseclass.Name = "btnchooseclass"; + this.btnchooseclass.Size = new System.Drawing.Size(53, 23); + this.btnchooseclass.TabIndex = 0; + this.btnchooseclass.Text = "Choose"; + this.btnchooseclass.UseVisualStyleBackColor = true; + this.btnchooseclass.Click += new System.EventHandler(this.btnchooseclass_Click); + // + // lbclasses + // + this.lbclasses.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbclasses.FormattingEnabled = true; + this.lbclasses.Location = new System.Drawing.Point(0, 66); + this.lbclasses.Name = "lbclasses"; + this.lbclasses.Size = new System.Drawing.Size(756, 398); + this.lbclasses.TabIndex = 2; + // + // lbclassdesc + // + this.lbclassdesc.AutoSize = true; + this.lbclassdesc.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclassdesc.Location = new System.Drawing.Point(0, 33); + this.lbclassdesc.Name = "lbclassdesc"; + this.lbclassdesc.Padding = new System.Windows.Forms.Padding(10); + this.lbclassdesc.Size = new System.Drawing.Size(727, 33); + this.lbclassdesc.TabIndex = 1; + this.lbclassdesc.Text = "A class is a way for the multi-user domain to better understand you. It defines w" + + "ho you are as a sentient being, what you do, what you like, and so on."; + // + // lbclasstitle + // + this.lbclasstitle.AutoSize = true; + this.lbclasstitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbclasstitle.Location = new System.Drawing.Point(0, 0); + this.lbclasstitle.Name = "lbclasstitle"; + this.lbclasstitle.Padding = new System.Windows.Forms.Padding(10); + this.lbclasstitle.Size = new System.Drawing.Size(82, 33); + this.lbclasstitle.TabIndex = 0; + this.lbclasstitle.Tag = "header1"; + this.lbclasstitle.Text = "Join a class"; + // // you_systemstatus // this.you_systemstatus.Controls.Add(this.btndeletesave); @@ -1191,75 +1242,6 @@ namespace ShiftOS.WinForms.Applications this.label3.Tag = "header1"; this.label3.Text = "Memos"; // - // pnlclasses - // - this.pnlclasses.Controls.Add(this.flowLayoutPanel6); - this.pnlclasses.Controls.Add(this.lbclasses); - this.pnlclasses.Controls.Add(this.lbclassdesc); - this.pnlclasses.Controls.Add(this.lbclasstitle); - this.pnlclasses.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlclasses.Location = new System.Drawing.Point(0, 0); - this.pnlclasses.Name = "pnlclasses"; - this.pnlclasses.Size = new System.Drawing.Size(756, 464); - this.pnlclasses.TabIndex = 3; - // - // lbclasstitle - // - this.lbclasstitle.AutoSize = true; - this.lbclasstitle.Dock = System.Windows.Forms.DockStyle.Top; - this.lbclasstitle.Location = new System.Drawing.Point(0, 0); - this.lbclasstitle.Name = "lbclasstitle"; - this.lbclasstitle.Padding = new System.Windows.Forms.Padding(10); - this.lbclasstitle.Size = new System.Drawing.Size(82, 33); - this.lbclasstitle.TabIndex = 0; - this.lbclasstitle.Tag = "header1"; - this.lbclasstitle.Text = "Join a class"; - // - // lbclassdesc - // - this.lbclassdesc.AutoSize = true; - this.lbclassdesc.Dock = System.Windows.Forms.DockStyle.Top; - this.lbclassdesc.Location = new System.Drawing.Point(0, 33); - this.lbclassdesc.Name = "lbclassdesc"; - this.lbclassdesc.Padding = new System.Windows.Forms.Padding(10); - this.lbclassdesc.Size = new System.Drawing.Size(727, 33); - this.lbclassdesc.TabIndex = 1; - this.lbclassdesc.Text = "A class is a way for the multi-user domain to better understand you. It defines w" + - "ho you are as a sentient being, what you do, what you like, and so on."; - // - // lbclasses - // - this.lbclasses.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbclasses.FormattingEnabled = true; - this.lbclasses.Location = new System.Drawing.Point(0, 66); - this.lbclasses.Name = "lbclasses"; - this.lbclasses.Size = new System.Drawing.Size(756, 398); - this.lbclasses.TabIndex = 2; - // - // flowLayoutPanel6 - // - this.flowLayoutPanel6.AutoSize = true; - this.flowLayoutPanel6.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel6.Controls.Add(this.btnchooseclass); - this.flowLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel6.Location = new System.Drawing.Point(0, 415); - this.flowLayoutPanel6.Name = "flowLayoutPanel6"; - this.flowLayoutPanel6.Padding = new System.Windows.Forms.Padding(10); - this.flowLayoutPanel6.Size = new System.Drawing.Size(756, 49); - this.flowLayoutPanel6.TabIndex = 3; - // - // btnchooseclass - // - this.btnchooseclass.AutoSize = true; - this.btnchooseclass.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.btnchooseclass.Location = new System.Drawing.Point(13, 13); - this.btnchooseclass.Name = "btnchooseclass"; - this.btnchooseclass.Size = new System.Drawing.Size(53, 23); - this.btnchooseclass.TabIndex = 0; - this.btnchooseclass.Text = "Choose"; - this.btnchooseclass.UseVisualStyleBackColor = true; - this.btnchooseclass.Click += new System.EventHandler(this.btnchooseclass_Click); - // // MUDControlCentre // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1276,6 +1258,10 @@ namespace ShiftOS.WinForms.Applications this.toolStripContainer1.TopToolStripPanel.PerformLayout(); this.toolStripContainer1.ResumeLayout(false); this.toolStripContainer1.PerformLayout(); + this.pnlclasses.ResumeLayout(false); + this.pnlclasses.PerformLayout(); + this.flowLayoutPanel6.ResumeLayout(false); + this.flowLayoutPanel6.PerformLayout(); this.you_systemstatus.ResumeLayout(false); this.you_systemstatus.PerformLayout(); this.shop_all.ResumeLayout(false); @@ -1320,10 +1306,6 @@ namespace ShiftOS.WinForms.Applications this.flowLayoutPanel2.PerformLayout(); this.you_memos.ResumeLayout(false); this.you_memos.PerformLayout(); - this.pnlclasses.ResumeLayout(false); - this.pnlclasses.PerformLayout(); - this.flowLayoutPanel6.ResumeLayout(false); - this.flowLayoutPanel6.PerformLayout(); this.ResumeLayout(false); } @@ -1418,8 +1400,6 @@ namespace ShiftOS.WinForms.Applications private System.Windows.Forms.Button btnremoveitem; private System.Windows.Forms.Button btnedititem; private System.Windows.Forms.Button btneditshop; - private System.Windows.Forms.ToolStripMenuItem chatToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem joinAChatToolStripMenuItem; private System.Windows.Forms.Button btndeletesave; private System.Windows.Forms.Panel pnlclasses; private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel6; diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index fd03677..2260198 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -197,6 +197,13 @@ Category: "Device Drivers", Dependencies: "color_depth_dithering" }, + { + Name: "Shift Advanced App Launcher", + Cost: 150, + Description: "So you got yourself one of those fancy Advanced App Launchers. Well, it ain't so advanced if it can't be customized! This upgrade will add some settings to the Shifter so you can customize the Advanced App Launcher and its behaviour.", + Dependencies: "advanced_app_launcher;shifter", + Category: "Customization" + }, { Name: "Color Depth 2 bits", Cost: 2000, diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index d12e54a..6d60f9d 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -270,7 +270,10 @@ 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++) diff --git a/ShiftOS.WinForms/WindowBorder.cs b/ShiftOS.WinForms/WindowBorder.cs index e809f90..64f2da4 100644 --- a/ShiftOS.WinForms/WindowBorder.cs +++ b/ShiftOS.WinForms/WindowBorder.cs @@ -92,6 +92,16 @@ namespace ShiftOS.WinForms lbtitletext.Text = title; } + public void SetupControls(Control ctrl) + { + foreach (Control c in ctrl.Controls) + SetupControls(c); + ctrl.Click += (o, a) => + { + Desktop.HideAppLauncher(); + }; + } + /// /// Initializes a new instance of the class. /// @@ -127,6 +137,8 @@ namespace ShiftOS.WinForms this.Width = LoadedSkin.LeftBorderWidth + _parentWindow.Width + LoadedSkin.RightBorderWidth; this.Height = LoadedSkin.TitlebarHeight + _parentWindow.Height + LoadedSkin.BottomBorderWidth; + SetupControls(this); + this.pnlcontents.Controls.Add(this._parentWindow); this._parentWindow.Dock = DockStyle.Fill; this._parentWindow.Show(); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 8704b94..d50be53 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -244,45 +244,6 @@ namespace ShiftOS.WinForms private void ShowScreensaver() { - if (Shiftorium.UpgradeInstalled("screensavers")) - { - this.Invoke(new Action(() => - { - pnlscreensaver.Show(); - this.TopMost = true; - pnlssicon.Show(); - pnlssicon.BackColor = Color.Green; - pnlssicon.BackgroundImage = GetImage("screensaver"); - pnlssicon.BackgroundImageLayout = GetImageLayout("screensaver"); - - if (pnlssicon.BackgroundImage != null) - { - pnlssicon.Size = pnlssicon.BackgroundImage.Size; - } - - Cursor.Hide(); - - var t = new Thread(() => - { - var rnd = new Random(); - while (InScreensaver == true) - { - int x = rnd.Next(0, this.Width); - int y = rnd.Next(0, this.Height); - - this.Invoke(new Action(() => - { - pnlssicon.Location = new Point(x, y); - })); - - Thread.Sleep(5000); - } - ResetDesktop = true; - }); - t.IsBackground = true; - t.Start(); - })); - } } @@ -498,12 +459,47 @@ namespace ShiftOS.WinForms { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { - ControlManager.SetupControls(pnladvancedal); pnladvancedal.Visible = false; flapps.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; flcategories.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; - pnlalsystemactions.BackColor = LoadedSkin.DesktopPanelColor; - lbalstatus.BackColor = LoadedSkin.DesktopPanelColor; + pnlalsystemactions.BackColor = LoadedSkin.SystemPanelBackground; + lbalstatus.BackColor = LoadedSkin.ALStatusPanelBackColor; + //Fonts + lbalstatus.Font = LoadedSkin.ALStatusPanelFont; + btnshutdown.Font = LoadedSkin.ShutdownFont; + + //Upgrades + btnshutdown.Visible = Shiftorium.UpgradeInstalled("al_shutdown"); + + //Alignments and positions. + lbalstatus.TextAlign = LoadedSkin.ALStatusPanelAlignment; + if (LoadedSkin.ShutdownButtonStyle == 2) + btnshutdown.Hide(); + else if (LoadedSkin.ShutdownButtonStyle == 1) + { + btnshutdown.Parent = pnlstatus; + btnshutdown.BringToFront(); + } + else + btnshutdown.Parent = pnlalsystemactions; + if (LoadedSkin.ShutdownOnLeft) + { + btnshutdown.Location = LoadedSkin.ShutdownButtonFromSide; + } + else + { + btnshutdown.Left = (btnshutdown.Parent.Width - btnshutdown.Width) - LoadedSkin.ShutdownButtonFromSide.X; + btnshutdown.Top = LoadedSkin.ShutdownButtonFromSide.Y; + } + + //Images + lbalstatus.BackgroundImage = GetImage("al_bg_status"); + lbalstatus.BackgroundImageLayout = GetImageLayout("al_bg_status"); + + pnlalsystemactions.BackgroundImage = GetImage("al_bg_system"); + pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system"); + if (pnlalsystemactions.BackgroundImage != null) + btnshutdown.BackColor = Color.Transparent; } @@ -563,6 +559,7 @@ namespace ShiftOS.WinForms if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; @@ -600,7 +597,25 @@ namespace ShiftOS.WinForms TerminalBackend.InvokeCommand("sos.shutdown"); }; apps.DropDownItems.Add(item); - + if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) + { + if (LoadedSkin.ShutdownButtonStyle == 2) { + var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; + catbtn.FlatStyle = FlatStyle.Flat; + catbtn.FlatAppearance.BorderSize = 0; + catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; + catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; + catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.Text = "Shutdown"; + catbtn.Width = flcategories.Width; + catbtn.Height = 24; + flcategories.Controls.Add(catbtn); + catbtn.Show(); + catbtn.Click += (o, a) => TerminalBackend.InvokeCommand("sos.shutdown"); + } + } } } } @@ -614,6 +629,7 @@ namespace ShiftOS.WinForms foreach(var app in LauncherItemList[cat]) { var catbtn = new Button(); + catbtn.Font = LoadedSkin.AdvALItemFont; catbtn.FlatStyle = FlatStyle.Flat; catbtn.FlatAppearance.BorderSize = 0; catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; @@ -622,8 +638,8 @@ namespace ShiftOS.WinForms catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); catbtn.Width = flapps.Width; + catbtn.ImageAlign = ContentAlignment.MiddleRight; catbtn.Height = 24; - catbtn.ImageAlign = ContentAlignment.MiddleLeft; catbtn.Image = (app.LaunchType == null) ? null : SkinEngine.GetIcon(app.LaunchType.Name); flapps.Controls.Add(catbtn); @@ -830,6 +846,14 @@ namespace ShiftOS.WinForms { TerminalBackend.InvokeCommand("sos.shutdown"); } + + public void HideAppLauncher() + { + this.Invoke(new Action(() => + { + pnladvancedal.Hide(); + })); + } } [ShiftOS.Engine.Scripting.Exposed("desktop")] diff --git a/ShiftOS_TheReturn/Desktop.cs b/ShiftOS_TheReturn/Desktop.cs index 19be5f4..b72f0cc 100644 --- a/ShiftOS_TheReturn/Desktop.cs +++ b/ShiftOS_TheReturn/Desktop.cs @@ -76,6 +76,9 @@ namespace ShiftOS.Engine string DesktopName { get; } void SetupDesktop(); + + void HideAppLauncher(); + void PopulateAppLauncher(LauncherItem[] items); void ShowWindow(IWindowBorder border); void KillWindow(IWindowBorder border); @@ -161,6 +164,11 @@ namespace ShiftOS.Engine { _desktop.OpenAppLauncher(loc); } + + public static void HideAppLauncher() + { + _desktop.HideAppLauncher(); + } } // sorry i almost killed everything :P } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index 48b7c0b..cee18d8 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -35,7 +35,8 @@ using static ShiftOS.Engine.SaveSystem; using ShiftOS.Objects.ShiftFS; using System.Reflection; using ShiftOS.Engine.Scripting; -namespace ShiftOS.Engine { +namespace ShiftOS.Engine +{ [Exposed("skinning")] public class SkinFunctions @@ -43,7 +44,7 @@ namespace ShiftOS.Engine { public void loadSkin() { SkinEngine.LoadSkin(); - } + } public dynamic getSkin() { @@ -63,7 +64,8 @@ namespace ShiftOS.Engine { } - public static class SkinEngine { + public static class SkinEngine + { public static ImageLayout GetImageLayout(string img) { if (LoadedSkin.SkinImageLayouts.ContainsKey(img)) @@ -77,14 +79,19 @@ namespace ShiftOS.Engine { } } - public static System.Drawing.Image GetImage(string img) { + public static System.Drawing.Image GetImage(string img) + { var type = typeof(Skin); - foreach (var field in type.GetFields()) { - foreach (var attr in field.GetCustomAttributes(false)) { - if (attr is ImageAttribute) { + foreach (var field in type.GetFields()) + { + foreach (var attr in field.GetCustomAttributes(false)) + { + if (attr is ImageAttribute) + { var iattr = attr as ImageAttribute; - if (iattr.Name == img) { + if (iattr.Name == img) + { byte[] image = (byte[])field.GetValue(LoadedSkin); return ImageFromBinary(image); } @@ -100,7 +107,8 @@ namespace ShiftOS.Engine { _iconProber = prober; } - public static Image ImageFromBinary(byte[] image) { + public static Image ImageFromBinary(byte[] image) + { if (image == null) return null; Image img = (Bitmap)((new ImageConverter()).ConvertFrom(image)); @@ -121,32 +129,40 @@ namespace ShiftOS.Engine { } } - public static void Init() { - Application.ApplicationExit += (o, a) => { + public static void Init() + { + Application.ApplicationExit += (o, a) => + { SaveSkin(); }; - if (!Utils.FileExists(Paths.GetPath("skin.json"))) { + if (!Utils.FileExists(Paths.GetPath("skin.json"))) + { LoadedSkin = new ShiftOS.Engine.Skin(); SaveSkin(); - } else { + } + else + { LoadSkin(); } - if (SaveSystem.CurrentSave != null) { + if (SaveSystem.CurrentSave != null) + { SkinLoaded?.Invoke(); } } public static event EmptyEventHandler SkinLoaded; - public static void LoadSkin() { + public static void LoadSkin() + { LoadedSkin = JsonConvert.DeserializeObject(Utils.ReadAllText(Paths.GetPath("skin.json"))); SkinLoaded?.Invoke(); Desktop.ResetPanelButtons(); Desktop.PopulateAppLauncher(); } - public static void SaveSkin() { + public static void SaveSkin() + { Utils.WriteAllText(Paths.GetPath("skin.json"), JsonConvert.SerializeObject(LoadedSkin, Formatting.Indented)); } @@ -160,20 +176,20 @@ namespace ShiftOS.Engine { } else { - foreach(var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) + foreach (var f in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) { - if(f.EndsWith(".exe") || f.EndsWith(".dll")) + if (f.EndsWith(".exe") || f.EndsWith(".dll")) { try { var asm = Assembly.LoadFile(f); - foreach(var type in asm.GetTypes()) + foreach (var type in asm.GetTypes()) { - if(type.Name == id) + if (type.Name == id) { - foreach(var attr in type.GetCustomAttributes(true)) + foreach (var attr in type.GetCustomAttributes(true)) { - if(attr is DefaultIconAttribute) + if (attr is DefaultIconAttribute) { return _iconProber.GetIcon(attr as DefaultIconAttribute); } @@ -202,7 +218,7 @@ namespace ShiftOS.Engine { return Image.FromStream(sr); } } - + } } @@ -221,7 +237,8 @@ namespace ShiftOS.Engine { public string ID { get; private set; } } - public class Skin { + 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 DefaultForeground = Color.FromArgb(0xDD, 0xDD, 0xDD); @@ -278,8 +295,8 @@ namespace ShiftOS.Engine { [ShifterName("System Font")] [ShifterDescription("The font style used by the system.")] public Font MainFont = SysFont; - - [ShifterEnumMask(new[] { "Right", "Left"})] + + [ShifterEnumMask(new[] { "Right", "Left" })] [ShifterMeta("Windows")] [ShifterCategory("Title Buttons")] [ShifterName("Title button position")] @@ -1068,25 +1085,126 @@ namespace ShiftOS.Engine { [ShifterName("App icon from side")] [ShifterDescription("How far from the side should the icon be?")] [RequiresUpgrade("shift_titlebar;app_icons")] - public Point TitlebarIconFromSide = new Point(4,4); + public Point TitlebarIconFromSide = new Point(4, 4); + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Status Panel Font")] + [ShifterDescription("The font used by the status panel in the Advanced App Launcher.")] + public Font ALStatusPanelFont = SysFont; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Status Panel Text Color")] + [ShifterDescription("The text color for the AL status panel.")] + public Color ALStatusPanelTextColor = Skin.DefaultForeground; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Status Panel Background")] + [ShifterDescription("The status panel's background color.")] + public Color ALStatusPanelBackColor = TitleBG; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Status Panel Text Alignment")] + [ShifterDescription("What part of the panel should the status text stick to?")] + public ContentAlignment ALStatusPanelAlignment = ContentAlignment.MiddleCenter; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("skinning;shift_advanced_app_launcher")] + [ShifterName("Status Panel Background Image")] + [ShifterDescription("Use an image for the App Launcher Status Panel")] + [Image("al_bg_status")] + public byte[] ALStatusPanelBG = null; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterEnumMask(new[] { "Button, bottom panel", "Button, top panel", "Category Item" })] + [ShifterName("Shutdown Button position")] + [ShifterDescription("Change the position and layout of the App Launcher Shutdown button.")] + public int ShutdownButtonStyle = 0; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Shutdown Button from side")] + [ShifterDescription("The location relative to the side of the system panel that the shutdown button should reside from.")] + public Point ShutdownButtonFromSide = new Point(2, 2); + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Align shutdown button to left?")] + [ShifterDescription("Should the location of the shutdown button be calculated relative to the left of the system panel?")] + public bool ShutdownOnLeft = false; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Shutdown Button Font")] + [ShifterDescription("The font of the Shutdown Button")] + public Font ShutdownFont = SysFont; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("Shutdown Text Color")] + [ShifterDescription("The foreground color of the Shutdown button")] + public Color ShutdownForeColor = DefaultForeground; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("System Panel background color")] + [ShifterDescription("The background color of the App Launcher System Panel.")] + public Color SystemPanelBackground = TitleBG; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("skinning;shift_advanced_app_launcher")] + [ShifterName("System Panel Background Image")] + [ShifterDescription("The background image of the System Panel.")] + [Image("al_bg_system")] + public byte[] SystemPanelBG = null; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("App Launcher Item Font")] + [ShifterDescription("Select the font to use for the items in the App Launcher.")] + public Font AdvALItemFont = SysFont2; } - public class ShifterHiddenAttribute : Attribute { + public class ShifterHiddenAttribute : Attribute + { } - public class ShifterFlagAttribute : Attribute { - public ShifterFlagAttribute(string flag, bool expected) { + public class ShifterFlagAttribute : Attribute + { + public ShifterFlagAttribute(string flag, bool expected) + { Expected = expected; Flag = flag; } public bool Expected { get; set; } public string Flag { get; set; } - public bool IsTrue(Skin skn) { - foreach (var f in skn.GetType().GetFields()) { - if (f.Name == Flag) { - if (f.FieldType == typeof(bool)) { + public bool IsTrue(Skin skn) + { + foreach (var f in skn.GetType().GetFields()) + { + if (f.Name == Flag) + { + if (f.FieldType == typeof(bool)) + { return (bool)f.GetValue(skn) == Expected; } } @@ -1095,12 +1213,14 @@ namespace ShiftOS.Engine { } } - public class ImageAttribute : Attribute { + public class ImageAttribute : Attribute + { /// /// Attribute a byte array within the Skin object with this attribute and the engine and Shifter will see it as an image and you'll be able to grab the image by calling SkinEngine.GetImage() passing the name you input here. /// /// The name you want to reference this image as in the code. - public ImageAttribute(string name) { + public ImageAttribute(string name) + { Name = name; } @@ -1108,8 +1228,10 @@ namespace ShiftOS.Engine { } - public class ShifterEnumMaskAttribute : Attribute { - public ShifterEnumMaskAttribute(string[] items) { + public class ShifterEnumMaskAttribute : Attribute + { + public ShifterEnumMaskAttribute(string[] items) + { Items = items; } @@ -1118,37 +1240,45 @@ namespace ShiftOS.Engine { - public class ShifterNameAttribute : Attribute { - public ShifterNameAttribute(string name) { + public class ShifterNameAttribute : Attribute + { + public ShifterNameAttribute(string name) + { Name = name; } public string Name { get; set; } } - public class ShifterDescriptionAttribute : Attribute { - public ShifterDescriptionAttribute(string description) { + public class ShifterDescriptionAttribute : Attribute + { + public ShifterDescriptionAttribute(string description) + { Description = description; } public string Description { get; set; } } - public class ShifterCategoryAttribute : Attribute { + public class ShifterCategoryAttribute : Attribute + { - public ShifterCategoryAttribute(string category) { + public ShifterCategoryAttribute(string category) + { Category = category; } public string Category { get; set; } } - public class ShifterMetaAttribute : Attribute { + public class ShifterMetaAttribute : Attribute + { - public ShifterMetaAttribute(string meta) { + public ShifterMetaAttribute(string meta) + { Meta = meta; } public string Meta { get; set; } } -} +} \ No newline at end of file -- cgit v1.2.3 From 1db8c4a00d102c5a184f9e4da29e3051a67a756b Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 15 Apr 2017 20:25:05 -0400 Subject: Hide AL when desktop items are clicked --- ShiftOS.WinForms/WinformsDesktop.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index d50be53..cd74a6b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -58,6 +58,11 @@ namespace ShiftOS.WinForms public WinformsDesktop() { InitializeComponent(); + this.Click += (o, a) => + { + HideAppLauncher(); + }; + SetupControl(desktoppanel); Shiftorium.Installed += () => { //Only if the DevX Legions story hasn't been experienced yet. @@ -284,6 +289,7 @@ namespace ShiftOS.WinForms form.BringToFront(); focused = form; } + HideAppLauncher(); }; var pnlbtn = new Panel(); @@ -826,6 +832,13 @@ namespace ShiftOS.WinForms { } + public void SetupControl(Control ctrl) + { + foreach (Control c in ctrl.Controls) + SetupControl(c); + ctrl.Click += (o, a) => HideAppLauncher(); + } + private void apps_Click(object sender, EventArgs e) { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) -- cgit v1.2.3 From 538f99faf7b381717079ea700d4f2e6e908537ea Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Apr 2017 13:31:23 -0400 Subject: Begin work on Desktop Widgets --- ShiftOS.WinForms/DesktopWidgetAttribute.cs | 21 ++++ ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs | 63 ++++++++++++ ShiftOS.WinForms/DesktopWidgets/Clock.cs | 45 ++++++++ ShiftOS.WinForms/DesktopWidgets/Clock.resx | 120 ++++++++++++++++++++++ ShiftOS.WinForms/IDesktopWidget.cs | 51 +++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 11 ++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 12 +++ ShiftOS.WinForms/WidgetManager.cs | 50 +++++++++ ShiftOS.WinForms/WinformsDesktop.Designer.cs | 48 +++++---- ShiftOS.WinForms/WinformsDesktop.cs | 42 ++++++++ 10 files changed, 445 insertions(+), 18 deletions(-) create mode 100644 ShiftOS.WinForms/DesktopWidgetAttribute.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/Clock.resx create mode 100644 ShiftOS.WinForms/IDesktopWidget.cs create mode 100644 ShiftOS.WinForms/WidgetManager.cs (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/DesktopWidgetAttribute.cs b/ShiftOS.WinForms/DesktopWidgetAttribute.cs new file mode 100644 index 0000000..28d50ac --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgetAttribute.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ShiftOS.WinForms +{ + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] + public class DesktopWidgetAttribute : Attribute + { + public string Name { get; set; } + public string Description { get; set; } + + public DesktopWidgetAttribute(string n, string desc) + { + Name = n; + Description = desc; + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs new file mode 100644 index 0000000..a36d386 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.Designer.cs @@ -0,0 +1,63 @@ +namespace ShiftOS.WinForms.DesktopWidgets +{ + partial class Clock + { + /// + /// 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.lbtime = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbtime + // + this.lbtime.BackColor = System.Drawing.Color.Transparent; + this.lbtime.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbtime.Location = new System.Drawing.Point(0, 0); + this.lbtime.Name = "lbtime"; + this.lbtime.Size = new System.Drawing.Size(210, 49); + this.lbtime.TabIndex = 0; + this.lbtime.Tag = "header2 keepbg"; + this.lbtime.Text = "label1"; + this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Clock + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.lbtime); + this.Name = "Clock"; + this.Size = new System.Drawing.Size(210, 49); + this.Tag = "keepbg"; + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lbtime; + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.cs b/ShiftOS.WinForms/DesktopWidgets/Clock.cs new file mode 100644 index 0000000..aa29e2e --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.cs @@ -0,0 +1,45 @@ +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.DesktopWidgets +{ + [DesktopWidget("Clock", "Show a clock on the desktop.")] + [RequiresUpgrade("desktop_clock_widget")] + public partial class Clock : UserControl, IDesktopWidget + { + public Clock() + { + InitializeComponent(); + tmr = new Timer(); + tmr.Tick += (o, a) => + { + lbtime.Text = Applications.Terminal.GetTime(); + }; + tmr.Interval = 100; + } + + Timer tmr = new Timer(); + + public void OnSkinLoad() + { + Tools.ControlManager.SetupControls(this); + } + + public void OnUpgrade() + { + } + + public void Setup() + { + tmr.Start(); + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/Clock.resx b/ShiftOS.WinForms/DesktopWidgets/Clock.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/Clock.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/IDesktopWidget.cs b/ShiftOS.WinForms/IDesktopWidget.cs new file mode 100644 index 0000000..95c373c --- /dev/null +++ b/ShiftOS.WinForms/IDesktopWidget.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + /// + /// Provides base functionality for a ShiftOS desktop widget. + /// + public interface IDesktopWidget + { + /// + /// Performs routine setup operations to keep the widget up to date. + /// + void Setup(); + + /// + /// Occurs when a skin is loaded. + /// + void OnSkinLoad(); + + /// + /// Occurs when a Shiftorium upgrade is installed. + /// + void OnUpgrade(); + + /// + /// Hides this desktop widget. + /// + void Hide(); + + /// + /// Shows this desktop widget. + /// + void Show(); + + /// + /// Gets or sets the location on the desktop that this widget resides. + /// + Point Location { get; set; } + + /// + /// Gets or sets this widget's size. + /// + Size Size { get; set; } + } +} diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 82ee613..c18f456 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -1,4 +1,15 @@ [ + //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", diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9675bb6..a223f47 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -257,6 +257,13 @@ Component + + + UserControl + + + Clock.cs + UserControl @@ -271,6 +278,7 @@ + Form @@ -294,6 +302,7 @@ + UserControl @@ -399,6 +408,9 @@ UpdateManager.cs + + Clock.cs + DownloadControl.cs diff --git a/ShiftOS.WinForms/WidgetManager.cs b/ShiftOS.WinForms/WidgetManager.cs new file mode 100644 index 0000000..125c804 --- /dev/null +++ b/ShiftOS.WinForms/WidgetManager.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms +{ + public static class WidgetManager + { + public static Dictionary GetAllWidgetTypes() + { + Dictionary types = new Dictionary(); + foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + { + if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) + { + try + { + var asm = Assembly.LoadFile(exe); + foreach(var type in asm.GetTypes()) + { + if (type.GetInterfaces().Contains(typeof(IDesktopWidget))) + { + if (Shiftorium.UpgradeAttributesUnlocked(type)) + { + foreach (var attrib in type.GetCustomAttributes(false)) + { + if (attrib is DesktopWidgetAttribute) + { + var dw = attrib as DesktopWidgetAttribute; + types.Add(dw, type); + } + } + } + } + } + } + catch { } + } + } + return types; + } + + + } +} diff --git a/ShiftOS.WinForms/WinformsDesktop.Designer.cs b/ShiftOS.WinForms/WinformsDesktop.Designer.cs index 3d24c3d..71ef161 100644 --- a/ShiftOS.WinForms/WinformsDesktop.Designer.cs +++ b/ShiftOS.WinForms/WinformsDesktop.Designer.cs @@ -60,14 +60,15 @@ namespace ShiftOS.WinForms 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.pnladvancedal = new System.Windows.Forms.Panel(); + this.flapps = new System.Windows.Forms.FlowLayoutPanel(); + this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); this.pnlalsystemactions = new System.Windows.Forms.Panel(); this.btnshutdown = new System.Windows.Forms.Button(); this.pnlstatus = new System.Windows.Forms.Panel(); this.lbalstatus = new System.Windows.Forms.Label(); - this.flcategories = new System.Windows.Forms.FlowLayoutPanel(); - this.flapps = new System.Windows.Forms.FlowLayoutPanel(); this.desktoppanel.SuspendLayout(); this.sysmenuholder.SuspendLayout(); this.menuStrip1.SuspendLayout(); @@ -169,6 +170,15 @@ namespace ShiftOS.WinForms this.pnlscreensaver.TabIndex = 1; this.pnlscreensaver.Visible = false; // + // pnlwidgetlayer + // + this.pnlwidgetlayer.BackColor = System.Drawing.Color.Transparent; + this.pnlwidgetlayer.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlwidgetlayer.Location = new System.Drawing.Point(0, 24); + this.pnlwidgetlayer.Name = "pnlwidgetlayer"; + this.pnlwidgetlayer.Size = new System.Drawing.Size(1296, 714); + this.pnlwidgetlayer.TabIndex = 1; + // // pnlssicon // this.pnlssicon.Location = new System.Drawing.Point(303, 495); @@ -188,6 +198,22 @@ namespace ShiftOS.WinForms this.pnladvancedal.TabIndex = 1; this.pnladvancedal.Visible = false; // + // flapps + // + this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; + this.flapps.Location = new System.Drawing.Point(221, 58); + this.flapps.Name = "flapps"; + this.flapps.Size = new System.Drawing.Size(212, 328); + this.flapps.TabIndex = 3; + // + // flcategories + // + this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; + this.flcategories.Location = new System.Drawing.Point(0, 58); + this.flcategories.Name = "flcategories"; + this.flcategories.Size = new System.Drawing.Size(221, 328); + this.flcategories.TabIndex = 2; + // // pnlalsystemactions // this.pnlalsystemactions.Controls.Add(this.btnshutdown); @@ -230,28 +256,13 @@ namespace ShiftOS.WinForms this.lbalstatus.Text = "michael@system\r\n0 Codepoints\r\n0 installed, 0 available"; this.lbalstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // - // flcategories - // - this.flcategories.Dock = System.Windows.Forms.DockStyle.Left; - this.flcategories.Location = new System.Drawing.Point(0, 58); - this.flcategories.Name = "flcategories"; - this.flcategories.Size = new System.Drawing.Size(221, 328); - this.flcategories.TabIndex = 2; - // - // flapps - // - this.flapps.Dock = System.Windows.Forms.DockStyle.Fill; - this.flapps.Location = new System.Drawing.Point(221, 58); - this.flapps.Name = "flapps"; - this.flapps.Size = new System.Drawing.Size(212, 328); - this.flapps.TabIndex = 3; - // // WinformsDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 14F); 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.pnlwidgetlayer); this.Controls.Add(this.pnladvancedal); this.Controls.Add(this.pnlscreensaver); this.Controls.Add(this.desktoppanel); @@ -294,6 +305,7 @@ namespace ShiftOS.WinForms private System.Windows.Forms.Label lbalstatus; private System.Windows.Forms.FlowLayoutPanel flapps; private System.Windows.Forms.FlowLayoutPanel flcategories; + private System.Windows.Forms.Panel pnlwidgetlayer; } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index cd74a6b..3050cdf 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -49,6 +49,9 @@ namespace ShiftOS.WinForms /// public partial class WinformsDesktop : Form, IDesktop { + public List Widgets = new List(); + + private bool InScreensaver = false; private int millisecondsUntilScreensaver = 300000; @@ -65,6 +68,11 @@ namespace ShiftOS.WinForms SetupControl(desktoppanel); Shiftorium.Installed += () => { + foreach(var widget in Widgets) + { + widget.OnUpgrade(); + } + //Only if the DevX Legions story hasn't been experienced yet. if (!Shiftorium.UpgradeInstalled("devx_legions")) { @@ -161,6 +169,11 @@ namespace ShiftOS.WinForms }; SkinEngine.SkinLoaded += () => { + foreach (var widget in Widgets) + { + widget.OnSkinLoad(); + } + SetupDesktop(); }; time.Tick += (o, a) => @@ -429,6 +442,34 @@ namespace ShiftOS.WinForms desktoppanel.Dock = DockStyle.Top; } } + + pnlwidgetlayer.Show(); + pnlwidgetlayer.BringToFront(); + + if (Shiftorium.UpgradeInstalled("desktop_widgets")) + { + Widgets.Clear(); + foreach(var widget in WidgetManager.GetAllWidgetTypes()) + { + UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); + pnlwidgetlayer.Controls.Add(w); + Widgets.Add(w as IDesktopWidget); + } + } + + foreach (var widget in Widgets) + { + if (Shiftorium.UpgradeInstalled("desktop_widgets")) + { + widget.Setup(); + widget.Show(); + } + else + { + widget.Hide(); + } + } + } else { @@ -851,6 +892,7 @@ namespace ShiftOS.WinForms apps.DropDown.Hide(); pnladvancedal.Location = new Point(0, (LoadedSkin.DesktopPanelPosition == 0) ? desktoppanel.Height : this.Height - pnladvancedal.Height - desktoppanel.Height); pnladvancedal.Visible = !pnladvancedal.Visible; + pnladvancedal.BringToFront(); } } -- cgit v1.2.3 From 5cb49f332856ac312e8840ec04c7869b892d4dd4 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 16 Apr 2017 14:18:02 -0400 Subject: Store widget locations in file --- ShiftOS.WinForms/DesktopWidgetAttribute.cs | 5 ++++ ShiftOS.WinForms/WidgetManager.cs | 45 ++++++++++++++++++++++++++++- ShiftOS.WinForms/WinformsDesktop.cs | 46 ++++++++++++++++++++++++++++++ ShiftOS_TheReturn/Paths.cs | 1 + 4 files changed, 96 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/DesktopWidgetAttribute.cs b/ShiftOS.WinForms/DesktopWidgetAttribute.cs index 28d50ac..8d3706f 100644 --- a/ShiftOS.WinForms/DesktopWidgetAttribute.cs +++ b/ShiftOS.WinForms/DesktopWidgetAttribute.cs @@ -17,5 +17,10 @@ namespace ShiftOS.WinForms Name = n; Description = desc; } + + public override string ToString() + { + return this.Name + "_" + Description; + } } } diff --git a/ShiftOS.WinForms/WidgetManager.cs b/ShiftOS.WinForms/WidgetManager.cs index 125c804..15e2076 100644 --- a/ShiftOS.WinForms/WidgetManager.cs +++ b/ShiftOS.WinForms/WidgetManager.cs @@ -1,11 +1,14 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Text; using System.Threading.Tasks; +using Newtonsoft.Json; using ShiftOS.Engine; +using ShiftOS.Objects.ShiftFS; namespace ShiftOS.WinForms { @@ -14,7 +17,7 @@ namespace ShiftOS.WinForms public static Dictionary GetAllWidgetTypes() { Dictionary types = new Dictionary(); - foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + foreach(var exe in System.IO.Directory.GetFiles(Environment.CurrentDirectory)) { if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) { @@ -45,6 +48,46 @@ namespace ShiftOS.WinForms return types; } + internal static void SaveLocation(Type type, Point location) + { + var dict = new Dictionary(); + var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is DesktopWidgetAttribute) as DesktopWidgetAttribute; + try + { + dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); + dict[attrib.ToString()] = location; + } + catch + { + dict.Add(attrib.ToString(), location); + } + finally + { + Utils.WriteAllText(Paths.GetPath("widgets.dat"), JsonConvert.SerializeObject(dict)); + } + + } + + internal static Point LoadLocation(Type type) + { + var dict = new Dictionary(); + var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is DesktopWidgetAttribute) as DesktopWidgetAttribute; + try + { + dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); + + return dict[attrib.ToString()]; + + } + catch + { + return new Point(-1, -1); + } + finally + { + } + + } } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 3050cdf..ee0f34d 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -452,7 +452,11 @@ namespace ShiftOS.WinForms foreach(var widget in WidgetManager.GetAllWidgetTypes()) { UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); + + w.Location = WidgetManager.LoadLocation(w.GetType()); + pnlwidgetlayer.Controls.Add(w); + MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); } } @@ -481,6 +485,48 @@ namespace ShiftOS.WinForms PopulatePanelButtons(); } + public void MakeWidgetMovable(Control w, Control startCtrl = null) + { + if (startCtrl == null) + startCtrl = w; + + bool moving = false; + + w.MouseDown += (o, a) => + { + moving = true; + }; + + w.MouseMove += (o, a) => + { + if (moving == true) + { + var mPos = Cursor.Position; + int mY = mPos.Y - desktoppanel.Height; + int mX = mPos.X; + + int ctrlHeight = startCtrl.Height / 2; + int ctrlWidth = startCtrl.Width / 2; + + startCtrl.Location = new Point( + mX - ctrlWidth, + mY - ctrlHeight + ); + + } + }; + + w.MouseUp += (o, a) => + { + moving = false; + WidgetManager.SaveLocation(startCtrl.GetType(), w.Location); + }; + + foreach (Control c in w.Controls) + MakeWidgetMovable(c, startCtrl); + + } + public ToolStripMenuItem GetALCategoryWithName(string text) { foreach (ToolStripMenuItem menuitem in apps.DropDownItems) diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index 4f535d6..2fc55fd 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -61,6 +61,7 @@ namespace ShiftOS.Engine AddPath("data", "user.dat"); AddPath("data", "notifications.dat"); AddPath("data", "skin"); + AddPath("skin", "widgets.dat"); AddPath("system", "programs"); AddPath("system", "kernel.sft"); AddPath("system", "conf.sft"); -- cgit v1.2.3 From 10b04ab0c859269f19a5d2fedd859401a525b957 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Apr 2017 09:59:23 -0400 Subject: Fix bug with AAL text colors --- ShiftOS.WinForms/WinformsDesktop.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index ee0f34d..0cbf56a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -449,13 +449,14 @@ namespace ShiftOS.WinForms if (Shiftorium.UpgradeInstalled("desktop_widgets")) { Widgets.Clear(); + pnlwidgetlayer.Controls.Clear(); foreach(var widget in WidgetManager.GetAllWidgetTypes()) { UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); w.Location = WidgetManager.LoadLocation(w.GetType()); - pnlwidgetlayer.Controls.Add(w); + //pnlwidgetlayer.Controls.Add(w); MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); } @@ -559,6 +560,7 @@ namespace ShiftOS.WinForms lbalstatus.BackColor = LoadedSkin.ALStatusPanelBackColor; //Fonts lbalstatus.Font = LoadedSkin.ALStatusPanelFont; + lbalstatus.ForeColor = LoadedSkin.ALStatusPanelTextColor; btnshutdown.Font = LoadedSkin.ShutdownFont; //Upgrades @@ -593,6 +595,9 @@ namespace ShiftOS.WinForms pnlalsystemactions.BackgroundImageLayout = GetImageLayout("al_bg_system"); if (pnlalsystemactions.BackgroundImage != null) btnshutdown.BackColor = Color.Transparent; + + btnshutdown.Font = LoadedSkin.ShutdownFont; + btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor; } -- cgit v1.2.3 From e2de1b7083c4e064b7f195b0d49c93019aa34e39 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 17 Apr 2017 10:01:36 -0400 Subject: fix fore color of AL items --- ShiftOS.WinForms/WinformsDesktop.cs | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 0cbf56a..c1ec823 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -664,6 +664,15 @@ namespace ShiftOS.WinForms catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; catbtn.TextAlign = ContentAlignment.MiddleLeft; + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + catbtn.MouseEnter += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; + }; + catbtn.MouseLeave += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + }; catbtn.Text = kv.Key; catbtn.Width = flcategories.Width; catbtn.Height = 24; @@ -705,6 +714,16 @@ namespace ShiftOS.WinForms catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + catbtn.MouseEnter += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; + }; + catbtn.MouseLeave += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + }; + catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = "Shutdown"; catbtn.Width = flcategories.Width; @@ -733,6 +752,15 @@ namespace ShiftOS.WinForms catbtn.FlatAppearance.MouseOverBackColor = LoadedSkin.Menu_MenuItemSelected; catbtn.FlatAppearance.MouseDownBackColor = LoadedSkin.Menu_MenuItemPressedGradientBegin; catbtn.BackColor = LoadedSkin.Menu_ToolStripDropDownBackground; + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + catbtn.MouseEnter += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_SelectedTextColor; + }; + catbtn.MouseLeave += (o, a) => + { + catbtn.ForeColor = LoadedSkin.Menu_TextColor; + }; catbtn.TextAlign = ContentAlignment.MiddleLeft; catbtn.Text = (app is LuaLauncherItem) ? app.DisplayData.Name : NameChangerBackend.GetNameRaw(app.LaunchType); catbtn.Width = flapps.Width; -- cgit v1.2.3 From b4dc527526057deb6205e564db69e50e4ed52df2 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 19 Apr 2017 09:43:08 -0400 Subject: reenable desktop widgets --- ShiftOS.WinForms/WinformsDesktop.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index c1ec823..09703db 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -456,7 +456,7 @@ namespace ShiftOS.WinForms w.Location = WidgetManager.LoadLocation(w.GetType()); - //pnlwidgetlayer.Controls.Add(w); + pnlwidgetlayer.Controls.Add(w); MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); } -- cgit v1.2.3 From 114141b56e02857fa749cc130f16a2d6cc4c35f5 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Apr 2017 08:54:38 -0400 Subject: Add FS delete functions --- .../Applications/FileSkimmer.Designer.cs | 1 + ShiftOS.WinForms/Applications/FileSkimmer.cs | 21 +++++++++- ShiftOS.WinForms/Resources/Shiftorium.txt | 14 +++++++ ShiftOS.WinForms/WinformsDesktop.cs | 10 ++++- ShiftOS_TheReturn/Paths.cs | 46 +++++++++++++++------- 5 files changed, 74 insertions(+), 18 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs index c917840..dd19108 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs @@ -122,6 +122,7 @@ namespace ShiftOS.WinForms.Applications this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; this.deleteToolStripMenuItem.Size = new System.Drawing.Size(52, 20); this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); // // connectToRemoteServerToolStripMenuItem // diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs index 4b11d24..3b4b2e7 100644 --- a/ShiftOS.WinForms/Applications/FileSkimmer.cs +++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs @@ -261,7 +261,7 @@ namespace ShiftOS.WinForms.Applications { moveToolStripMenuItem.Visible = false; copyToolStripMenuItem.Visible = false; - + deleteToolStripMenuItem.Visible = false; } private void newFolderToolStripMenuItem_Click(object sender, EventArgs e) @@ -298,11 +298,13 @@ namespace ShiftOS.WinForms.Applications { if (DirectoryExists(currentdir + "/" + itm.Tag.ToString())) { + deleteToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_recursive_delete"); moveToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_move_folder"); copyToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_copy_folder"); } else if (FileExists(currentdir + "/" + itm.Tag.ToString())) { + deleteToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_delete"); moveToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_move"); copyToolStripMenuItem.Visible = Shiftorium.UpgradeInstalled("fs_copy"); } @@ -322,6 +324,7 @@ namespace ShiftOS.WinForms.Applications { moveToolStripMenuItem.Visible = false; copyToolStripMenuItem.Visible = false; + deleteToolStripMenuItem.Visible = false; } } @@ -387,6 +390,22 @@ namespace ShiftOS.WinForms.Applications } } + + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + try + { + Infobox.PromptYesNo("Delete file", "Are you sure you want to delete " + lvitems.SelectedItems[0].Text + "?", (result) => + { + if (result == true) + { + Delete(currentdir + "/" + lvitems.SelectedItems[0].Tag.ToString()); + ResetList(); + } + }); + } + catch { } + } } diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 2cd9680..dadb022 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -270,6 +270,20 @@ Category: "Device Drivers", Dependencies: "color_depth_8_bits" }, + { + Name: "FS Delete", + Cost: 75, + Description: "Got some files that you want to get rid of? This upgrade adds a button to the File Skimmer for doing just that.", + Dependencies: "file_skimmer", + Category: "Enhancements", + }, + { + Name: "FS Recursive Delete", + Cost: 100, + Description: "Deleting files is great, but what if you have an entire folder you need to get rid of? This upgrade allows the deletion of folders and all files and folders inside them. Just, don't delete your system folder!", + Dependencies: "fs_delete", + Category: "Enhancements" + }, { Name: "Color Depth 24 Bits", Cost: 24000, diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 09703db..c458a4a 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -61,6 +61,7 @@ namespace ShiftOS.WinForms public WinformsDesktop() { InitializeComponent(); + ControlManager.MakeDoubleBuffered(pnlwidgetlayer); this.Click += (o, a) => { HideAppLauncher(); @@ -455,7 +456,7 @@ namespace ShiftOS.WinForms UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); w.Location = WidgetManager.LoadLocation(w.GetType()); - + w.Top -= desktoppanel.Height; pnlwidgetlayer.Controls.Add(w); MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); @@ -466,6 +467,8 @@ namespace ShiftOS.WinForms { if (Shiftorium.UpgradeInstalled("desktop_widgets")) { + widget.OnSkinLoad(); + widget.OnUpgrade(); widget.Setup(); widget.Show(); } @@ -474,6 +477,9 @@ namespace ShiftOS.WinForms widget.Hide(); } } + pnlwidgetlayer.Show(); + pnlwidgetlayer.BringToFront(); + } else @@ -520,7 +526,7 @@ namespace ShiftOS.WinForms w.MouseUp += (o, a) => { moving = false; - WidgetManager.SaveLocation(startCtrl.GetType(), w.Location); + WidgetManager.SaveLocation(startCtrl.GetType(), startCtrl.Location); }; foreach (Control c in w.Controls) diff --git a/ShiftOS_TheReturn/Paths.cs b/ShiftOS_TheReturn/Paths.cs index e756da7..a84271b 100644 --- a/ShiftOS_TheReturn/Paths.cs +++ b/ShiftOS_TheReturn/Paths.cs @@ -135,41 +135,57 @@ namespace ShiftOS.Engine //This event-based system allows us to sync the ramdisk from ShiftOS to the host OS. Utils.DirectoryCreated += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (!System.IO.Directory.Exists(real)) - System.IO.Directory.CreateDirectory(real); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (!System.IO.Directory.Exists(real)) + System.IO.Directory.CreateDirectory(real); + } } + catch { } }; Utils.DirectoryDeleted += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (System.IO.Directory.Exists(real)) - System.IO.Directory.Delete(real, true); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (System.IO.Directory.Exists(real)) + System.IO.Directory.Delete(real, true); + } } + catch { } }; Utils.FileWritten += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - System.IO.File.WriteAllBytes(real, ReadAllBytes(dir)); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + System.IO.File.WriteAllBytes(real, ReadAllBytes(dir)); + } } + catch { } }; Utils.FileDeleted += (dir) => { - if (dir.StartsWith("1:/")) + try { - string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); - if (System.IO.File.Exists(real)) - System.IO.File.Delete(real); + if (dir.StartsWith("1:/")) + { + string real = dir.Replace("/", "\\").Replace("1:", SharedFolder); + if (System.IO.File.Exists(real)) + System.IO.File.Delete(real); + } } + catch { } }; //This thread will sync the ramdisk from the host OS to ShiftOS. -- cgit v1.2.3 From e05fc88500525e8c9b9e497e91aa7b9d04996019 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Apr 2017 09:25:17 -0400 Subject: Add sizing of applauncher elements --- .../DesktopWidgets/UpgradePercentage.Designer.cs | 75 +++++++++++++ .../DesktopWidgets/UpgradePercentage.cs | 41 +++++++ .../DesktopWidgets/UpgradePercentage.resx | 120 +++++++++++++++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ ShiftOS.WinForms/WinformsDesktop.cs | 8 ++ ShiftOS_TheReturn/Skinning.cs | 36 +++++++ 6 files changed, 289 insertions(+) create mode 100644 ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.resx (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs new file mode 100644 index 0000000..ca0d587 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.Designer.cs @@ -0,0 +1,75 @@ +namespace ShiftOS.WinForms.DesktopWidgets +{ + partial class UpgradePercentage + { + /// + /// 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.pgupgrades = new ShiftOS.WinForms.Controls.ShiftedProgressBar(); + this.lbstatus = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // pgupgrades + // + this.pgupgrades.BlockSize = 5; + this.pgupgrades.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pgupgrades.Location = new System.Drawing.Point(0, 99); + this.pgupgrades.Maximum = 100; + this.pgupgrades.Name = "pgupgrades"; + this.pgupgrades.Size = new System.Drawing.Size(227, 23); + this.pgupgrades.Style = System.Windows.Forms.ProgressBarStyle.Continuous; + this.pgupgrades.TabIndex = 0; + this.pgupgrades.Text = "shiftedProgressBar1"; + this.pgupgrades.Value = 0; + // + // lbstatus + // + this.lbstatus.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbstatus.Location = new System.Drawing.Point(0, 0); + this.lbstatus.Name = "lbstatus"; + this.lbstatus.Size = new System.Drawing.Size(227, 99); + this.lbstatus.TabIndex = 1; + this.lbstatus.Text = "label1"; + this.lbstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // UpgradePercentage + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbstatus); + this.Controls.Add(this.pgupgrades); + this.Name = "UpgradePercentage"; + this.Size = new System.Drawing.Size(227, 122); + this.ResumeLayout(false); + + } + + #endregion + + private Controls.ShiftedProgressBar pgupgrades; + private System.Windows.Forms.Label lbstatus; + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.cs b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.cs new file mode 100644 index 0000000..e7dec94 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.cs @@ -0,0 +1,41 @@ +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.DesktopWidgets +{ + [DesktopWidget("Shiftorium Status", "Show how much upgrades you have and how much are available.")] + public partial class UpgradePercentage : UserControl, IDesktopWidget + { + public UpgradePercentage() + { + InitializeComponent(); + } + + public void OnSkinLoad() + { + ControlManager.SetupControl(lbstatus); + pgupgrades.Refresh(); + } + + public void OnUpgrade() + { + + pgupgrades.Maximum = Shiftorium.GetDefaults().Count; + pgupgrades.Value = SaveSystem.CurrentSave.CountUpgrades(); + lbstatus.Text = $"You have unlocked {pgupgrades.Value} upgrades out of the {pgupgrades.Maximum} available."; + } + + public void Setup() + { + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.resx b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/UpgradePercentage.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/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 9dc3593..915543f 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -264,6 +264,12 @@ Clock.cs + + UserControl + + + UpgradePercentage.cs + UserControl @@ -413,6 +419,9 @@ Clock.cs + + UpgradePercentage.cs + DownloadControl.cs diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index c458a4a..d15c04d 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -604,6 +604,14 @@ namespace ShiftOS.WinForms btnshutdown.Font = LoadedSkin.ShutdownFont; btnshutdown.ForeColor = LoadedSkin.ShutdownForeColor; + + pnladvancedal.Size = LoadedSkin.AALSize; + + pnlalsystemactions.Height = LoadedSkin.ALSystemActionHeight; + pnlstatus.Height = LoadedSkin.ALSystemStatusHeight; + + flcategories.Width = LoadedSkin.AALCategoryViewWidth; + this.flapps.Width = LoadedSkin.AALItemViewWidth; } diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index cee18d8..4cc9bbd 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -1115,6 +1115,42 @@ namespace ShiftOS.Engine [ShifterDescription("What part of the panel should the status text stick to?")] public ContentAlignment ALStatusPanelAlignment = ContentAlignment.MiddleCenter; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("AL System Status Height")] + [ShifterDescription("Set the height of the top system status bar in the App Launcher.")] + public int ALSystemStatusHeight = 50; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("AL Size")] + [ShifterDescription("Set the size of the App Launcher's container")] + public Size AALSize = new Size(425, 500); + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("AL Category View Width")] + [ShifterDescription("Set the width of the left Category Listing on the app launcher.")] + public int AALCategoryViewWidth = 237; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("AL Item List Width")] + [ShifterDescription("Set the width of the item list in the app launcher.")] + public int AALItemViewWidth = 237; + + [ShifterMeta("Desktop")] + [ShifterCategory("App Launcher")] + [RequiresUpgrade("shift_advanced_app_launcher")] + [ShifterName("AL System Actions Height")] + [ShifterDescription("Set the height of the bottom system actions bar in the App Launcher.")] + public int ALSystemActionHeight = 30; + [ShifterMeta("Desktop")] [ShifterCategory("App Launcher")] [RequiresUpgrade("skinning;shift_advanced_app_launcher")] -- cgit v1.2.3 From e63e1d65f7445988d9889a7b5a54b380ddb514e8 Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Apr 2017 12:44:26 -0400 Subject: Enable GIF loading --- ShiftOS.WinForms/Applications/GraphicPicker.cs | 2 +- ShiftOS.WinForms/WinformsDesktop.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index b3dd8bf..4f3f2bb 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -83,7 +83,7 @@ namespace ShiftOS.WinForms.Applications public void btnidlebrowse_Click(object s, EventArgs a) { - AppearanceManager.SetupDialog(new FileDialog(new[] { ".png", ".jpg", ".bmp", ".pic" }, FileOpenerStyle.Open, new Action((file) => + AppearanceManager.SetupDialog(new FileDialog(new[] { ".png", ".gif", ".jpg", ".bmp", ".pic" }, FileOpenerStyle.Open, new Action((file) => { ImageAsBinary = Utils.ReadAllBytes(file); System.IO.File.WriteAllBytes("temp_bin.bmp", ImageAsBinary); diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index d15c04d..61c371e 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -456,7 +456,6 @@ namespace ShiftOS.WinForms UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); w.Location = WidgetManager.LoadLocation(w.GetType()); - w.Top -= desktoppanel.Height; pnlwidgetlayer.Controls.Add(w); MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); -- cgit v1.2.3 From 40fc14a237f0bbe3e5237e5ce0806f46ecf0f56e Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 22 Apr 2017 17:10:15 -0400 Subject: Add Widget Manager UI You can now toggle visibility of widgets. --- .../Applications/WidgetManagerFrontend.Designer.cs | 164 +++++++++++++++++++++ .../Applications/WidgetManagerFrontend.cs | 131 ++++++++++++++++ .../Applications/WidgetManagerFrontend.resx | 120 +++++++++++++++ ShiftOS.WinForms/Resources/Shiftorium.txt | 7 + ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 ++ ShiftOS.WinForms/WidgetManager.cs | 35 ++++- ShiftOS.WinForms/WinformsDesktop.cs | 15 +- 7 files changed, 471 insertions(+), 10 deletions(-) create mode 100644 ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs create mode 100644 ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs create mode 100644 ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs new file mode 100644 index 0000000..9612b21 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs @@ -0,0 +1,164 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class WidgetManagerFrontend + { + /// + /// 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.flbody = new System.Windows.Forms.FlowLayoutPanel(); + this.label1 = new System.Windows.Forms.Label(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnclose = new System.Windows.Forms.Button(); + this.btnloaddefault = new System.Windows.Forms.Button(); + this.btnimport = new System.Windows.Forms.Button(); + this.btnexport = new System.Windows.Forms.Button(); + this.btnapply = new System.Windows.Forms.Button(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // flbody + // + this.flbody.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.flbody.Location = new System.Drawing.Point(22, 59); + this.flbody.Name = "flbody"; + this.flbody.Size = new System.Drawing.Size(463, 389); + this.flbody.TabIndex = 0; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(22, 14); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(89, 13); + this.label1.TabIndex = 1; + this.label1.Tag = "header1"; + this.label1.Text = "Desktop Widgets"; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.btnclose); + this.flowLayoutPanel1.Controls.Add(this.btnloaddefault); + this.flowLayoutPanel1.Controls.Add(this.btnimport); + this.flowLayoutPanel1.Controls.Add(this.btnexport); + this.flowLayoutPanel1.Controls.Add(this.btnapply); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 461); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(517, 29); + this.flowLayoutPanel1.TabIndex = 2; + // + // 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); + // + // btnloaddefault + // + this.btnloaddefault.AutoSize = true; + this.btnloaddefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnloaddefault.Location = new System.Drawing.Point(52, 3); + this.btnloaddefault.Name = "btnloaddefault"; + this.btnloaddefault.Size = new System.Drawing.Size(76, 23); + this.btnloaddefault.TabIndex = 1; + this.btnloaddefault.Text = "Load default"; + this.btnloaddefault.UseVisualStyleBackColor = true; + this.btnloaddefault.Click += new System.EventHandler(this.btnloaddefault_Click); + // + // btnimport + // + this.btnimport.AutoSize = true; + this.btnimport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnimport.Location = new System.Drawing.Point(134, 3); + this.btnimport.Name = "btnimport"; + this.btnimport.Size = new System.Drawing.Size(46, 23); + this.btnimport.TabIndex = 2; + this.btnimport.Text = "Import"; + this.btnimport.UseVisualStyleBackColor = true; + this.btnimport.Click += new System.EventHandler(this.btnimport_Click); + // + // btnexport + // + this.btnexport.AutoSize = true; + this.btnexport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnexport.Location = new System.Drawing.Point(186, 3); + this.btnexport.Name = "btnexport"; + this.btnexport.Size = new System.Drawing.Size(47, 23); + this.btnexport.TabIndex = 3; + this.btnexport.Text = "Export"; + this.btnexport.UseVisualStyleBackColor = true; + this.btnexport.Click += new System.EventHandler(this.btnexport_Click); + // + // btnapply + // + this.btnapply.AutoSize = true; + this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnapply.Location = new System.Drawing.Point(239, 3); + this.btnapply.Name = "btnapply"; + this.btnapply.Size = new System.Drawing.Size(43, 23); + this.btnapply.TabIndex = 4; + this.btnapply.Text = "Apply"; + this.btnapply.UseVisualStyleBackColor = true; + this.btnapply.Click += new System.EventHandler(this.btnapply_Click); + // + // WidgetManagerFrontend + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.flowLayoutPanel1); + this.Controls.Add(this.label1); + this.Controls.Add(this.flbody); + this.Name = "WidgetManagerFrontend"; + this.Size = new System.Drawing.Size(517, 490); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flbody; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnclose; + private System.Windows.Forms.Button btnloaddefault; + private System.Windows.Forms.Button btnimport; + private System.Windows.Forms.Button btnexport; + private System.Windows.Forms.Button btnapply; + } +} diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs new file mode 100644 index 0000000..6424710 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs @@ -0,0 +1,131 @@ +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; +using Newtonsoft.Json; +using ShiftOS.Objects.ShiftFS; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("desktop_widgets")] + [Launcher("Widget Manager", true, "al_widget_manager", "Customization")] + [DefaultTitle("Widget Manager")] + [RequiresUpgrade("desktop_widgets")] + public partial class WidgetManagerFrontend : UserControl, IShiftOSWindow + { + public WidgetManagerFrontend() + { + InitializeComponent(); + } + + Dictionary temp_details = null; + + public void SetupUI() + { + flbody.Controls.Clear(); + if(temp_details == null) + temp_details = new Dictionary(); + foreach(var widgetType in WidgetManager.GetAllWidgetTypes()) + { + + var details = WidgetManager.LoadDetails(widgetType.Value); + if (temp_details.ContainsKey(widgetType.Key.ToString())) + details = temp_details[widgetType.Key.ToString()]; + else + temp_details.Add(widgetType.Key.ToString(), details); + var cbox = new CheckBox(); + cbox.Checked = details.IsVisible; + cbox.Size = new Size(32, 32); + cbox.CheckedChanged += (o, a) => + { + details.IsVisible = cbox.Checked; + }; + flbody.Controls.Add(cbox); + cbox.Show(); + var title = new Label(); + title.Text = widgetType.Key.Name; + title.AutoSize = true; + title.Tag = "header3"; + ControlManager.SetupControl(title); + flbody.Controls.Add(title); + title.Show(); + var desc = new Label(); + desc.Text = widgetType.Key.Description; + flbody.Controls.Add(desc); + flbody.SetFlowBreak(desc, true); + flbody.SetFlowBreak(title, true); + desc.Show(); + } + } + + public void OnLoad() + { + SetupUI(); + } + + public void OnSkinLoad() + { + SetupUI(); + } + + public bool OnUnload() + { + return false; + } + + public void OnUpgrade() + { + SetupUI(); + } + + private void btnapply_Click(object sender, EventArgs e) + { + Utils.WriteAllText(Paths.GetPath("widgets.dat"), JsonConvert.SerializeObject(temp_details)); + Desktop.CurrentDesktop.SetupDesktop(); + } + + private void btnexport_Click(object sender, EventArgs e) + { + FileSkimmerBackend.GetFile(new[] { ".wid" }, FileOpenerStyle.Save, (path) => + { + Utils.WriteAllText(path, JsonConvert.SerializeObject(temp_details)); + }); + } + + private void btnimport_Click(object sender, EventArgs e) + { + FileSkimmerBackend.GetFile(new[] { ".wid" }, FileOpenerStyle.Open, (path) => + { + temp_details = JsonConvert.DeserializeObject>(Utils.ReadAllText(path)); + SetupUI(); + }); + + } + + private void btnloaddefault_Click(object sender, EventArgs e) + { + temp_details.Clear(); + foreach(var type in WidgetManager.GetAllWidgetTypes()) + { + temp_details.Add(type.Key.ToString(), new WidgetDetails + { + IsVisible = false, + Location = new Point(-1, -1) + }); + } + SetupUI(); + } + + private void btnclose_Click(object sender, EventArgs e) + { + AppearanceManager.Close(this); + } + } +} diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.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 dadb022..ca555d4 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -270,6 +270,13 @@ Category: "Device Drivers", Dependencies: "color_depth_8_bits" }, + { + Name: "AL Widget Manager", + Cost: 125, + Description: "Desktop Widgets are a huge advancement in ShiftOS technology, allowing access to system information, and quick control of your system, without even opening a window. However, we still need to be able to modify each widget. This upgrade adds an App Launcher entry for the Desktop Widget Manager.", + Description: "app_launcher;desktop_widgets", + Category: "GUI" + }, { Name: "FS Delete", Cost: 75, diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 915543f..f018390 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -240,6 +240,12 @@ UpdateManager.cs + + UserControl + + + WidgetManagerFrontend.cs + @@ -416,6 +422,9 @@ UpdateManager.cs + + WidgetManagerFrontend.cs + Clock.cs diff --git a/ShiftOS.WinForms/WidgetManager.cs b/ShiftOS.WinForms/WidgetManager.cs index 15e2076..fec09f9 100644 --- a/ShiftOS.WinForms/WidgetManager.cs +++ b/ShiftOS.WinForms/WidgetManager.cs @@ -48,13 +48,13 @@ namespace ShiftOS.WinForms return types; } - internal static void SaveLocation(Type type, Point location) + internal static void SaveDetails(Type type, WidgetDetails location) { - var dict = new Dictionary(); + var dict = new Dictionary(); var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is DesktopWidgetAttribute) as DesktopWidgetAttribute; try { - dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); + dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); dict[attrib.ToString()] = location; } @@ -69,20 +69,30 @@ namespace ShiftOS.WinForms } - internal static Point LoadLocation(Type type) + internal static WidgetDetails LoadDetails(Type type) { - var dict = new Dictionary(); + var dict = new Dictionary(); var attrib = type.GetCustomAttributes(false).FirstOrDefault(x => x is DesktopWidgetAttribute) as DesktopWidgetAttribute; try { - dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); + dict = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("widgets.dat"))); return dict[attrib.ToString()]; } catch { - return new Point(-1, -1); + var details = new WinForms.WidgetDetails + { + Location = new Point(-1, -1), + IsVisible = false + }; + if (dict.ContainsKey(attrib.ToString())) + dict[attrib.ToString()] = details; + else + dict.Add(attrib.ToString(), details); + Utils.WriteAllText(Paths.GetPath("widgets.dat"), JsonConvert.SerializeObject(dict)); + return details; } finally { @@ -90,4 +100,15 @@ namespace ShiftOS.WinForms } } + + public class WidgetDetails + { + public WidgetDetails() + { + IsVisible = true; + } + + public Point Location { get; set; } + public bool IsVisible { get; set; } + } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 61c371e..c5e3efe 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -455,21 +455,28 @@ namespace ShiftOS.WinForms { UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null); - w.Location = WidgetManager.LoadLocation(w.GetType()); + w.Location = WidgetManager.LoadDetails(w.GetType()).Location; pnlwidgetlayer.Controls.Add(w); MakeWidgetMovable(w); Widgets.Add(w as IDesktopWidget); } } + int lastHeight = 5; foreach (var widget in Widgets) { - if (Shiftorium.UpgradeInstalled("desktop_widgets")) + if (WidgetManager.LoadDetails(widget.GetType()).IsVisible && Shiftorium.UpgradeInstalled("desktop_widgets")) { widget.OnSkinLoad(); + widget.OnUpgrade(); widget.Setup(); widget.Show(); + if (widget.Location.X == -1 && widget.Location.Y == -1) + { + widget.Location = new Point(5, lastHeight); + lastHeight += (widget.Location.Y + widget.Size.Height) + 5; + } } else { @@ -525,7 +532,9 @@ namespace ShiftOS.WinForms w.MouseUp += (o, a) => { moving = false; - WidgetManager.SaveLocation(startCtrl.GetType(), startCtrl.Location); + var details = WidgetManager.LoadDetails(startCtrl.GetType()); + details.Location = startCtrl.Location; + WidgetManager.SaveDetails(startCtrl.GetType(), details); }; foreach (Control c in w.Controls) -- cgit v1.2.3 From ba0ae29bbb7eee83c5a4969316d97b43b5f18ba0 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 23 Apr 2017 08:06:00 -0400 Subject: Fix widget stacking --- ShiftOS.WinForms/Applications/Terminal.cs | 295 ++++++++++++++------- .../DesktopWidgets/CodepointsWidget.Designer.cs | 61 +++++ .../DesktopWidgets/CodepointsWidget.cs | 53 ++++ .../DesktopWidgets/CodepointsWidget.resx | 120 +++++++++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 + ShiftOS.WinForms/WinformsDesktop.cs | 2 +- 6 files changed, 446 insertions(+), 94 deletions(-) create mode 100644 ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.Designer.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.cs create mode 100644 ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.resx (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index 30dbd82..cae0bda 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -45,11 +45,13 @@ using ShiftOS.Engine; using ShiftOS.Objects; using ShiftOS.WinForms.Tools; -namespace ShiftOS.WinForms.Applications { +namespace ShiftOS.WinForms.Applications +{ [Launcher("Terminal", false, null, "Utilities")] [WinOpen("terminal")] [DefaultIcon("iconTerminal")] - public partial class Terminal : UserControl, IShiftOSWindow { + public partial class Terminal : UserControl, IShiftOSWindow + { public static Stack ConsoleStack = new Stack(); public static System.Windows.Forms.Timer ti = new System.Windows.Forms.Timer(); @@ -60,72 +62,97 @@ namespace ShiftOS.WinForms.Applications { public static string RemoteGuid = ""; [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static bool PrefixEnabled { - get { + public static bool PrefixEnabled + { + get + { return TerminalBackend.PrefixEnabled; } - set { + set + { TerminalBackend.PrefixEnabled = value; } } [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static bool InStory { - get { + public static bool InStory + { + get + { return TerminalBackend.InStory; } - set { + set + { TerminalBackend.InStory = value; } } [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static string LastCommand { - get { + public static string LastCommand + { + get + { return TerminalBackend.LastCommand; } - set { + set + { TerminalBackend.LastCommand = value; } } - public int TutorialProgress { - get { + public int TutorialProgress + { + get + { throw new NotImplementedException(); } - set { + set + { throw new NotImplementedException(); } } [Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")] - public static void InvokeCommand(string text) { + public static void InvokeCommand(string text) + { TerminalBackend.InvokeCommand(text); } - public Terminal() { + public Terminal() + { InitializeComponent(); - SaveSystem.GameReady += () => { - try { - this.Invoke(new Action(() => { + SaveSystem.GameReady += () => + { + try + { + this.Invoke(new Action(() => + { ResetAllKeywords(); rtbterm.Text = ""; - TerminalBackend.PrefixEnabled = true; - TerminalBackend.InStory = false; - TerminalBackend.PrintPrompt(); - if (Shiftorium.UpgradeInstalled("wm_free_placement")) + if (!Shiftorium.UpgradeInstalled("desktop")) { - this.ParentForm.Width = 640; - this.ParentForm.Height = 480; - this.ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - 640) / 2; - this.ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - 480) / 2; + TerminalBackend.PrefixEnabled = true; + TerminalBackend.InStory = false; + TerminalBackend.PrintPrompt(); + if (Shiftorium.UpgradeInstalled("wm_free_placement")) + { + this.ParentForm.Width = 640; + this.ParentForm.Height = 480; + this.ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - 640) / 2; + this.ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - 480) / 2; + } + } + else + { + AppearanceManager.Close(this); } })); - } catch { } + } + catch { } }; @@ -133,21 +160,32 @@ namespace ShiftOS.WinForms.Applications { } - public void FocusOnTerminal() { + public void FocusOnTerminal() + { rtbterm.Focus(); } - public static string GetTime() { + public static string GetTime() + { var time = DateTime.Now; - if (ShiftoriumFrontend.UpgradeInstalled("full_precision_time")) { + if (ShiftoriumFrontend.UpgradeInstalled("full_precision_time")) + { return DateTime.Now.ToString("h:mm:ss tt"); - } else if (ShiftoriumFrontend.UpgradeInstalled("clock_am_and_pm")) { + } + else if (ShiftoriumFrontend.UpgradeInstalled("clock_am_and_pm")) + { return time.TimeOfDay.TotalHours > 12 ? $"{time.Hour - 12} PM" : $"{time.Hour} AM"; - } else if (ShiftoriumFrontend.UpgradeInstalled("clock_hours")) { + } + else if (ShiftoriumFrontend.UpgradeInstalled("clock_hours")) + { return ((int)time.TimeOfDay.TotalHours).ToString(); - } else if (ShiftoriumFrontend.UpgradeInstalled("clock_minutes")) { + } + else if (ShiftoriumFrontend.UpgradeInstalled("clock_minutes")) + { return ((int)time.TimeOfDay.TotalMinutes).ToString(); - } else if (ShiftoriumFrontend.UpgradeInstalled("clock")) { + } + else if (ShiftoriumFrontend.UpgradeInstalled("clock")) + { return ((int)time.TimeOfDay.TotalSeconds).ToString(); } @@ -157,7 +195,8 @@ namespace ShiftOS.WinForms.Applications { public static event TextSentEventHandler TextSent; - public void ResetAllKeywords() { + public void ResetAllKeywords() + { string primary = SaveSystem.CurrentSave.Username + " "; string secondary = "shiftos "; @@ -166,18 +205,27 @@ namespace ShiftOS.WinForms.Applications { var types = asm.GetTypes(); - foreach (var type in types) { - foreach (var a in type.GetCustomAttributes(false)) { - if (ShiftoriumFrontend.UpgradeAttributesUnlocked(type)) { - if (a is Namespace) { + foreach (var type in types) + { + foreach (var a in type.GetCustomAttributes(false)) + { + if (ShiftoriumFrontend.UpgradeAttributesUnlocked(type)) + { + if (a is Namespace) + { var ns = a as Namespace; - if (!primary.Contains(ns.name)) { + if (!primary.Contains(ns.name)) + { primary += ns.name + " "; } - foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) { - if (ShiftoriumFrontend.UpgradeAttributesUnlocked(method)) { - foreach (var ma in method.GetCustomAttributes(false)) { - if (ma is Command) { + foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.Static)) + { + if (ShiftoriumFrontend.UpgradeAttributesUnlocked(method)) + { + foreach (var ma in method.GetCustomAttributes(false)) + { + if (ma is Command) + { var cmd = ma as Command; if (!secondary.Contains(cmd.name)) secondary += cmd.name + " "; @@ -193,14 +241,19 @@ namespace ShiftOS.WinForms.Applications { } - public static void MakeWidget(Controls.TerminalBox txt) { + public static void MakeWidget(Controls.TerminalBox txt) + { AppearanceManager.StartConsoleOut(); - txt.GotFocus += (o, a) => { + txt.GotFocus += (o, a) => + { AppearanceManager.ConsoleOut = txt; }; - txt.KeyDown += (o, a) => { - if (a.KeyCode == Keys.Enter) { - try { + txt.KeyDown += (o, a) => + { + if (a.KeyCode == Keys.Enter) + { + try + { a.SuppressKeyPress = true; Console.WriteLine(""); var text = txt.Lines.ToArray(); @@ -208,29 +261,44 @@ namespace ShiftOS.WinForms.Applications { var text3 = ""; var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); - if (IsInRemoteSystem == true) { - ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new { + if (IsInRemoteSystem == true) + { + ServerManager.SendMessage("trm_invcmd", JsonConvert.SerializeObject(new + { guid = RemoteGuid, command = text4 })); - } else { - if (TerminalBackend.PrefixEnabled) { + } + else + { + if (TerminalBackend.PrefixEnabled) + { text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); } TerminalBackend.LastCommand = text3; TextSent?.Invoke(text4); - if (TerminalBackend.InStory == false) { - if(text3 == "stop theme") { + if (TerminalBackend.InStory == false) + { + if (text3 == "stop theme") + { CurrentCommandParser.parser = null; - }else { - if(CurrentCommandParser.parser == null) { + } + else + { + if (CurrentCommandParser.parser == null) + { TerminalBackend.InvokeCommand(text3); - } else { + } + else + { var result = CurrentCommandParser.parser.ParseCommand(text3); - if (result.Equals(default(KeyValuePair, Dictionary>))) { + if (result.Equals(default(KeyValuePair, Dictionary>))) + { Console.WriteLine("Syntax Error: Syntax Error"); - } else { + } + else + { TerminalBackend.InvokeCommand(result.Key.Key, result.Key.Value, result.Value); } } @@ -241,23 +309,35 @@ namespace ShiftOS.WinForms.Applications { TerminalBackend.PrintPrompt(); } } - } catch { } - } else if (a.KeyCode == Keys.Back) { - try { + catch + { + } + } + else if (a.KeyCode == Keys.Back) + { + try + { var tostring3 = txt.Lines[txt.Lines.Length - 1]; var tostringlen = tostring3.Length + 1; var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; var derp = workaround.Length + 1; - if (tostringlen != derp) { + if (tostringlen != derp) + { AppearanceManager.CurrentPosition--; - } else { + } + else + { a.SuppressKeyPress = true; } - } catch { + } + catch + { Debug.WriteLine("Drunky alert in terminal."); } - } else if (a.KeyCode == Keys.Left) { + } + else if (a.KeyCode == Keys.Left) + { var getstring = txt.Lines[txt.Lines.Length - 1]; var stringlen = getstring.Length + 1; var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; @@ -266,19 +346,27 @@ namespace ShiftOS.WinForms.Applications { var remstrlen = txt.TextLength - stringlen; var finalnum = selstart - remstrlen; - if (finalnum != headerlen) { + if (finalnum != headerlen) + { AppearanceManager.CurrentPosition--; - } else { + } + else + { a.SuppressKeyPress = true; } - } else if (a.KeyCode == Keys.Up) { + } + else if (a.KeyCode == Keys.Up) + { var tostring3 = txt.Lines[txt.Lines.Length - 1]; if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") Console.Write(TerminalBackend.LastCommand); a.SuppressKeyPress = true; - } else { - if (TerminalBackend.InStory) { + } + else + { + if (TerminalBackend.InStory) + { a.SuppressKeyPress = true; } AppearanceManager.CurrentPosition++; @@ -287,7 +375,7 @@ namespace ShiftOS.WinForms.Applications { }; AppearanceManager.ConsoleOut = txt; - + txt.Focus(); txt.Font = LoadedSkin.TerminalFont; @@ -296,12 +384,17 @@ namespace ShiftOS.WinForms.Applications { } - private void Terminal_Load(object sender, EventArgs e) { - ServerManager.MessageReceived += (msg) => { - if (msg.Name == "trm_handshake_guid") { + private void Terminal_Load(object sender, EventArgs e) + { + ServerManager.MessageReceived += (msg) => + { + if (msg.Name == "trm_handshake_guid") + { IsInRemoteSystem = true; RemoteGuid = msg.GUID; - } else if (msg.Name == "trm_handshake_stop") { + } + else if (msg.Name == "trm_handshake_stop") + { IsInRemoteSystem = false; RemoteGuid = ""; } @@ -309,17 +402,21 @@ namespace ShiftOS.WinForms.Applications { } - private void Terminal_FormClosing(object sender, FormClosingEventArgs e) { + private void Terminal_FormClosing(object sender, FormClosingEventArgs e) + { ti.Stop(); IsInRemoteSystem = false; RemoteGuid = ""; } - public void OnLoad() { + public void OnLoad() + { MakeWidget(rtbterm); - if (SaveSystem.CurrentSave != null) { - if (!ShiftoriumFrontend.UpgradeInstalled("window_manager")) { + if (SaveSystem.CurrentSave != null) + { + if (!ShiftoriumFrontend.UpgradeInstalled("window_manager")) + { rtbterm.Select(rtbterm.TextLength, 0); } TerminalBackend.PrintPrompt(); @@ -328,8 +425,10 @@ namespace ShiftOS.WinForms.Applications { } - public void OnSkinLoad() { - try { + public void OnSkinLoad() + { + try + { rtbterm.Font = LoadedSkin.TerminalFont; rtbterm.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC); rtbterm.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC); @@ -341,19 +440,27 @@ namespace ShiftOS.WinForms.Applications { } - public bool OnUnload() { - if (SaveSystem.ShuttingDown == false) { - if (!ShiftoriumFrontend.UpgradeInstalled("desktop")) { - if (AppearanceManager.OpenForms.Count <= 1) { + public bool OnUnload() + { + if (SaveSystem.ShuttingDown == false) + { + if (!ShiftoriumFrontend.UpgradeInstalled("desktop")) + { + if (AppearanceManager.OpenForms.Count <= 1) + { Console.WriteLine(""); Console.WriteLine("{WIN_CANTCLOSETERMINAL}"); - try { + try + { Console.WriteLine(""); - if (TerminalBackend.PrefixEnabled) { + if (TerminalBackend.PrefixEnabled) + { Console.Write($"{SaveSystem.CurrentSave.Username}@shiftos:~$ "); } - } catch (Exception ex) { + } + catch (Exception ex) + { Console.WriteLine(ex); } return false; @@ -363,10 +470,12 @@ namespace ShiftOS.WinForms.Applications { return true; } - public void OnUpgrade() { + public void OnUpgrade() + { } - private void rtbterm_TextChanged(object sender, EventArgs e) { + private void rtbterm_TextChanged(object sender, EventArgs e) + { } diff --git a/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.Designer.cs b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.Designer.cs new file mode 100644 index 0000000..9f3ccc7 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.Designer.cs @@ -0,0 +1,61 @@ +namespace ShiftOS.WinForms.DesktopWidgets +{ + partial class CodepointsWidget + { + /// + /// 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.lbcodepoints = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbcodepoints + // + this.lbcodepoints.Cursor = System.Windows.Forms.Cursors.Default; + this.lbcodepoints.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbcodepoints.Location = new System.Drawing.Point(0, 0); + this.lbcodepoints.Name = "lbcodepoints"; + this.lbcodepoints.Size = new System.Drawing.Size(274, 57); + this.lbcodepoints.TabIndex = 0; + this.lbcodepoints.Tag = "header3"; + this.lbcodepoints.Text = "label1"; + this.lbcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // CodepointsWidget + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbcodepoints); + this.Name = "CodepointsWidget"; + this.Size = new System.Drawing.Size(274, 57); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lbcodepoints; + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.cs b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.cs new file mode 100644 index 0000000..fee8b1d --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.cs @@ -0,0 +1,53 @@ +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.WinForms.Tools; +using ShiftOS.Engine; + +namespace ShiftOS.WinForms.DesktopWidgets +{ + [DesktopWidget("Codepoints Display", "Show how many Codepoints you have.")] + public partial class CodepointsWidget : UserControl, IDesktopWidget + { + public CodepointsWidget() + { + InitializeComponent(); + tmr.Tick += (o, a) => + { + try + { + lbcodepoints.Text = SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints"; + } + catch { } + }; + tmr.Interval = 350; + this.VisibleChanged += (o, a) => + { + if (this.Visible == false) + tmr.Stop(); + }; + } + + Timer tmr = new Timer(); + + public void OnSkinLoad() + { + ControlManager.SetupControls(this); + } + + public void OnUpgrade() + { + } + + public void Setup() + { + tmr.Start(); + } + } +} diff --git a/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.resx b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/DesktopWidgets/CodepointsWidget.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/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 3f7c463..bd8fd65 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -270,6 +270,12 @@ Clock.cs + + UserControl + + + CodepointsWidget.cs + UserControl @@ -434,6 +440,9 @@ Clock.cs + + CodepointsWidget.cs + TerminalWidget.cs diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index c5e3efe..c98a255 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -475,7 +475,7 @@ namespace ShiftOS.WinForms if (widget.Location.X == -1 && widget.Location.Y == -1) { widget.Location = new Point(5, lastHeight); - lastHeight += (widget.Location.Y + widget.Size.Height) + 5; + lastHeight += widget.Size.Height + 5; } } else -- cgit v1.2.3 From 894320db54760bc697f027809c59450987fd38d5 Mon Sep 17 00:00:00 2001 From: Michael Date: Wed, 26 Apr 2017 15:10:37 -0400 Subject: Make widgets and desktopbg hide AL --- ShiftOS.WinForms/WinformsDesktop.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index c98a255..d7c5196 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -61,6 +61,10 @@ namespace ShiftOS.WinForms public WinformsDesktop() { InitializeComponent(); + pnlwidgetlayer.Click += (o, a) => + { + HideAppLauncher(); + }; ControlManager.MakeDoubleBuffered(pnlwidgetlayer); this.Click += (o, a) => { @@ -507,6 +511,7 @@ namespace ShiftOS.WinForms w.MouseDown += (o, a) => { + HideAppLauncher(); moving = true; }; -- cgit v1.2.3 From 7532df70757ecbcaf735a5fc50eee282f555741a Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 1 May 2017 15:23:46 -0400 Subject: Replace most instances of "CurrentSave.Username" --- ShiftOS.Objects/Save.cs | 4 + ShiftOS.Server/Program.cs | 7 +- ShiftOS.WinForms/Applications/Dialog.cs | 2 - ShiftOS.WinForms/Applications/Terminal.cs | 12 +- ShiftOS.WinForms/FakeSetupScreen.Designer.cs | 624 --------------------------- ShiftOS.WinForms/FakeSetupScreen.cs | 395 ----------------- ShiftOS.WinForms/FakeSetupScreen.resx | 120 ------ ShiftOS.WinForms/Oobe.cs | 34 +- ShiftOS.WinForms/ShiftOS.WinForms.csproj | 9 - ShiftOS.WinForms/WinformsDesktop.cs | 5 +- ShiftOS_TheReturn/CommandParser.cs | 3 - ShiftOS_TheReturn/Commands.cs | 2 +- 12 files changed, 14 insertions(+), 1203 deletions(-) delete mode 100644 ShiftOS.WinForms/FakeSetupScreen.Designer.cs delete mode 100644 ShiftOS.WinForms/FakeSetupScreen.cs delete mode 100644 ShiftOS.WinForms/FakeSetupScreen.resx (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.Objects/Save.cs b/ShiftOS.Objects/Save.cs index 1adaf3b..4f91db7 100644 --- a/ShiftOS.Objects/Save.cs +++ b/ShiftOS.Objects/Save.cs @@ -34,7 +34,11 @@ namespace ShiftOS.Objects //Better to store this stuff server-side so we can do some neat stuff with hacking... public class Save { + + [Obsolete("This save variable is no longer used in Beta 2.4 and above of ShiftOS. Please use ShiftOS.Engine.SaveSystem.CurrentUser.Username to access the current user's username.")] public string Username { get; set; } + + public long Codepoints { get; set; } public Dictionary Upgrades { get; set; } public int StoryPosition { get; set; } diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs index 9e89e56..97c8a66 100644 --- a/ShiftOS.Server/Program.cs +++ b/ShiftOS.Server/Program.cs @@ -296,8 +296,6 @@ namespace ShiftOS.Server /// Message. public static void Interpret(ServerMessage msg) { - Dictionary args = null; - try { Console.WriteLine($@"[{DateTime.Now}] Message received from {msg.GUID}: {msg.Name}"); @@ -325,8 +323,7 @@ namespace ShiftOS.Server try { object contents = null; - bool throwOnNull = false; - + if (mAttrib.ExpectedType == typeof(int)) { @@ -354,7 +351,6 @@ namespace ShiftOS.Server } else if (mAttrib.ExpectedType == typeof(bool)) { - throwOnNull = true; if (msg.Contents.ToLower() == "true") { contents = true; @@ -371,7 +367,6 @@ namespace ShiftOS.Server } else if (mAttrib.ExpectedType == null) { - throwOnNull = false; } else if(mAttrib.ExpectedType == typeof(string)) { diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs index 2abc705..f9d0b86 100644 --- a/ShiftOS.WinForms/Applications/Dialog.cs +++ b/ShiftOS.WinForms/Applications/Dialog.cs @@ -85,8 +85,6 @@ namespace ShiftOS.WinForms.Applications } - private Action OpenCallback = null; - public void Open(string title, string msg, Action c = null) { new Dialog().OpenInternal(title, msg, c); diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index d35f7e0..32c5363 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -197,7 +197,7 @@ namespace ShiftOS.WinForms.Applications public void ResetAllKeywords() { - string primary = SaveSystem.CurrentSave.Username + " "; + string primary = SaveSystem.CurrentUser.Username + " "; string secondary = "shiftos "; @@ -279,7 +279,7 @@ namespace ShiftOS.WinForms.Applications { if (TerminalBackend.PrefixEnabled) { - text3 = text4.Remove(0, $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); + text3 = text4.Remove(0, $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ".Length); } TerminalBackend.LastCommand = text3; TextSent?.Invoke(text4); @@ -327,7 +327,7 @@ namespace ShiftOS.WinForms.Applications { var tostring3 = txt.Lines[txt.Lines.Length - 1]; var tostringlen = tostring3.Length + 1; - var workaround = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; + var workaround = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; var derp = workaround.Length + 1; if (tostringlen != derp) { @@ -347,7 +347,7 @@ namespace ShiftOS.WinForms.Applications { var getstring = txt.Lines[txt.Lines.Length - 1]; var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; + var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; var headerlen = header.Length + 1; var selstart = txt.SelectionStart; var remstrlen = txt.TextLength - stringlen; @@ -365,7 +365,7 @@ namespace ShiftOS.WinForms.Applications else if (a.KeyCode == Keys.Up) { var tostring3 = txt.Lines[txt.Lines.Length - 1]; - if (tostring3 == $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") + if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") Console.Write(TerminalBackend.LastCommand); a.SuppressKeyPress = true; @@ -465,7 +465,7 @@ namespace ShiftOS.WinForms.Applications if (TerminalBackend.PrefixEnabled) { - Console.Write($"{SaveSystem.CurrentSave.Username}@shiftos:~$ "); + Console.Write($"{SaveSystem.CurrentUser.Username}@shiftos:~$ "); } } catch (Exception ex) diff --git a/ShiftOS.WinForms/FakeSetupScreen.Designer.cs b/ShiftOS.WinForms/FakeSetupScreen.Designer.cs deleted file mode 100644 index b14367b..0000000 --- a/ShiftOS.WinForms/FakeSetupScreen.Designer.cs +++ /dev/null @@ -1,624 +0,0 @@ -/* - * 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. - */ - -namespace ShiftOS.WinForms -{ - partial class FakeSetupScreen - { - /// - /// 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 Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - this.pnlheader = new System.Windows.Forms.Panel(); - this.flbuttons = new System.Windows.Forms.FlowLayoutPanel(); - this.btnnext = new System.Windows.Forms.Button(); - this.btnback = new System.Windows.Forms.Button(); - this.page1 = new System.Windows.Forms.Panel(); - this.label2 = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); - this.page2 = new System.Windows.Forms.Panel(); - this.lbbyteszeroed = new System.Windows.Forms.Label(); - this.pgformatprogress = new System.Windows.Forms.ProgressBar(); - this.lbformattitle = new System.Windows.Forms.Label(); - this.page3 = new System.Windows.Forms.Panel(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.label3 = new System.Windows.Forms.Label(); - this.txtnewusername = new System.Windows.Forms.TextBox(); - this.label5 = new System.Windows.Forms.Label(); - this.txtnewpassword = new System.Windows.Forms.TextBox(); - this.label6 = new System.Windows.Forms.Label(); - this.txtnewsysname = new System.Windows.Forms.TextBox(); - this.label4 = new System.Windows.Forms.Label(); - this.page4 = new System.Windows.Forms.Panel(); - this.txtlicenseagreement = new System.Windows.Forms.RichTextBox(); - this.label10 = new System.Windows.Forms.Label(); - this.pgrereg = new System.Windows.Forms.Panel(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.label7 = new System.Windows.Forms.Label(); - this.txtruname = new System.Windows.Forms.TextBox(); - this.label8 = new System.Windows.Forms.Label(); - this.txtrpass = new System.Windows.Forms.TextBox(); - this.label9 = new System.Windows.Forms.Label(); - this.txtrsys = new System.Windows.Forms.TextBox(); - this.label11 = new System.Windows.Forms.Label(); - this.pglogin = new System.Windows.Forms.Panel(); - this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.label12 = new System.Windows.Forms.Label(); - this.txtluser = new System.Windows.Forms.TextBox(); - this.label13 = new System.Windows.Forms.Label(); - this.txtlpass = new System.Windows.Forms.TextBox(); - this.label15 = new System.Windows.Forms.Label(); - this.button1 = new System.Windows.Forms.Button(); - this.btnnlogin = new System.Windows.Forms.Button(); - this.flbuttons.SuspendLayout(); - this.page1.SuspendLayout(); - this.page2.SuspendLayout(); - this.page3.SuspendLayout(); - this.tableLayoutPanel1.SuspendLayout(); - this.page4.SuspendLayout(); - this.pgrereg.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.pglogin.SuspendLayout(); - this.tableLayoutPanel3.SuspendLayout(); - this.SuspendLayout(); - // - // pnlheader - // - this.pnlheader.BackColor = System.Drawing.SystemColors.ControlDark; - this.pnlheader.Dock = System.Windows.Forms.DockStyle.Left; - this.pnlheader.Location = new System.Drawing.Point(0, 0); - this.pnlheader.Name = "pnlheader"; - this.pnlheader.Size = new System.Drawing.Size(138, 300); - this.pnlheader.TabIndex = 0; - // - // flbuttons - // - this.flbuttons.AutoSize = true; - this.flbuttons.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flbuttons.Controls.Add(this.btnnext); - this.flbuttons.Controls.Add(this.btnback); - this.flbuttons.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flbuttons.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flbuttons.Location = new System.Drawing.Point(0, 300); - this.flbuttons.Name = "flbuttons"; - this.flbuttons.Size = new System.Drawing.Size(490, 29); - this.flbuttons.TabIndex = 1; - // - // btnnext - // - this.btnnext.Location = new System.Drawing.Point(412, 3); - this.btnnext.Name = "btnnext"; - this.btnnext.Size = new System.Drawing.Size(75, 23); - this.btnnext.TabIndex = 0; - this.btnnext.Text = "Next"; - this.btnnext.UseVisualStyleBackColor = true; - this.btnnext.Click += new System.EventHandler(this.btnnext_Click); - // - // btnback - // - this.btnback.Location = new System.Drawing.Point(331, 3); - this.btnback.Name = "btnback"; - this.btnback.Size = new System.Drawing.Size(75, 23); - this.btnback.TabIndex = 1; - this.btnback.Text = "Back"; - this.btnback.UseVisualStyleBackColor = true; - this.btnback.Click += new System.EventHandler(this.btnback_Click); - // - // page1 - // - this.page1.Controls.Add(this.label2); - this.page1.Controls.Add(this.label1); - this.page1.Dock = System.Windows.Forms.DockStyle.Fill; - this.page1.Location = new System.Drawing.Point(138, 0); - this.page1.Name = "page1"; - this.page1.Size = new System.Drawing.Size(352, 300); - this.page1.TabIndex = 2; - // - // label2 - // - this.label2.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.label2.Location = new System.Drawing.Point(20, 87); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(320, 199); - this.label2.TabIndex = 1; - this.label2.Text = "This wizard will guide you through the installation and configuration of ShiftOS." + - "\r\n\r\nPress Next to continue."; - // - // label1 - // - this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.label1.Location = new System.Drawing.Point(19, 22); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(321, 44); - this.label1.TabIndex = 0; - this.label1.Text = "Welcome to the ShiftOS installation wizard."; - // - // page2 - // - this.page2.Controls.Add(this.lbbyteszeroed); - this.page2.Controls.Add(this.pgformatprogress); - this.page2.Controls.Add(this.lbformattitle); - this.page2.Dock = System.Windows.Forms.DockStyle.Fill; - this.page2.Location = new System.Drawing.Point(138, 0); - this.page2.Name = "page2"; - this.page2.Size = new System.Drawing.Size(352, 300); - this.page2.TabIndex = 2; - // - // lbbyteszeroed - // - this.lbbyteszeroed.AutoSize = true; - this.lbbyteszeroed.Location = new System.Drawing.Point(20, 91); - this.lbbyteszeroed.Name = "lbbyteszeroed"; - this.lbbyteszeroed.Size = new System.Drawing.Size(127, 13); - this.lbbyteszeroed.TabIndex = 5; - this.lbbyteszeroed.Text = "Bytes zeroed: 0/1000000"; - // - // pgformatprogress - // - this.pgformatprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.pgformatprogress.Location = new System.Drawing.Point(23, 61); - this.pgformatprogress.Name = "pgformatprogress"; - this.pgformatprogress.Size = new System.Drawing.Size(317, 23); - this.pgformatprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous; - this.pgformatprogress.TabIndex = 4; - // - // lbformattitle - // - this.lbformattitle.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lbformattitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.lbformattitle.Location = new System.Drawing.Point(16, 9); - this.lbformattitle.Name = "lbformattitle"; - this.lbformattitle.Size = new System.Drawing.Size(321, 26); - this.lbformattitle.TabIndex = 3; - this.lbformattitle.Text = "Formatting your drive..."; - // - // page3 - // - this.page3.Controls.Add(this.btnnlogin); - this.page3.Controls.Add(this.tableLayoutPanel1); - this.page3.Controls.Add(this.label4); - this.page3.Dock = System.Windows.Forms.DockStyle.Fill; - this.page3.Location = new System.Drawing.Point(138, 0); - this.page3.Name = "page3"; - this.page3.Size = new System.Drawing.Size(352, 300); - this.page3.TabIndex = 6; - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSize = true; - this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Controls.Add(this.label3, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.txtnewusername, 1, 0); - this.tableLayoutPanel1.Controls.Add(this.label5, 0, 1); - this.tableLayoutPanel1.Controls.Add(this.txtnewpassword, 1, 1); - this.tableLayoutPanel1.Controls.Add(this.label6, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.txtnewsysname, 1, 2); - this.tableLayoutPanel1.Location = new System.Drawing.Point(20, 61); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 3; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(212, 72); - this.tableLayoutPanel1.TabIndex = 4; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(3, 0); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(58, 13); - this.label3.TabIndex = 0; - this.label3.Text = "Username:"; - // - // txtnewusername - // - this.txtnewusername.Location = new System.Drawing.Point(109, 3); - this.txtnewusername.Name = "txtnewusername"; - this.txtnewusername.Size = new System.Drawing.Size(100, 20); - this.txtnewusername.TabIndex = 1; - // - // label5 - // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(3, 26); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(56, 13); - this.label5.TabIndex = 2; - this.label5.Text = "Password:"; - // - // txtnewpassword - // - this.txtnewpassword.Location = new System.Drawing.Point(109, 29); - this.txtnewpassword.Name = "txtnewpassword"; - this.txtnewpassword.PasswordChar = '*'; - this.txtnewpassword.Size = new System.Drawing.Size(100, 20); - this.txtnewpassword.TabIndex = 3; - // - // label6 - // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(3, 52); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(75, 13); - this.label6.TabIndex = 4; - this.label6.Text = "System Name:"; - // - // txtnewsysname - // - this.txtnewsysname.Location = new System.Drawing.Point(109, 55); - this.txtnewsysname.Name = "txtnewsysname"; - this.txtnewsysname.Size = new System.Drawing.Size(100, 20); - this.txtnewsysname.TabIndex = 5; - // - // label4 - // - this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.label4.Location = new System.Drawing.Point(16, 9); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(321, 26); - this.label4.TabIndex = 3; - this.label4.Text = "User information"; - // - // page4 - // - this.page4.Controls.Add(this.txtlicenseagreement); - this.page4.Controls.Add(this.label10); - this.page4.Dock = System.Windows.Forms.DockStyle.Fill; - this.page4.Location = new System.Drawing.Point(138, 0); - this.page4.Name = "page4"; - this.page4.Size = new System.Drawing.Size(352, 300); - this.page4.TabIndex = 7; - // - // txtlicenseagreement - // - this.txtlicenseagreement.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.txtlicenseagreement.Location = new System.Drawing.Point(23, 58); - this.txtlicenseagreement.Name = "txtlicenseagreement"; - this.txtlicenseagreement.ReadOnly = true; - this.txtlicenseagreement.Size = new System.Drawing.Size(326, 228); - this.txtlicenseagreement.TabIndex = 4; - this.txtlicenseagreement.Text = ""; - // - // label10 - // - this.label10.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label10.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.label10.Location = new System.Drawing.Point(16, 9); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(321, 26); - this.label10.TabIndex = 3; - this.label10.Text = "License Agreement"; - // - // pgrereg - // - this.pgrereg.Controls.Add(this.tableLayoutPanel2); - this.pgrereg.Controls.Add(this.label11); - this.pgrereg.Dock = System.Windows.Forms.DockStyle.Fill; - this.pgrereg.Location = new System.Drawing.Point(138, 0); - this.pgrereg.Name = "pgrereg"; - this.pgrereg.Size = new System.Drawing.Size(352, 300); - this.pgrereg.TabIndex = 8; - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel2.ColumnCount = 2; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Controls.Add(this.label7, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.txtruname, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.label8, 0, 1); - this.tableLayoutPanel2.Controls.Add(this.txtrpass, 1, 1); - this.tableLayoutPanel2.Controls.Add(this.label9, 0, 2); - this.tableLayoutPanel2.Controls.Add(this.txtrsys, 1, 2); - this.tableLayoutPanel2.Location = new System.Drawing.Point(20, 61); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 3; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(212, 72); - this.tableLayoutPanel2.TabIndex = 4; - // - // label7 - // - this.label7.AutoSize = true; - this.label7.Location = new System.Drawing.Point(3, 0); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(58, 13); - this.label7.TabIndex = 0; - this.label7.Text = "Username:"; - // - // txtruname - // - this.txtruname.Location = new System.Drawing.Point(109, 3); - this.txtruname.Name = "txtruname"; - this.txtruname.Size = new System.Drawing.Size(100, 20); - this.txtruname.TabIndex = 1; - // - // label8 - // - this.label8.AutoSize = true; - this.label8.Location = new System.Drawing.Point(3, 26); - this.label8.Name = "label8"; - this.label8.Size = new System.Drawing.Size(56, 13); - this.label8.TabIndex = 2; - this.label8.Text = "Password:"; - // - // txtrpass - // - this.txtrpass.Location = new System.Drawing.Point(109, 29); - this.txtrpass.Name = "txtrpass"; - this.txtrpass.PasswordChar = '*'; - this.txtrpass.Size = new System.Drawing.Size(100, 20); - this.txtrpass.TabIndex = 3; - // - // label9 - // - this.label9.AutoSize = true; - this.label9.Location = new System.Drawing.Point(3, 52); - this.label9.Name = "label9"; - this.label9.Size = new System.Drawing.Size(75, 13); - this.label9.TabIndex = 4; - this.label9.Text = "System Name:"; - // - // txtrsys - // - this.txtrsys.Location = new System.Drawing.Point(109, 55); - this.txtrsys.Name = "txtrsys"; - this.txtrsys.Size = new System.Drawing.Size(100, 20); - this.txtrsys.TabIndex = 5; - // - // label11 - // - this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.label11.Location = new System.Drawing.Point(16, 9); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(321, 26); - this.label11.TabIndex = 3; - this.label11.Text = "User information"; - // - // pglogin - // - this.pglogin.Controls.Add(this.tableLayoutPanel3); - this.pglogin.Controls.Add(this.label15); - this.pglogin.Controls.Add(this.button1); - this.pglogin.Dock = System.Windows.Forms.DockStyle.Fill; - this.pglogin.Location = new System.Drawing.Point(138, 0); - this.pglogin.Name = "pglogin"; - this.pglogin.Size = new System.Drawing.Size(352, 300); - this.pglogin.TabIndex = 9; - // - // tableLayoutPanel3 - // - this.tableLayoutPanel3.AutoSize = true; - this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel3.ColumnCount = 2; - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.Controls.Add(this.label12, 0, 0); - this.tableLayoutPanel3.Controls.Add(this.txtluser, 1, 0); - this.tableLayoutPanel3.Controls.Add(this.label13, 0, 1); - this.tableLayoutPanel3.Controls.Add(this.txtlpass, 1, 1); - this.tableLayoutPanel3.Location = new System.Drawing.Point(20, 61); - this.tableLayoutPanel3.Name = "tableLayoutPanel3"; - this.tableLayoutPanel3.RowCount = 3; - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(212, 72); - this.tableLayoutPanel3.TabIndex = 4; - // - // label12 - // - this.label12.AutoSize = true; - this.label12.Location = new System.Drawing.Point(3, 0); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(58, 13); - this.label12.TabIndex = 0; - this.label12.Text = "Username:"; - // - // txtluser - // - this.txtluser.Location = new System.Drawing.Point(109, 3); - this.txtluser.Name = "txtluser"; - this.txtluser.Size = new System.Drawing.Size(100, 20); - this.txtluser.TabIndex = 1; - // - // label13 - // - this.label13.AutoSize = true; - this.label13.Location = new System.Drawing.Point(3, 26); - this.label13.Name = "label13"; - this.label13.Size = new System.Drawing.Size(56, 13); - this.label13.TabIndex = 2; - this.label13.Text = "Password:"; - // - // txtlpass - // - this.txtlpass.Location = new System.Drawing.Point(109, 29); - this.txtlpass.Name = "txtlpass"; - this.txtlpass.PasswordChar = '*'; - this.txtlpass.Size = new System.Drawing.Size(100, 20); - this.txtlpass.TabIndex = 3; - // - // label15 - // - this.label15.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.label15.Font = new System.Drawing.Font("Microsoft Sans Serif", 13F); - this.label15.Location = new System.Drawing.Point(16, 9); - this.label15.Name = "label15"; - this.label15.Size = new System.Drawing.Size(321, 26); - this.label15.TabIndex = 3; - this.label15.Text = "User information"; - // - // button1 - // - this.button1.Location = new System.Drawing.Point(129, 142); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 21); - this.button1.TabIndex = 4; - this.button1.Text = "Register"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // btnnlogin - // - this.btnnlogin.Location = new System.Drawing.Point(129, 156); - this.btnnlogin.Name = "btnnlogin"; - this.btnnlogin.Size = new System.Drawing.Size(75, 23); - this.btnnlogin.TabIndex = 5; - this.btnnlogin.Text = "Log in"; - this.btnnlogin.UseVisualStyleBackColor = true; - this.btnnlogin.Click += new System.EventHandler(this.btnnlogin_Click); - // - // FakeSetupScreen - // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(490, 329); - this.Controls.Add(this.pglogin); - this.Controls.Add(this.page3); - this.Controls.Add(this.pgrereg); - this.Controls.Add(this.page4); - this.Controls.Add(this.page2); - this.Controls.Add(this.page1); - this.Controls.Add(this.pnlheader); - this.Controls.Add(this.flbuttons); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FakeSetupScreen"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "ShiftOS"; - this.TopMost = true; - this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FakeSetupScreen_FormClosing); - this.flbuttons.ResumeLayout(false); - this.page1.ResumeLayout(false); - this.page2.ResumeLayout(false); - this.page2.PerformLayout(); - this.page3.ResumeLayout(false); - this.page3.PerformLayout(); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.page4.ResumeLayout(false); - this.pgrereg.ResumeLayout(false); - this.pgrereg.PerformLayout(); - this.tableLayoutPanel2.ResumeLayout(false); - this.tableLayoutPanel2.PerformLayout(); - this.pglogin.ResumeLayout(false); - this.pglogin.PerformLayout(); - this.tableLayoutPanel3.ResumeLayout(false); - this.tableLayoutPanel3.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Panel pnlheader; - private System.Windows.Forms.FlowLayoutPanel flbuttons; - private System.Windows.Forms.Button btnnext; - private System.Windows.Forms.Button btnback; - private System.Windows.Forms.Panel page1; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Panel page2; - private System.Windows.Forms.Label lbformattitle; - private System.Windows.Forms.Label lbbyteszeroed; - private System.Windows.Forms.ProgressBar pgformatprogress; - private System.Windows.Forms.Panel page3; - private System.Windows.Forms.Label label4; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.TextBox txtnewusername; - private System.Windows.Forms.Label label5; - private System.Windows.Forms.TextBox txtnewpassword; - private System.Windows.Forms.Label label6; - private System.Windows.Forms.TextBox txtnewsysname; - private System.Windows.Forms.Panel page4; - private System.Windows.Forms.RichTextBox txtlicenseagreement; - private System.Windows.Forms.Label label10; - private System.Windows.Forms.Panel pgrereg; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; - private System.Windows.Forms.Label label7; - private System.Windows.Forms.TextBox txtruname; - private System.Windows.Forms.Label label8; - private System.Windows.Forms.TextBox txtrpass; - private System.Windows.Forms.Label label9; - private System.Windows.Forms.TextBox txtrsys; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Panel pglogin; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.TextBox txtluser; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.TextBox txtlpass; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.Button btnnlogin; - } -} \ No newline at end of file diff --git a/ShiftOS.WinForms/FakeSetupScreen.cs b/ShiftOS.WinForms/FakeSetupScreen.cs deleted file mode 100644 index f62c777..0000000 --- a/ShiftOS.WinForms/FakeSetupScreen.cs +++ /dev/null @@ -1,395 +0,0 @@ -/* - * 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. - */ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Forms; -using Newtonsoft.Json; -using ShiftOS.Engine; - -namespace ShiftOS.WinForms -{ - public partial class FakeSetupScreen : Form - { - private Oobe oobe = null; - - public Action MUDUserFound = null; - - public FakeSetupScreen(Oobe _oobe, int page = 0) - { - oobe = _oobe; - InitializeComponent(); - currentPage = page; - SetupUI(); - ServerManager.MessageReceived += (msg) => - { - if (this.Visible == true) - { - if (msg.Name == "mud_notfound") - this.Invoke(new Action(() => { MUDUserFound?.Invoke(false); })); - else if (msg.Name == "mud_found") - this.Invoke(new Action(() => { MUDUserFound?.Invoke(true); })); - } - }; - } - - public event Action TextSent; - bool isTyping = false; - - private int currentPage = 0; - - public void SetupUI() - { - btnback.Show(); - pnlheader.Dock = DockStyle.Top; - pnlheader.Height = 50; - switch (currentPage) - { - case 0: - page1.BringToFront(); - pnlheader.Dock = DockStyle.Left; - pnlheader.Width = 100; - btnback.Hide(); - break; - case 1: - btnnext.Hide(); - btnback.Hide(); - page2.BringToFront(); - pgformatprogress.Value = 0; - var dinf = new System.IO.DriveInfo("C:"); - StartWipingInBackground(((dinf.TotalSize / 1024) / 1024) / 1024); - TextType($@"So I see you're progressing through. -I really hope you aren't one of those newbies who just next-next-next-finish their way through these things. -I see you've named your drive " + dinf.VolumeLabel + $@" -And it can contain up to {dinf.TotalSize} bytes of information. -And you've formatted this drive with a partition of type " + dinf.DriveFormat + $@". -Interesting... -Very interesting..."); - break; - case 2: - btnnext.Show(); - btnback.Hide(); - TextType(@"Now it's all gone. Now I need some user input so I can install ShiftOS. -Firstly, please enter a username, password, and system name. -Make the username and system name unique so I can identify exactly who you are. You're not the only one here. -Also, make sure the password is secure... There have been people known to breach users' accounts in ShiftOS and steal their stuff. -So make sure your password is secure enough that it can't be guessed, but easy for you to remember, and don't put any personal information in your account."); - page3.BringToFront(); - break; - case 3: - if (string.IsNullOrEmpty(txtnewusername.Text)) - { - TextType("You must specify a valid username!"); - currentPage--; - //SetupUI(); - break; - } - - if (string.IsNullOrEmpty(txtnewpassword.Text)) - { - TextType("A password would seriously be recommended."); - currentPage--; - //SetupUI(); - break; - } - - if (string.IsNullOrEmpty(txtnewsysname.Text)) - { - TextType("You must name your computer."); - currentPage--; - //SetupUI(); - break; - } - - - MUDUserFound = (val) => - { - if(val == true) - { - TextType("I have just verified that your username and password already exists on my end. Please choose another."); - currentPage--; - //SetupUI(); - - } - else - { - TextType("I am going to keep that info on my checklist for installing ShiftOS on your system. Now, onto some legal stuff. I highly suggest you read this."); - currentPage++; - oobe.MySave.Username = txtnewusername.Text; - oobe.MySave.Password = txtnewpassword.Text; - oobe.MySave.SystemName = txtnewsysname.Text; - SetupUI(); - } - }; - ServerManager.SendMessage("mud_checkuserexists", $@"{{ - username: ""{txtnewusername.Text}"", - password: ""{txtnewpassword.Text}"" -}}"); - break; - case 4: - page4.BringToFront(); - txtlicenseagreement.Rtf = Properties.Resources.ShiftOS; - break; - case 5: - CanClose = true; - this.Close(); - break; - case 7: - btnnext.Show(); - btnback.Hide(); - pgrereg.BringToFront(); - TextType("You have two choices - either you can migrate your local user file to this multi-user domain, or you can restart with 0 Codepoints, no upgrades, and still keep your files."); - break; - case 8: - btnnext.Hide(); - ServerMessageReceived rc = null; - - rc = (msg) => - { - if(msg.Name == "mud_found") - { - TextType("That username and password already exists in this multi-user domain. Please choose another."); - currentPage = 7; - } - else if(msg.Name == "mud_notfound") - { - currentPage = 9; - SetupUI(); - } - ServerManager.MessageReceived -= rc; - }; - - if (string.IsNullOrEmpty(txtruname.Text)) - { - TextType("You must provide a username."); - currentPage = 7; - } - - if (string.IsNullOrEmpty(txtrpass.Text)) - { - TextType("You must provide a password."); - currentPage = 7; - } - - if (string.IsNullOrEmpty(txtrsys.Text)) - { - TextType("You must provide a system hostname."); - currentPage = 7; - } - - if (currentPage == 7) - return; - - ServerManager.MessageReceived += rc; - ServerManager.SendMessage("mud_checkuserexists", $@"{{ - username: ""{txtruname.Text}"", - password: ""{txtrpass.Text}"" -}}"); - break; - case 9: - UserReregistered?.Invoke(txtruname.Text, txtrpass.Text, txtrsys.Text); - this.CanClose = true; - this.Close(); - break; - case 10: - btnnext.Show(); - btnback.Hide(); - pglogin.BringToFront(); - break; - case 11: - btnnext.Hide(); - ServerMessageReceived login = null; - - login = (msg) => - { - if (msg.Name == "mud_found") - { - this.Invoke(new Action(() => - { - currentPage = 12; - SetupUI(); - })); - - ServerManager.MessageReceived -= login; - } - else if (msg.Name == "mud_notfound") - { - this.Invoke(new Action(() => - { - currentPage = 10; - SetupUI(); - })); - - ServerManager.MessageReceived -= login; - } - }; - - ServerManager.MessageReceived += login; - if(!string.IsNullOrWhiteSpace(txtluser.Text) && !string.IsNullOrWhiteSpace(txtlpass.Text)) - { - ServerManager.SendMessage("mud_checkuserexists", JsonConvert.SerializeObject(new - { - username = txtluser.Text, - password = txtlpass.Text - })); - } - break; - case 12: - btnnext.Hide(); - ServerMessageReceived getsave = null; - - getsave = (msg) => - { - if (msg.Name == "mud_savefile") - { - this.Invoke(new Action(() => - { - SaveSystem.CurrentSave = JsonConvert.DeserializeObject(msg.Contents); - SaveSystem.SaveGame(); - CreateNewSave = false; - DoneLoggingIn?.Invoke(); - this.CanClose = true; - this.Close(); - - })); - } - else if (msg.Name == "mud_notfound") - { - this.Invoke(new Action(() => - { - currentPage = 10; - SetupUI(); - })); - } - ServerManager.MessageReceived -= getsave; - }; - - ServerManager.MessageReceived += getsave; - - ServerManager.SendMessage("mud_login", JsonConvert.SerializeObject(new - { - username = txtluser.Text, - password = txtlpass.Text - })); - - break; - } - } - - public event Action DoneLoggingIn; - - public bool CreateNewSave = true; - - public event Action UserReregistered; - - public void StartWipingInBackground(long arbitraryAmountOfBytes) - { - pgformatprogress.Maximum = (int)arbitraryAmountOfBytes; - var t = new Thread(() => - { - for(long i = 0; i <= arbitraryAmountOfBytes; i++) - { - Thread.Sleep(40); - this.Invoke(new Action(() => - { - pgformatprogress.Value = (int)i; - lbbyteszeroed.Text = $"Gigabytes zeroed: {i}/{arbitraryAmountOfBytes}"; - })); - } - this.Invoke(new Action(() => - { - currentPage++; - SetupUI(); - })); - }); - t.IsBackground = true; - t.Start(); - } - - - - private void TextType(string text) - { - new Thread(() => - { - while(isTyping == true) - { - - } - isTyping = true; - TextSent?.Invoke(text); - isTyping = false; - }).Start(); - } - - bool CanClose = false; - - private void FakeSetupScreen_FormClosing(object sender, FormClosingEventArgs e) - { - if (CanClose) - { - - } - else - { - e.Cancel = true; - TextType("Don't try to close the dialog. It's a futile attempt."); - } - } - - private void btnback_Click(object sender, EventArgs e) - { - currentPage--; - SetupUI(); - } - - private void btnnext_Click(object sender, EventArgs e) - { - currentPage++; - SetupUI(); - } - - private void button1_Click(object sender, EventArgs e) - { - ShiftOS.Objects.ShiftFS.Utils.Delete(Paths.GetPath("user.dat")); - System.IO.File.WriteAllText(Paths.SaveFile, ShiftOS.Objects.ShiftFS.Utils.ExportMount(0)); - SaveSystem.NewSave(); - this.CanClose = true; - this.Close(); - } - - private void btnnlogin_Click(object sender, EventArgs e) - { - currentPage = 10; - SetupUI(); - } - } -} diff --git a/ShiftOS.WinForms/FakeSetupScreen.resx b/ShiftOS.WinForms/FakeSetupScreen.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShiftOS.WinForms/FakeSetupScreen.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 54a022c..a4d63e0 100644 --- a/ShiftOS.WinForms/Oobe.cs +++ b/ShiftOS.WinForms/Oobe.cs @@ -185,39 +185,7 @@ You must join the digital society, rise up the ranks, and save us. public void ShowSaveTransfer(Save save) { - this.Show(); - var fSetup = new FakeSetupScreen(this, 7); - - var t = new Thread(() => - { - textgeninput = lblhackwords; - Clear(); - TextType("Welcome back to ShiftOS."); - Thread.Sleep(500); - TextType("Since your last time inside ShiftOS, the operating system has changed. Your user account is no longer stored on your local system."); - Thread.Sleep(500); - this.Invoke(new Action(() => - { - //UPS is drunky heaven over here... it's a liquor store, I think... - Drunk Michael - fSetup.UserReregistered += (u, p, s) => - { - save.Username = u; - save.Password = p; - save.SystemName = s; - SaveSystem.CurrentSave = save; - SaveSystem.CurrentSave.Upgrades = new Dictionary(); - Shiftorium.Init(); - - SaveSystem.SaveGame(); - if(Utils.FileExists(Paths.SaveFileInner)) - Utils.Delete(Paths.SaveFileInner); - this.Close(); - }; - fSetup.Show(); - })); - }); - t.IsBackground = true; - t.Start(); + //Stub. } public void PerformUniteLogin() diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index 1d4e91a..9fc237f 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -316,12 +316,6 @@ DownloadControl.cs - - Form - - - FakeSetupScreen.cs - @@ -517,9 +511,6 @@ DownloadControl.cs - - FakeSetupScreen.cs - Oobe.cs diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index d7c5196..6825f34 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -52,7 +52,6 @@ namespace ShiftOS.WinForms public List Widgets = new List(); - private bool InScreensaver = false; private int millisecondsUntilScreensaver = 300000; /// @@ -231,13 +230,11 @@ namespace ShiftOS.WinForms if(millisecondsUntilScreensaver <= 0) { ShowScreensaver(); - InScreensaver = true; } millisecondsUntilScreensaver--; Thread.Sleep(1); } millisecondsUntilScreensaver = 300000; - InScreensaver = false; HideScreensaver(); } }); @@ -990,7 +987,7 @@ namespace ShiftOS.WinForms { if (Shiftorium.UpgradeInstalled("advanced_app_launcher")) { - lbalstatus.Text = $@"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName} + lbalstatus.Text = $@"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName} {SaveSystem.CurrentSave.Codepoints} Codepoints {Shiftorium.GetAvailable().Length} available, {SaveSystem.CurrentSave.CountUpgrades()} installed."; diff --git a/ShiftOS_TheReturn/CommandParser.cs b/ShiftOS_TheReturn/CommandParser.cs index 7a190df..868d27a 100644 --- a/ShiftOS_TheReturn/CommandParser.cs +++ b/ShiftOS_TheReturn/CommandParser.cs @@ -98,8 +98,6 @@ namespace ShiftOS.Engine int firstValuePos = -1; int lastValuePos = -1; - string syntaxError = ""; - for (int ii = 0; ii < parts.Count; ii++) { CommandFormat part = parts[ii]; @@ -184,7 +182,6 @@ namespace ShiftOS.Engine else { position = text.Length; - syntaxError = "Syntax Error"; command = "+FALSE+"; } help = -1; diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index 7980635..87aacd6 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -73,7 +73,7 @@ namespace ShiftOS.Engine TerminalBackend.IsForwardingConsoleWrites = forwarding; TerminalBackend.ForwardGUID = (forwarding == true) ? fGuid : null; string resultFriendly = (result == true) ? "yes" : "no"; - Console.WriteLine($"{SaveSystem.CurrentSave.Username} says {resultFriendly}."); + Console.WriteLine($"{SaveSystem.CurrentUser.Username} says {resultFriendly}."); TerminalBackend.IsForwardingConsoleWrites = false; }; Desktop.InvokeOnWorkerThread(new Action(() => -- cgit v1.2.3 From c18c0fbc325b1c6a0864f88c6e2f4d2889d62e18 Mon Sep 17 00:00:00 2001 From: Michael Date: Fri, 12 May 2017 20:32:28 -0400 Subject: dithering revamp --- ShiftOS.WinForms/Applications/Shifter.cs | 5 +- ShiftOS.WinForms/Program.cs | 1 + ShiftOS.WinForms/Tools/DitheringEngine.cs | 195 +++++++++++++----------------- ShiftOS.WinForms/WinformsDesktop.cs | 5 +- ShiftOS_TheReturn/Commands.cs | 17 +++ ShiftOS_TheReturn/Skinning.cs | 19 +++ 6 files changed, 123 insertions(+), 119 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 05ba638..edc3703 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -139,10 +139,7 @@ namespace ShiftOS.WinForms.Applications pnldesktoppreview.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); //Not doing this will cause an ArgumentException. - DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) => - { - pnldesktoppreview.BackgroundImage = img; - })); + pnldesktoppreview.BackgroundImage = SkinEngine.GetImage("desktopbackground"); pnldesktoppreview.BackgroundImageLayout = GetImageLayout("desktopbackground"); desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; diff --git a/ShiftOS.WinForms/Program.cs b/ShiftOS.WinForms/Program.cs index 256894d..73215d4 100644 --- a/ShiftOS.WinForms/Program.cs +++ b/ShiftOS.WinForms/Program.cs @@ -49,6 +49,7 @@ 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 + SkinEngine.SetPostProcessor(new DitheringSkinPostProcessor()); SaveSystem.PreDigitalSocietyConnection += () => { Action completed = null; diff --git a/ShiftOS.WinForms/Tools/DitheringEngine.cs b/ShiftOS.WinForms/Tools/DitheringEngine.cs index 8509a0b..f96a45a 100644 --- a/ShiftOS.WinForms/Tools/DitheringEngine.cs +++ b/ShiftOS.WinForms/Tools/DitheringEngine.cs @@ -33,6 +33,7 @@ using System.Drawing; using System.Threading; using ShiftOS.Engine; using System.Runtime.InteropServices; +using System.IO; namespace ShiftOS.WinForms.Tools { @@ -101,7 +102,7 @@ namespace ShiftOS.WinForms.Tools } } - public static void DitherColor(Color source, int width, int height, Action result) + public static Image DitherColor(Color source, int width, int height) { var bmp = new Bitmap(width + 1, height + 1); var data = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); @@ -115,7 +116,7 @@ namespace ShiftOS.WinForms.Tools } Marshal.Copy(rgb, 0, data.Scan0, rgb.Length); bmp.UnlockBits(data); - DitherImage(bmp, result); + return DitherImage(bmp); } @@ -226,15 +227,8 @@ namespace ShiftOS.WinForms.Tools #endif #if FLOYDSTEINBERG - public static void DitherImage(Image source, Action result) + public static Image DitherImage(Image source) { - if (source == null) - { - result?.Invoke(source); - return; - } - - var bmp = new Bitmap(source.Width, source.Height); var sourceBmp = (Bitmap)source; var sourceLck = sourceBmp.LockBits(new Rectangle(0, 0, sourceBmp.Width, sourceBmp.Height), System.Drawing.Imaging.ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format24bppRgb); @@ -267,121 +261,80 @@ namespace ShiftOS.WinForms.Tools bool color_depth_floydsteinberg = Shiftorium.UpgradeInstalled("color_depth_floyd-steinberg_dithering"); bool dithering = Shiftorium.UpgradeInstalled("color_depth_dithering"); - for (int y = 0; y < (destLck.Height); y++) + if (!sixteenBits) { - for (int x = 0; x < (Math.Abs(destLck.Stride)); x += 3) + if (dithering == true) { - int i = getIndexFromXY(x, y, width); - byte red = sourceArr[i]; - byte green = sourceArr[i + 1]; - byte blue = sourceArr[i + 2]; - - Color oldc = Color.FromArgb(red, green, blue); - Color newc; - - if (sixteenBits) + if (false == true) { - newc = GetColor(oldc); + } else { - int gray = ((oldc.R + oldc.G + oldc.B) / 3); - - byte newgray = 0; - - if (dithering && !color_depth_floydsteinberg) - gray += error_r; - - - - if (eightBits) + int error = 0; + for (int i = 0; i < destArr.Length; i += 3) { - newgray = (byte)gray; - error_r = 0; - } - else if(sixBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0x3F) * 3); - error_r = newgray - gray; - } - else if (fourBits) - { - newgray = (byte)(linear(gray, 0, 0xFF, 0, 0xF) * 0xF); - error_r = newgray - gray; - } - else if (twoBits) - { - if (gray >= 191) - newgray = 0xFF; - else if (gray >= 127) - newgray = Color.LightGray.R; - else if (gray >= 64) - newgray = Color.DarkGray.R; - else - newgray = 0x00; - error_r = newgray - gray; - } - else - { - if (gray >= 127) - newgray = 0xFF; - else - newgray = 0x00; - error_r = newgray - gray; - } - newc = Color.FromArgb(newgray, newgray, newgray); - } + byte r = sourceArr[i]; + byte g = sourceArr[i + 1]; + byte b = sourceArr[i + 2]; - int nextIndex = getIndexFromXY(x + 3, y, width); - int nextRow = getIndexFromXY(x, y + 1, width); - int nextIndexOnNextRow = getIndexFromXY(x + 3, y + 1, width); - int prevIndexOnNextRow = getIndexFromXY(x - 3, y + 1, width); - - grays[i] = newc.R; - grays[i + 1] = newc.G; - grays[i + 2] = newc.B; - - if (dithering) - { - if (color_depth_floydsteinberg) - { - if (x + 3 < width) + int gray = (((r + g + b) / 3) + error); + int newgray = gray; + if (!eightBits) { - sourceArr[nextIndex] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 1] += (byte)((error_r * 7) / 16); - sourceArr[nextIndex + 2] += (byte)((error_r * 7) / 16); - } - if (y + 1 < height) - { - sourceArr[nextRow] += (byte)((error_r) / 16); - sourceArr[nextRow + 1] += (byte)((error_r) / 16); - sourceArr[nextRow + 2] += (byte)((error_r) / 16); - } - if (x + 3 < width && y + 1 < height) - { - sourceArr[nextIndexOnNextRow] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 1] += (byte)((error_r * 3) / 16); - sourceArr[nextIndexOnNextRow + 2] += (byte)((error_r * 3) / 16); - + if (sixBits) + { + newgray = gray >> 2; + } + else + { + if (fourBits) + { + newgray = (int)linear(gray, 0, 255, 0, 63) * 4; + } + else + { + if (twoBits) + { + if (gray > 127 + 63) + { + newgray = 255; + } + else if (gray > 127) + newgray = 127 + 63; + else if (gray > 63) + { + newgray = 127; + } + else if (gray > 0) + newgray = 63; + else + newgray = 0; + } + else + { + if (gray > 127) + newgray = 255; + else + newgray = 0; + } + } + } } - if (x - 3 > 0 && y + 1 < height) - { - sourceArr[prevIndexOnNextRow] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 1] += (byte)((error_r * 5) / 16); - sourceArr[prevIndexOnNextRow + 2] += (byte)((error_r * 5) / 16); + if (newgray > 255) + newgray = 255; + if (newgray < 0) + newgray = 0; + error = gray - newgray; + destArr[i] = (byte)newgray; + destArr[i+1] = (byte)newgray; + destArr[i+2] = (byte)newgray; - } } } } } - for (int i = 0; i < destArr.Length - 3; i++) - { - destArr[i] = grays[i]; - - } - Marshal.Copy(destArr, 0, destPtr, destBytes); @@ -389,8 +342,7 @@ namespace ShiftOS.WinForms.Tools - Desktop.InvokeOnWorkerThread(new Action(() => { result?.Invoke(bmp); })); - + return bmp; } #endif @@ -399,4 +351,25 @@ namespace ShiftOS.WinForms.Tools return (width * y) + x; } } + + public class DitheringSkinPostProcessor : ISkinPostProcessor + { + public byte[] ProcessImage(byte[] original) + { + try + { + var img = SkinEngine.ImageFromBinary(original); + var dithered = DitheringEngine.DitherImage(img); + using (var mstr = new MemoryStream()) + { + dithered.Save(mstr, System.Drawing.Imaging.ImageFormat.Bmp); + return mstr.ToArray(); + } + } + catch + { + return original; + } + } + } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 6825f34..4efef1b 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -390,10 +390,7 @@ namespace ShiftOS.WinForms this.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B); //Not doing this will cause an ArgumentException. - DitheringEngine.DitherImage(SkinEngine.GetImage("desktopbackground"), new Action((img) => - { - this.BackgroundImage = img; - })); + this.BackgroundImage = SkinEngine.GetImage("desktopbackground"); this.BackgroundImageLayout = GetImageLayout("desktopbackground"); desktoppanel.BackColor = LoadedSkin.DesktopPanelColor; diff --git a/ShiftOS_TheReturn/Commands.cs b/ShiftOS_TheReturn/Commands.cs index d622bb9..5b7674a 100644 --- a/ShiftOS_TheReturn/Commands.cs +++ b/ShiftOS_TheReturn/Commands.cs @@ -233,6 +233,23 @@ namespace ShiftOS.Engine [Namespace("dev")] public static class ShiftOSDevCommands { + [Command("buy")] + public static bool UnlockUpgrade(Dictionary args) + { + string upg = args["id"].ToString(); + try + { + SaveSystem.CurrentSave.Upgrades[upg] = true; + Shiftorium.InvokeUpgradeInstalled(); + SaveSystem.SaveGame(); + } + catch + { + Console.WriteLine("Upgrade not found."); + } + return true; + } + [Command("rock", description = "A little surprise for unstable builds...")] public static bool ThrowASandwichingRock() { diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs index b731c4f..548e80f 100644 --- a/ShiftOS_TheReturn/Skinning.cs +++ b/ShiftOS_TheReturn/Skinning.cs @@ -66,6 +66,13 @@ namespace ShiftOS.Engine public static class SkinEngine { + private static ISkinPostProcessor processor = null; + + public static void SetPostProcessor(ISkinPostProcessor _processor) + { + processor = _processor; + } + public static ImageLayout GetImageLayout(string img) { if (LoadedSkin.SkinImageLayouts.ContainsKey(img)) @@ -93,6 +100,8 @@ namespace ShiftOS.Engine if (iattr.Name == img) { byte[] image = (byte[])field.GetValue(LoadedSkin); + if (processor != null) + image = processor.ProcessImage(image); return ImageFromBinary(image); } } @@ -1323,6 +1332,16 @@ namespace ShiftOS.Engine public string Category { get; set; } } + public interface ISkinPostProcessor + { + /// + /// Perform algorithmic operations at the bit level on a ShiftOS skin image. + /// + /// The image, as loaded by the engine, as a 32-bit ARGB byte array. + /// The processed image. + byte[] ProcessImage(byte[] original); + } + public class ShifterMetaAttribute : Attribute { -- 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/WinformsDesktop.cs') 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 e841b168e13e0bd699c0e0d19857167aa725f1ca Mon Sep 17 00:00:00 2001 From: Michael Date: Sat, 27 May 2017 16:59:54 -0400 Subject: stuff --- ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Controls/TerminalBox.cs | 11 ++++--- ShiftOS.WinForms/Stories/LegionStory.cs | 9 +----- ShiftOS.WinForms/WinformsDesktop.cs | 49 ++++++++++++++++++-------------- ShiftOS_TheReturn/AppearanceManager.cs | 2 +- 5 files changed, 35 insertions(+), 37 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index e150b1a..f9e601f 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -186,6 +186,7 @@ namespace ShiftOS.WinForms.Applications SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server."); Thread.Sleep(2500); SendMessage(ch, ch, "Good luck... My life depends on you!"); + complete = true; }); t.IsBackground = true; t.Start(); diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs index a6dd610..7658c8c 100644 --- a/ShiftOS.WinForms/Controls/TerminalBox.cs +++ b/ShiftOS.WinForms/Controls/TerminalBox.cs @@ -63,15 +63,12 @@ namespace ShiftOS.WinForms.Controls public void Write(string text) { - Thread.Sleep(5); - this.SuspendLayout(); this.HideSelection = true; this.SelectionFont = ConstructFont(); this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor); this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text)); this.HideSelection = false; - this.ResumeLayout(); } private Font ConstructFont() @@ -89,8 +86,6 @@ namespace ShiftOS.WinForms.Controls public void WriteLine(string text) { - Thread.Sleep(5); - this.SuspendLayout(); Engine.AudioManager.PlayStream(Properties.Resources.writesound); this.HideSelection = true; this.Select(this.TextLength, 0); @@ -99,11 +94,12 @@ namespace ShiftOS.WinForms.Controls this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor); this.AppendText(Localization.Parse(text) + Environment.NewLine); this.HideSelection = false; - this.ResumeLayout(); } bool quickCopying = false; + bool busy = false; + protected override void OnMouseDown(MouseEventArgs e) { //if right-clicking, then we initiate a quick-copy. @@ -255,8 +251,11 @@ namespace ShiftOS.WinForms.Controls } } + public string ThreadId = ""; + public TerminalBox() : base() { + ThreadId = Thread.CurrentThread.ManagedThreadId.ToString(); this.Tag = "keepbg keepfg keepfont"; } } diff --git a/ShiftOS.WinForms/Stories/LegionStory.cs b/ShiftOS.WinForms/Stories/LegionStory.cs index 9b4966f..53d55fb 100644 --- a/ShiftOS.WinForms/Stories/LegionStory.cs +++ b/ShiftOS.WinForms/Stories/LegionStory.cs @@ -92,14 +92,7 @@ namespace ShiftOS.WinForms.Stories ConsoleEx.ForegroundColor = ConsoleColor.Gray; ConsoleEx.Bold = false; - foreach (var c in text) - { - Desktop.InvokeOnWorkerThread(() => - { - Console.Write(c); - }); - Thread.Sleep(75); - } + Console.WriteLine(text); Thread.Sleep(1000); } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 15ecb7a..6ce8cc9 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -188,14 +188,40 @@ namespace ShiftOS.WinForms widget.OnSkinLoad(); } + SetupDesktop(); }; + + long lastcp = 0; + + var storythread = new Thread(() => + { + do + { + if (SaveSystem.CurrentSave != null) + { + if (SaveSystem.CurrentSave.Codepoints != lastcp) + lastcp = SaveSystem.CurrentSave.Codepoints; + if (lastcp >= 10000) + { + if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) + { + Story.Start("victortran_shiftnet"); + } + } + } + } while (!SaveSystem.ShuttingDown); + }); + storythread.IsBackground = true; + storythread.Start(); + time.Tick += (o, a) => { if (Shiftorium.IsInitiated == true) { - if (SaveSystem.CurrentSave != null && TutorialManager.IsInTutorial == false) + if (SaveSystem.CurrentSave != null) { + lbtime.Text = Applications.Terminal.GetTime(); lbtime.Left = pnlnotifications.Width - lbtime.Width - LoadedSkin.DesktopPanelClockFromRight.X; lbtime.Top = LoadedSkin.DesktopPanelClockFromRight.Y; @@ -230,27 +256,6 @@ namespace ShiftOS.WinForms }; time.Start(); - var ssThread = new Thread(() => - { - while(this.Visible == true) - { - var mousePos = Cursor.Position; - while(Cursor.Position == mousePos) - { - if(millisecondsUntilScreensaver <= 0) - { - ShowScreensaver(); - } - millisecondsUntilScreensaver--; - Thread.Sleep(1); - } - millisecondsUntilScreensaver = 300000; - HideScreensaver(); - } - }); - ssThread.IsBackground = true; - ssThread.Start(); - this.DoubleBuffered = true; } diff --git a/ShiftOS_TheReturn/AppearanceManager.cs b/ShiftOS_TheReturn/AppearanceManager.cs index 81858d3..7cf06c9 100644 --- a/ShiftOS_TheReturn/AppearanceManager.cs +++ b/ShiftOS_TheReturn/AppearanceManager.cs @@ -190,7 +190,7 @@ namespace ShiftOS.Engine ServerManager.Disconnect(); Desktop.InvokeOnWorkerThread(() => { - Environment.Exit(0); //bye bye + Process.GetCurrentProcess().Kill(); //bye bye }); } -- cgit v1.2.3 From 03ebdf42d9f12b678d48f954736664f6f3eb1f84 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 28 May 2017 12:40:06 -0400 Subject: Funny, disabling localization makes things easier... --- ShiftOS.WinForms/Applications/Chat.cs | 1 + ShiftOS.WinForms/Applications/Terminal.cs | 6 +- ShiftOS.WinForms/Resources/Shiftorium.txt | 5 +- ShiftOS.WinForms/Tools/ControlManager.cs | 139 +++++++++++------------------- ShiftOS.WinForms/WinformsDesktop.cs | 10 ++- ShiftOS_TheReturn/Localization.cs | 45 +--------- ShiftOS_TheReturn/TerminalTextWriter.cs | 1 + 7 files changed, 72 insertions(+), 135 deletions(-) (limited to 'ShiftOS.WinForms/WinformsDesktop.cs') diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs index f9e601f..7a2de81 100644 --- a/ShiftOS.WinForms/Applications/Chat.cs +++ b/ShiftOS.WinForms/Applications/Chat.cs @@ -41,6 +41,7 @@ namespace ShiftOS.WinForms.Applications [WinOpen("simplesrc")] [Launcher("SimpleSRC Client", false, null, "Networking")] [DefaultTitle("SimpleSRC Client")] + [AppscapeEntry("SimpleSRC", "A simple ShiftOS Relay Chat client that allows you to talk with other ShiftOS users from all over the world.", 300, 145, "file_skimmer", "Networking")] public partial class Chat : UserControl, IShiftOSWindow { public Chat() diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index bfc4425..3d17d35 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -504,11 +504,11 @@ namespace ShiftOS.WinForms.Applications Thread.Sleep(2000); Console.WriteLine("As you know, ShiftOS doesn't have very many features."); Thread.Sleep(2000); - Console.WriteLine("Using the applications you have, I need you to earn 50,000 Codepoints."); + Console.WriteLine("Using the applications you have, I need you to earn as many Codepoints as you can."); Thread.Sleep(2000); - Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn Codepoints."); + Console.WriteLine("You can use the Codepoints you earn to buy new applications and features in the Shiftorium, to help earn even more Codepoints."); Thread.Sleep(2000); - Console.WriteLine("Start small, try to earn 500. Once you do, I'll contact you with more details."); + Console.WriteLine("Once you earn 1,000 Codepoints, I will check back with you and see how well you've done."); Thread.Sleep(2000); Console.WriteLine("I'll leave you to it, you've got the hang of it! One last thing, if ever you find yourself in another program, and want to exit, simply press CTRL+T to return to the Terminal."); Thread.Sleep(2000); diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 41b50a7..0eac58e 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -283,7 +283,7 @@ Name: "AL Widget Manager", Cost: 125, Description: "Desktop Widgets are a huge advancement in ShiftOS technology, allowing access to system information, and quick control of your system, without even opening a window. However, we still need to be able to modify each widget. This upgrade adds an App Launcher entry for the Desktop Widget Manager.", - Description: "app_launcher;desktop_widgets", + Dependencies: "app_launcher;desktop_widgets", Category: "GUI" }, { @@ -704,7 +704,8 @@ Name: "Artpad", Cost: 7500, Category: "Applications", - Description: "ArtPad is a very extensible tool that allows you to draw images within ShiftOS. Buy this upgrade to gain access to it through win.open{}!" + Description: "ArtPad is a very extensible tool that allows you to draw images within ShiftOS. Buy this upgrade to gain access to it through win.open{}!", + Dependencies: "color_depth_8_bits" }, { Name: "AL Artpad", diff --git a/ShiftOS.WinForms/Tools/ControlManager.cs b/ShiftOS.WinForms/Tools/ControlManager.cs index 1643b23..83ab7fe 100644 --- a/ShiftOS.WinForms/Tools/ControlManager.cs +++ b/ShiftOS.WinForms/Tools/ControlManager.cs @@ -1,3 +1,5 @@ +#define SLOW_LOCALIZATION + /* * MIT License * @@ -144,77 +146,66 @@ namespace ShiftOS.WinForms.Tools public static void SetupControl(Control ctrl) { - - if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) + Desktop.InvokeOnWorkerThread(() => { - string tag = ""; - - try + if (!(ctrl is MenuStrip) && !(ctrl is ToolStrip) && !(ctrl is StatusStrip) && !(ctrl is ContextMenuStrip)) { - if(ctrl.Tag != null) - tag = ctrl.Tag.ToString(); - } - catch { } + string tag = ""; - if (!tag.Contains("keepbg")) - { - if (ctrl.BackColor != Control.DefaultBackColor) + try { - Desktop.InvokeOnWorkerThread(() => + if (ctrl.Tag != null) + tag = ctrl.Tag.ToString(); + } + catch { } + + if (!tag.Contains("keepbg")) + { + if (ctrl.BackColor != Control.DefaultBackColor) { ctrl.BackColor = SkinEngine.LoadedSkin.ControlColor; - }); + } } - } - if (!tag.Contains("keepfont")) - { - Desktop.InvokeOnWorkerThread(() => + if (!tag.Contains("keepfont")) { ctrl.ForeColor = SkinEngine.LoadedSkin.ControlTextColor; ctrl.Font = SkinEngine.LoadedSkin.MainFont; - }); - if (tag.Contains("header1")) - { - Desktop.InvokeOnWorkerThread(() => + if (tag.Contains("header1")) { - ctrl.Font = SkinEngine.LoadedSkin.HeaderFont; - }); - } + Desktop.InvokeOnWorkerThread(() => + { + ctrl.Font = SkinEngine.LoadedSkin.HeaderFont; + }); + } - if (tag.Contains("header2")) - { - Desktop.InvokeOnWorkerThread(() => + if (tag.Contains("header2")) { ctrl.Font = SkinEngine.LoadedSkin.Header2Font; - }); - } + } - if (tag.Contains("header3")) - { - Desktop.InvokeOnWorkerThread(() => + if (tag.Contains("header3")) { ctrl.Font = SkinEngine.LoadedSkin.Header3Font; - }); + } } - } - try - { - string ctrlText = Localization.Parse(ctrl.Text); - Desktop.InvokeOnWorkerThread(() => + try + { +#if !SLOW_LOCALIZATION + if (!string.IsNullOrWhiteSpace(ctrl.Text)) + { + string ctrlText = Localization.Parse(ctrl.Text); + ctrl.Text = ctrlText; + } +#endif + } + catch { - ctrl.Text = ctrlText; - }); - } - catch - { - } + } - if(ctrl is Button) - { - Desktop.InvokeOnWorkerThread(() => + if (ctrl is Button) { Button b = ctrl as Button; if (!b.Tag.ToString().ToLower().Contains("keepbg")) @@ -229,7 +220,7 @@ namespace ShiftOS.WinForms.Tools b.FlatAppearance.BorderColor = SkinEngine.LoadedSkin.ButtonForegroundColor; b.ForeColor = SkinEngine.LoadedSkin.ButtonForegroundColor; } - if(!b.Tag.ToString().ToLower().Contains("keepfont")) + if (!b.Tag.ToString().ToLower().Contains("keepfont")) b.Font = SkinEngine.LoadedSkin.ButtonTextFont; Color orig_bg = b.BackColor; @@ -260,15 +251,12 @@ namespace ShiftOS.WinForms.Tools b.BackgroundImageLayout = SkinEngine.GetImageLayout("buttonpressed"); }; - }); + } } - if(ctrl is TextBox) + if (ctrl is TextBox) { - Desktop.InvokeOnWorkerThread(() => - { - (ctrl as TextBox).BorderStyle = BorderStyle.FixedSingle; - }); + (ctrl as TextBox).BorderStyle = BorderStyle.FixedSingle; } ctrl.KeyDown += (o, a) => @@ -286,27 +274,19 @@ namespace ShiftOS.WinForms.Tools }; if (ctrl is Button) { - Desktop.InvokeOnWorkerThread(() => - { - (ctrl as Button).FlatStyle = FlatStyle.Flat; - }); + (ctrl as Button).FlatStyle = FlatStyle.Flat; } else if (ctrl is WindowBorder) { - Desktop.InvokeOnWorkerThread(() => - { - (ctrl as WindowBorder).Setup(); - }); + (ctrl as WindowBorder).Setup(); } - } - Desktop.InvokeOnWorkerThread(() => - { - MakeDoubleBuffered(ctrl); + ControlSetup?.Invoke(ctrl); }); - ControlSetup?.Invoke(ctrl); } + + public static event Action ControlSetup; public static void MakeDoubleBuffered(Control c) @@ -330,27 +310,12 @@ namespace ShiftOS.WinForms.Tools { Desktop.HideAppLauncher(); }; - ThreadStart ts = () => - { - var ctrls = frm.Controls.ToList(); - for (int i = 0; i < ctrls.Count(); i++) - { - SetupControls(ctrls[i]); - } - SetupControl(frm); - - }; - - if (runInThread == true) - { - var t = new Thread(ts); - t.IsBackground = true; - t.Start(); - } - else + var ctrls = frm.Controls.ToList(); + for (int i = 0; i < ctrls.Count(); i++) { - ts?.Invoke(); + SetupControls(ctrls[i]); } + SetupControl(frm); } } diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs index 6ce8cc9..85eab55 100644 --- a/ShiftOS.WinForms/WinformsDesktop.cs +++ b/ShiftOS.WinForms/WinformsDesktop.cs @@ -202,13 +202,21 @@ namespace ShiftOS.WinForms { if (SaveSystem.CurrentSave.Codepoints != lastcp) lastcp = SaveSystem.CurrentSave.Codepoints; - if (lastcp >= 10000) + if (lastcp >= 2500) { if (!Shiftorium.UpgradeInstalled("victortran_shiftnet")) { Story.Start("victortran_shiftnet"); } } + if(lastcp >= 5000) + { + if(Shiftorium.UpgradeInstalled("triwrite") && Shiftorium.UpgradeInstalled("simplesrc") && Shiftorium.UpgradeInstalled("victortran_shiftnet") && Shiftorium.UpgradeInstalled("story_hacker101_breakingthebonds")) + { + if (!Shiftorium.UpgradeInstalled("story_thefennfamily")) + Story.Start("story_thefennfamily"); + } + } } } while (!SaveSystem.ShuttingDown); }); diff --git a/ShiftOS_TheReturn/Localization.cs b/ShiftOS_TheReturn/Localization.cs index 5d848b0..c542c2a 100644 --- a/ShiftOS_TheReturn/Localization.cs +++ b/ShiftOS_TheReturn/Localization.cs @@ -111,50 +111,11 @@ namespace ShiftOS.Engine localizationStrings = JsonConvert.DeserializeObject>(Utils.ReadAllText(Paths.GetPath("english.local"))); //if no provider fall back to english } - foreach (var kv in localizationStrings) + foreach (var kv in localizationStrings.Where(x=>original.Contains(x.Key))) { original = original.Replace(kv.Key, kv.Value); // goes through and replaces all the localization blocks } - List orphaned = new List(); - - - int start_index = 0; - int length = 0; - bool indexing = false; - - foreach (var c in original) - { - // start paying attenion when you see a "{" - if (c == '{') - { - start_index = original.IndexOf(c); - indexing = true; - } - - if (indexing == true) - { - // stop paying attention when you see a "}" after seeing a "{" - length++; - if (c == '}') - { - indexing = false; - string o = original.Substring(start_index, length); - if (!orphaned.Contains(o)) - { - orphaned.Add(o); - } - start_index = 0; - length = 0; - } - } - } - - if (orphaned.Count > 0) - { - Utils.WriteAllText("0:/dev_orphaned_lang.txt", JsonConvert.SerializeObject(orphaned, Formatting.Indented)); //format if from this txt file - } - //string original2 = Parse(original); string usernameReplace = ""; @@ -203,13 +164,13 @@ namespace ShiftOS.Engine }; // actually do the replacement - foreach (KeyValuePair replacement in replace) + foreach (KeyValuePair replacement in replace.Where(x => original.Contains(x.Key))) { original = original.Replace(replacement.Key, Parse(replacement.Value)); } // do the replacement but default - foreach (KeyValuePair replacement in defaultReplace) + foreach (KeyValuePair replacement in defaultReplace.Where(x => original.Contains(x.Key))) { original = original.Replace(replacement.Key, replacement.Value); } diff --git a/ShiftOS_TheReturn/TerminalTextWriter.cs b/ShiftOS_TheReturn/TerminalTextWriter.cs index 4c0c3a0..63e88eb 100644 --- a/ShiftOS_TheReturn/TerminalTextWriter.cs +++ b/ShiftOS_TheReturn/TerminalTextWriter.cs @@ -42,6 +42,7 @@ namespace ShiftOS.Engine { ConsoleEx.OnFlush = () => { + System.Diagnostics.Debug.WriteLine("[terminal] " + buffer); Desktop.InvokeOnWorkerThread(() => { UnderlyingControl?.Write(buffer); -- cgit v1.2.3