aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/Applications')
-rw-r--r--ShiftOS.WinForms/Applications/About.Designer.cs10
-rw-r--r--ShiftOS.WinForms/Applications/About.cs71
-rw-r--r--ShiftOS.WinForms/Applications/AddressBook.Designer.cs136
-rw-r--r--ShiftOS.WinForms/Applications/AddressBook.cs179
-rw-r--r--ShiftOS.WinForms/Applications/AddressBook.resx130
-rw-r--r--ShiftOS.WinForms/Applications/Artpad.cs372
-rw-r--r--ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs185
-rw-r--r--ShiftOS.WinForms/Applications/AudioPlayer.cs181
-rw-r--r--ShiftOS.WinForms/Applications/AudioPlayer.resx134
-rw-r--r--ShiftOS.WinForms/Applications/Chat.Designer.cs97
-rw-r--r--ShiftOS.WinForms/Applications/Chat.cs151
-rw-r--r--ShiftOS.WinForms/Applications/Dialog.cs24
-rw-r--r--ShiftOS.WinForms/Applications/Downloader.cs25
-rw-r--r--ShiftOS.WinForms/Applications/FileDialog.cs47
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs61
-rw-r--r--ShiftOS.WinForms/Applications/FileSkimmer.cs220
-rw-r--r--ShiftOS.WinForms/Applications/FormatEditor.Designer.cs225
-rw-r--r--ShiftOS.WinForms/Applications/FormatEditor.cs186
-rw-r--r--ShiftOS.WinForms/Applications/FormatEditor.resx120
-rw-r--r--ShiftOS.WinForms/Applications/GraphicPicker.cs4
-rw-r--r--ShiftOS.WinForms/Applications/Installer.Designer.cs157
-rw-r--r--ShiftOS.WinForms/Applications/Installer.cs259
-rw-r--r--ShiftOS.WinForms/Applications/Installer.resx120
-rw-r--r--ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs110
-rw-r--r--ShiftOS.WinForms/Applications/MUDControlCentre.cs85
-rw-r--r--ShiftOS.WinForms/Applications/NameChanger.cs5
-rw-r--r--ShiftOS.WinForms/Applications/Pong.Designer.cs335
-rw-r--r--ShiftOS.WinForms/Applications/Pong.cs731
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLetters.cs8
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs231
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLotto.cs134
-rw-r--r--ShiftOS.WinForms/Applications/ShiftLotto.resx128
-rw-r--r--ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs286
-rw-r--r--ShiftOS.WinForms/Applications/ShiftSweeper.cs534
-rw-r--r--ShiftOS.WinForms/Applications/Shifter.Designer.cs790
-rw-r--r--ShiftOS.WinForms/Applications/Shifter.cs1030
-rw-r--r--ShiftOS.WinForms/Applications/Shifter.resx70
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.Designer.cs30
-rw-r--r--ShiftOS.WinForms/Applications/Shiftnet.cs259
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs143
-rw-r--r--ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs157
-rw-r--r--ShiftOS.WinForms/Applications/Skin Loader.cs33
-rw-r--r--ShiftOS.WinForms/Applications/Terminal.cs290
-rw-r--r--ShiftOS.WinForms/Applications/TriPresent.Designer.cs312
-rw-r--r--ShiftOS.WinForms/Applications/TriPresent.cs91
-rw-r--r--ShiftOS.WinForms/Applications/TriPresent.resx123
-rw-r--r--ShiftOS.WinForms/Applications/TriSheet.Designer.cs65
-rw-r--r--ShiftOS.WinForms/Applications/TriSheet.cs22
-rw-r--r--ShiftOS.WinForms/Applications/TriSheet.resx120
-rw-r--r--ShiftOS.WinForms/Applications/TriWrite.Designer.cs339
-rw-r--r--ShiftOS.WinForms/Applications/TriWrite.cs182
-rw-r--r--ShiftOS.WinForms/Applications/TriWrite.resx242
-rw-r--r--ShiftOS.WinForms/Applications/TutorialBox.Designer.cs57
-rw-r--r--ShiftOS.WinForms/Applications/TutorialBox.cs76
-rw-r--r--ShiftOS.WinForms/Applications/TutorialBox.resx120
-rw-r--r--ShiftOS.WinForms/Applications/UpdateManager.Designer.cs128
-rw-r--r--ShiftOS.WinForms/Applications/UpdateManager.cs279
-rw-r--r--ShiftOS.WinForms/Applications/UpdateManager.resx120
-rw-r--r--ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs166
-rw-r--r--ShiftOS.WinForms/Applications/VideoPlayer.cs132
-rw-r--r--ShiftOS.WinForms/Applications/VideoPlayer.resx134
-rw-r--r--ShiftOS.WinForms/Applications/WebBrowser.Designer.cs153
-rw-r--r--ShiftOS.WinForms/Applications/WebBrowser.cs97
-rw-r--r--ShiftOS.WinForms/Applications/WebBrowser.resx120
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs164
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs131
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx120
67 files changed, 10087 insertions, 1889 deletions
diff --git a/ShiftOS.WinForms/Applications/About.Designer.cs b/ShiftOS.WinForms/Applications/About.Designer.cs
index ab76eab..989d79b 100644
--- a/ShiftOS.WinForms/Applications/About.Designer.cs
+++ b/ShiftOS.WinForms/Applications/About.Designer.cs
@@ -55,7 +55,7 @@ namespace ShiftOS.WinForms.Applications
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.lbshiftit = new System.Windows.Forms.Label();
- this.lbaboutdesc = new System.Windows.Forms.Label();
+ this.lbaboutdesc = new System.Windows.Forms.TextBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
@@ -94,11 +94,11 @@ namespace ShiftOS.WinForms.Applications
this.lbaboutdesc.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.lbaboutdesc.Location = new System.Drawing.Point(14, 126);
+ this.lbaboutdesc.Location = new System.Drawing.Point(23, 158);
+ this.lbaboutdesc.Multiline = true;
this.lbaboutdesc.Name = "lbaboutdesc";
- this.lbaboutdesc.Size = new System.Drawing.Size(498, 328);
+ this.lbaboutdesc.Size = new System.Drawing.Size(492, 302);
this.lbaboutdesc.TabIndex = 3;
- this.lbaboutdesc.Text = "label2";
//
// About
//
@@ -121,6 +121,6 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label lbshiftit;
- private System.Windows.Forms.Label lbaboutdesc;
+ private System.Windows.Forms.TextBox lbaboutdesc;
}
}
diff --git a/ShiftOS.WinForms/Applications/About.cs b/ShiftOS.WinForms/Applications/About.cs
index f91e0cc..a27238d 100644
--- a/ShiftOS.WinForms/Applications/About.cs
+++ b/ShiftOS.WinForms/Applications/About.cs
@@ -53,18 +53,73 @@ namespace ShiftOS.WinForms.Applications
lbaboutdesc.Text = $@"ShiftOS
Copyright (c) 2015-{DateTime.Now.Year} Michael VanOverbeek and ShiftOS devs
-Engine version: Milestone 3, 1.0 Beta Series (Developer mode ON)
-Frontend version: 1.0 Beta 1.2
-Multi-user domain version: 1.0 Rolling-Release
-
-Music courtesy of Selulance. Listen to the Fractal Forest album here:
-https://www.youtube.com/watch?v=LB5jAYDL3VU&t=913s
+Engine version: Milestone 4, 1.0 Beta Series (Developer mode ON)
+Frontend version: 1.0 Beta 2.5
+Digital Society version: 1.0 Rolling-Release
+Project: Unite version: 1.0 Beta 1.7
Special thanks to Philip Adams, the original creator of ShiftOS for helping us grow our community of amazing Shifters by featuring us on the YouTube Millionaire series and advertising us throughout various other series ran by him.
Also, thanks to Rylan Arbour, Victor Tran and the other community moderators and administrators for helping us keep the community peaceful.
-Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game!";
+Lastly, a huge special thanks to the community themselves - for testing, debugging, fixing, reporting bugs for, and enjoying our game even through its many failures, successes, revamps, etc. You guys are the reason we develop the game!
+
+ === Licensing information
+
+ShiftOS is licensed under the MIT license.
+
+Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the ""Software""), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
+copies of the Software, and to permit persons to whom the Software is
+
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+ == Credit where credit is due
+
+ -- Development and staff team:
+ - Rylan Arbour (Lead community administrator)
+ - Victor Tran (Discord administrator)
+ - cjhannah (ShiftFS backend developer)
+ - AShifter (Project: Unite penetration tester)
+ - arencllc (ShiftLetters developer)
+ - Michael VanOverbeek (Lead developer, system administrator, the guy who wrote this text)
+ - fixylol, Nebble, TravisNC, Neptune (Community moderators)
+ - bandic00t_ (Skin Engine stresstesting)
+
+ -- System audio
+
+ - Default system event sounds (Infobox, Network Connecting, System Beeps) are from the original ShiftOS 0.0.x source code.
+ - Ambient music list courtesy of https://www.youtube.com/channel/UC56Qctnsu8wAyvzf4Yx6LIw (ArgoFox | Royalty Free Music)
+
+Tracklist:
+
+ Dylan Hardy - Strangely Unaffected
+Noxive - Home
+Dylan Hardy and Abraham Alberto - Slow Drift
+A Himitsu - Easier To Fade
+Noxive - Resilience
+Wanderflux - Visions
+Aerocity - Cold Weather Kids
+Aether - Wanderlust
+Aerocity - Love Lost
+
+
+Finally, special thanks to our Patreon supporters. Without you guys, our servers wouldn't be running, and you wouldn't be reading this.";
}
public string GetEngineVersion()
@@ -107,7 +162,7 @@ Lastly, a huge special thanks to the community themselves - for testing, debuggi
public bool OnUnload()
{
- return false;
+ return true;
}
public void OnUpgrade()
diff --git a/ShiftOS.WinForms/Applications/AddressBook.Designer.cs b/ShiftOS.WinForms/Applications/AddressBook.Designer.cs
new file mode 100644
index 0000000..afb6b7a
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/AddressBook.Designer.cs
@@ -0,0 +1,136 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class AddressBook
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddressBook));
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tvcontacts = new System.Windows.Forms.TreeView();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.txtbody = new System.Windows.Forms.Label();
+ this.lbtitle = new System.Windows.Forms.Label();
+ this.menuStrip1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addContactToolStripMenuItem,
+ this.removeToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(872, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // addContactToolStripMenuItem
+ //
+ this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem";
+ this.addContactToolStripMenuItem.Size = new System.Drawing.Size(86, 20);
+ this.addContactToolStripMenuItem.Text = "Add Contact";
+ this.addContactToolStripMenuItem.Click += new System.EventHandler(this.addContactToolStripMenuItem_Click);
+ //
+ // removeToolStripMenuItem
+ //
+ this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
+ this.removeToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
+ this.removeToolStripMenuItem.Text = "Remove";
+ this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
+ //
+ // tvcontacts
+ //
+ this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left;
+ this.tvcontacts.Location = new System.Drawing.Point(0, 24);
+ this.tvcontacts.Name = "tvcontacts";
+ this.tvcontacts.Size = new System.Drawing.Size(224, 551);
+ this.tvcontacts.TabIndex = 1;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.txtbody);
+ this.panel1.Controls.Add(this.lbtitle);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(224, 24);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(648, 551);
+ this.panel1.TabIndex = 2;
+ //
+ // txtbody
+ //
+ this.txtbody.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.txtbody.Location = new System.Drawing.Point(7, 54);
+ this.txtbody.Name = "txtbody";
+ this.txtbody.Size = new System.Drawing.Size(626, 481);
+ this.txtbody.TabIndex = 1;
+ this.txtbody.Text = resources.GetString("txtbody.Text");
+ //
+ // lbtitle
+ //
+ this.lbtitle.AutoSize = true;
+ this.lbtitle.Location = new System.Drawing.Point(7, 4);
+ this.lbtitle.Name = "lbtitle";
+ this.lbtitle.Size = new System.Drawing.Size(73, 13);
+ this.lbtitle.TabIndex = 0;
+ this.lbtitle.Tag = "header1";
+ this.lbtitle.Text = "Address Book";
+ //
+ // AddressBook
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.panel1);
+ this.Controls.Add(this.tvcontacts);
+ this.Controls.Add(this.menuStrip1);
+ this.Name = "AddressBook";
+ this.Size = new System.Drawing.Size(872, 575);
+ this.Load += new System.EventHandler(this.AddressBook_Load);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem addContactToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
+ private System.Windows.Forms.TreeView tvcontacts;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label txtbody;
+ private System.Windows.Forms.Label lbtitle;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/AddressBook.cs b/ShiftOS.WinForms/Applications/AddressBook.cs
new file mode 100644
index 0000000..9a4ce51
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/AddressBook.cs
@@ -0,0 +1,179 @@
+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 static ShiftOS.Objects.ShiftFS.Utils;
+using Newtonsoft.Json;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [WinOpen("address_book")]
+ [AppscapeEntry("Address Book", "Add and edit your contacts within the digital society in an easy-to-use application.", 1024, 750, null, "Office")]
+ [DefaultTitle("Address Book")]
+ [Launcher("Address Book", false, null, "Office")]
+ public partial class AddressBook : UserControl, IShiftOSWindow
+ {
+ public AddressBook()
+ {
+ InitializeComponent();
+ }
+
+ string data_dir = Paths.GetPath("data") + "/address_book";
+ public void OnLoad()
+ {
+ removeToolStripMenuItem.Visible = false;
+ if (!DirectoryExists(data_dir))
+ CreateDirectory(data_dir);
+ tvcontacts.Nodes.RemoveByKey("userdefined");
+ var userDefined = new TreeNode();
+ userDefined.Name = "userdefined";
+ userDefined.Text = "User-defined";
+ tvcontacts.Click += (o, a) =>
+ {
+ if (tvcontacts.SelectedNode == userDefined)
+ {
+ removeToolStripMenuItem.Visible = false;
+ }
+ };
+ foreach(var f in GetFiles(data_dir))
+ {
+ try
+ {
+ var contact = JsonConvert.DeserializeObject<Contact>(ReadAllText(f));
+ var node = new TreeNode();
+ node.Text = contact.UserName + "@" + contact.SystemName;
+ node.Tag = contact;
+ userDefined.Nodes.Add(node);
+ tvcontacts.Click += (o, a) =>
+ {
+ if(tvcontacts.SelectedNode == node)
+ {
+ lbtitle.Text = contact.Name;
+ txtbody.Text = $@"Username: {contact.UserName}
+System Name: {contact.SystemName}
+
+Description:
+{contact.Description}";
+ removeToolStripMenuItem.Visible = true;
+ SelectedContact = contact;
+ }
+ };
+ }
+ catch { }
+ }
+ tvcontacts.Nodes.Add(userDefined);
+ userDefined.Expand();
+ }
+
+ public Contact SelectedContact = null;
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ private void addContactToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Infobox.PromptText("Add Contact", "What is the contact's name?", delegate(string name) {
+ if (name != "")
+ {
+ Infobox.PromptText("Add Contact", "What is the user's username?", delegate (string uname)
+ {
+ if (uname != "")
+ {
+ Infobox.PromptText("Add Contact", "What is the user's systemname?", delegate(string sysname)
+ {
+ if (sysname != "")
+ {
+ Infobox.PromptText("Add Contact", "How would you describe this user?", delegate (string desc)
+ {
+ if (desc != "")
+ {
+ Contact contact= new Contact();
+ contact.Name = name;
+ contact.UserName = uname;
+ contact.SystemName = sysname;
+ contact.Relationship = ContactRelationship.Acquaintance;
+ contact.IsStoryCharacter = false;
+ contact.Description = desc;
+ var contactJson = JsonConvert.SerializeObject(contact);
+ WriteAllText(data_dir + "/" + name, contactJson);
+ OnLoad(); // Reload to show changes
+ } else
+ {
+ Infobox.Show("Add Contact", "Description cannot be empty.");
+ }
+ });
+ } else
+ {
+ Infobox.Show("Add Contact", "System name cannot be empty.");
+ }
+ });
+ } else
+ {
+ Infobox.Show("Add Contact", "Username cannot be empty.");
+ }
+ });
+ } else
+ {
+ Infobox.Show("Add Contact", "Name cannot be empty.");
+ }
+ });
+ }
+
+ private void AddressBook_Load(object sender, EventArgs e)
+ {
+
+ }
+
+ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if(SelectedContact != null)
+ {
+ string file = data_dir + "/" + SelectedContact.Name;
+ if (FileExists(file))
+ {
+ Infobox.PromptYesNo("Remove contact", $"Are you sure you want to remove {SelectedContact.Name} from your Address Book?", (result) =>
+ {
+ if (result == true)
+ {
+ Delete(file);
+ OnLoad();
+ }
+ });
+ }
+ }
+ }
+ }
+
+ public class Contact
+ {
+ public string Name { get; set; }
+ public string UserName { get; set; }
+ public string SystemName { get; set; }
+ public ContactRelationship Relationship { get; set; }
+ public bool IsStoryCharacter { get; set; }
+ public string Description { get; set; }
+ }
+
+ public enum ContactRelationship
+ {
+ Acquaintance,
+ Friend,
+ Enemy
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/AddressBook.resx b/ShiftOS.WinForms/Applications/AddressBook.resx
new file mode 100644
index 0000000..e150f33
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/AddressBook.resx
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <data name="txtbody.Text" xml:space="preserve">
+ <value>The Address Book helps you keep track of all your contacts within the digital society, whether they be friends, enemies, or whatnot.
+
+On the left, we have made a list of all your contacts. You can click on one to view full details on the contact.
+
+To add a contact, simply click "Add Contact", and to remove one, click "Remove". Some contacts may not be removed as they are integral to the progression of your adventures within the digital society.</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/Artpad.cs b/ShiftOS.WinForms/Applications/Artpad.cs
index 6c1bc1c..7ef66aa 100644
--- a/ShiftOS.WinForms/Applications/Artpad.cs
+++ b/ShiftOS.WinForms/Applications/Artpad.cs
@@ -38,9 +38,11 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.WinForms.Tools;
using ShiftOS.Engine;
+using System.Diagnostics;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
[Launcher("Artpad", true, "al_artpad", "Graphics")]
[RequiresUpgrade("artpad")]
[WinOpen("artpad")]
@@ -54,8 +56,11 @@ namespace ShiftOS.WinForms.Applications
{
try
{
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
InitializeComponent();
-
+ sw.Stop();
+ Console.WriteLine("ArtPad construction timespan:" + sw.Elapsed.ToString());
}
catch (Exception ex)
{
@@ -140,17 +145,7 @@ namespace ShiftOS.WinForms.Applications
private void Template_Load(object sender, EventArgs e)
{
- justopened = true;
- this.Left = (Screen.PrimaryScreen.Bounds.Width - this.Width) / 2;
- this.Top = (Screen.PrimaryScreen.Bounds.Height - this.Height) / 2;
-
- setuppreview();
- settoolcolours();
- loadcolors();
- AddFonts();
- setuptoolbox();
- determinevisiblepalettes();
- tmrsetupui.Start();
+ //Moved to the engine "OnLoad" method.
}
@@ -170,55 +165,24 @@ namespace ShiftOS.WinForms.Applications
needtosave = false;
}
+ //PHILCODE: I just reduced this function's amount of Windows Forms calls by 66%.
public void setuptoolbox()
{
- btnpixelplacer.Hide();
- btnpencil.Hide();
- btnfloodfill.Hide();
- btnoval.Hide();
- btnsquare.Hide();
- btnlinetool.Hide();
- btnpaintbrush.Hide();
- btntexttool.Hide();
- btneracer.Hide();
- btnnew.Hide();
- btnopen.Hide();
- btnsave.Hide();
- btnundo.Hide();
- btnredo.Hide();
- btnpixelplacermovementmode.Hide();
-
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_pixel_placer") == true)
- btnpixelplacer.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_pencil") == true)
- btnpencil.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_fill_tool") == true)
- btnfloodfill.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_oval_tool") == true)
- btnoval.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_rectangle_tool") == true)
- btnsquare.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_line_tool") == true)
- btnlinetool.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_paintbrush") == true)
- btnpaintbrush.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_text_tool") == true)
- btntexttool.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_eraser") == true)
- btneracer.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_new") == true)
- btnnew.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_load") == true)
- btnopen.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_save") == true)
- btnsave.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_undo") == true)
- btnundo.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_redo") == true)
- btnredo.Show();
- if (ShiftoriumFrontend.UpgradeInstalled("artpad_pp_movement_mode") == true)
- btnpixelplacermovementmode.Show();
-
+ btnpixelplacer.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_pixel_placer") == true);
+ btnpencil.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_pencil") == true);
+ btnfloodfill.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_fill_tool") == true);
+ btnoval.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_oval_tool") == true);
+ btnsquare.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_rectangle_tool") == true);
+ btnlinetool.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_line_tool") == true);
+ btnpaintbrush.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_paintbrush") == true);
+ btntexttool.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_text_tool") == true);
+ btneracer.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_eraser") == true);
+ btnnew.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_new") == true);
+ btnopen.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_load") == true);
+ btnsave.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_save") == true);
+ btnundo.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_undo") == true);
+ btnredo.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_redo") == true);
+ btnpixelplacermovementmode.Visible = (ShiftoriumFrontend.UpgradeInstalled("artpad_pp_movement_mode") == true);
}
private void AddFonts()
@@ -687,290 +651,6 @@ namespace ShiftOS.WinForms.Applications
}
}
- //<unused>
- public void loadcolors()
- {
- /*bool allwhite = true;
- for (int i = 0; i <= 127; i++)
- {
- if (ShiftOSDesktop.artpad_colour_palettes(i) == null)
- {
- }
- else {
- allwhite = false;
- }
- }
- if (allwhite == true)
- {
- for (i = 0; i <= 127; i++)
- {
- ShiftOSDesktop.artpad_colour_palettes(i) = Color.Black;
- }
- }
- colourpalette1.BackColor = ShiftOSDesktop.artpad_colour_palettes(0);
- colourpalette2.BackColor = ShiftOSDesktop.artpad_colour_palettes(1);
- colourpalette3.BackColor = ShiftOSDesktop.artpad_colour_palettes(2);
- colourpalette4.BackColor = ShiftOSDesktop.artpad_colour_palettes(3);
- colourpalette5.BackColor = ShiftOSDesktop.artpad_colour_palettes(4);
- colourpalette6.BackColor = ShiftOSDesktop.artpad_colour_palettes(5);
- colourpalette7.BackColor = ShiftOSDesktop.artpad_colour_palettes(6);
- colourpalette8.BackColor = ShiftOSDesktop.artpad_colour_palettes(7);
- colourpalette9.BackColor = ShiftOSDesktop.artpad_colour_palettes(8);
- colourpalette10.BackColor = ShiftOSDesktop.artpad_colour_palettes(9);
- colourpalette11.BackColor = ShiftOSDesktop.artpad_colour_palettes(10);
- colourpalette12.BackColor = ShiftOSDesktop.artpad_colour_palettes(11);
- colourpalette13.BackColor = ShiftOSDesktop.artpad_colour_palettes(12);
- colourpalette14.BackColor = ShiftOSDesktop.artpad_colour_palettes(13);
- colourpalette15.BackColor = ShiftOSDesktop.artpad_colour_palettes(14);
- colourpalette16.BackColor = ShiftOSDesktop.artpad_colour_palettes(15);
- colourpalette17.BackColor = ShiftOSDesktop.artpad_colour_palettes(16);
- colourpalette18.BackColor = ShiftOSDesktop.artpad_colour_palettes(17);
- colourpalette19.BackColor = ShiftOSDesktop.artpad_colour_palettes(18);
- colourpalette20.BackColor = ShiftOSDesktop.artpad_colour_palettes(19);
- colourpalette21.BackColor = ShiftOSDesktop.artpad_colour_palettes(20);
- colourpalette22.BackColor = ShiftOSDesktop.artpad_colour_palettes(21);
- colourpalette23.BackColor = ShiftOSDesktop.artpad_colour_palettes(22);
- colourpalette24.BackColor = ShiftOSDesktop.artpad_colour_palettes(23);
- colourpalette25.BackColor = ShiftOSDesktop.artpad_colour_palettes(24);
- colourpalette26.BackColor = ShiftOSDesktop.artpad_colour_palettes(25);
- colourpalette27.BackColor = ShiftOSDesktop.artpad_colour_palettes(26);
- colourpalette28.BackColor = ShiftOSDesktop.artpad_colour_palettes(27);
- colourpalette29.BackColor = ShiftOSDesktop.artpad_colour_palettes(28);
- colourpalette30.BackColor = ShiftOSDesktop.artpad_colour_palettes(29);
- colourpalette31.BackColor = ShiftOSDesktop.artpad_colour_palettes(30);
- colourpalette32.BackColor = ShiftOSDesktop.artpad_colour_palettes(31);
- colourpalette33.BackColor = ShiftOSDesktop.artpad_colour_palettes(32);
- colourpalette34.BackColor = ShiftOSDesktop.artpad_colour_palettes(33);
- colourpalette35.BackColor = ShiftOSDesktop.artpad_colour_palettes(34);
- colourpalette36.BackColor = ShiftOSDesktop.artpad_colour_palettes(35);
- colourpalette37.BackColor = ShiftOSDesktop.artpad_colour_palettes(36);
- colourpalette38.BackColor = ShiftOSDesktop.artpad_colour_palettes(37);
- colourpalette39.BackColor = ShiftOSDesktop.artpad_colour_palettes(38);
- colourpalette40.BackColor = ShiftOSDesktop.artpad_colour_palettes(39);
- colourpalette41.BackColor = ShiftOSDesktop.artpad_colour_palettes(40);
- colourpalette42.BackColor = ShiftOSDesktop.artpad_colour_palettes(41);
- colourpalette43.BackColor = ShiftOSDesktop.artpad_colour_palettes(42);
- colourpalette44.BackColor = ShiftOSDesktop.artpad_colour_palettes(43);
- colourpalette45.BackColor = ShiftOSDesktop.artpad_colour_palettes(44);
- colourpalette46.BackColor = ShiftOSDesktop.artpad_colour_palettes(45);
- colourpalette47.BackColor = ShiftOSDesktop.artpad_colour_palettes(46);
- colourpalette48.BackColor = ShiftOSDesktop.artpad_colour_palettes(47);
- colourpalette49.BackColor = ShiftOSDesktop.artpad_colour_palettes(48);
- colourpalette50.BackColor = ShiftOSDesktop.artpad_colour_palettes(49);
- colourpalette51.BackColor = ShiftOSDesktop.artpad_colour_palettes(50);
- colourpalette52.BackColor = ShiftOSDesktop.artpad_colour_palettes(51);
- colourpalette53.BackColor = ShiftOSDesktop.artpad_colour_palettes(52);
- colourpalette54.BackColor = ShiftOSDesktop.artpad_colour_palettes(53);
- colourpalette55.BackColor = ShiftOSDesktop.artpad_colour_palettes(54);
- colourpalette56.BackColor = ShiftOSDesktop.artpad_colour_palettes(55);
- colourpalette57.BackColor = ShiftOSDesktop.artpad_colour_palettes(56);
- colourpalette58.BackColor = ShiftOSDesktop.artpad_colour_palettes(57);
- colourpalette59.BackColor = ShiftOSDesktop.artpad_colour_palettes(58);
- colourpalette60.BackColor = ShiftOSDesktop.artpad_colour_palettes(59);
- colourpalette61.BackColor = ShiftOSDesktop.artpad_colour_palettes(60);
- colourpalette62.BackColor = ShiftOSDesktop.artpad_colour_palettes(61);
- colourpalette63.BackColor = ShiftOSDesktop.artpad_colour_palettes(62);
- colourpalette64.BackColor = ShiftOSDesktop.artpad_colour_palettes(63);
- colourpalette65.BackColor = ShiftOSDesktop.artpad_colour_palettes(64);
- colourpalette66.BackColor = ShiftOSDesktop.artpad_colour_palettes(65);
- colourpalette67.BackColor = ShiftOSDesktop.artpad_colour_palettes(66);
- colourpalette68.BackColor = ShiftOSDesktop.artpad_colour_palettes(67);
- colourpalette69.BackColor = ShiftOSDesktop.artpad_colour_palettes(68);
- colourpalette70.BackColor = ShiftOSDesktop.artpad_colour_palettes(69);
- colourpalette71.BackColor = ShiftOSDesktop.artpad_colour_palettes(70);
- colourpalette72.BackColor = ShiftOSDesktop.artpad_colour_palettes(71);
- colourpalette73.BackColor = ShiftOSDesktop.artpad_colour_palettes(72);
- colourpalette74.BackColor = ShiftOSDesktop.artpad_colour_palettes(73);
- colourpalette75.BackColor = ShiftOSDesktop.artpad_colour_palettes(74);
- colourpalette76.BackColor = ShiftOSDesktop.artpad_colour_palettes(75);
- colourpalette77.BackColor = ShiftOSDesktop.artpad_colour_palettes(76);
- colourpalette78.BackColor = ShiftOSDesktop.artpad_colour_palettes(77);
- colourpalette79.BackColor = ShiftOSDesktop.artpad_colour_palettes(78);
- colourpalette80.BackColor = ShiftOSDesktop.artpad_colour_palettes(79);
- colourpalette81.BackColor = ShiftOSDesktop.artpad_colour_palettes(80);
- colourpalette82.BackColor = ShiftOSDesktop.artpad_colour_palettes(81);
- colourpalette83.BackColor = ShiftOSDesktop.artpad_colour_palettes(82);
- colourpalette84.BackColor = ShiftOSDesktop.artpad_colour_palettes(83);
- colourpalette85.BackColor = ShiftOSDesktop.artpad_colour_palettes(84);
- colourpalette86.BackColor = ShiftOSDesktop.artpad_colour_palettes(85);
- colourpalette87.BackColor = ShiftOSDesktop.artpad_colour_palettes(86);
- colourpalette88.BackColor = ShiftOSDesktop.artpad_colour_palettes(87);
- colourpalette89.BackColor = ShiftOSDesktop.artpad_colour_palettes(88);
- colourpalette90.BackColor = ShiftOSDesktop.artpad_colour_palettes(89);
- colourpalette91.BackColor = ShiftOSDesktop.artpad_colour_palettes(90);
- colourpalette92.BackColor = ShiftOSDesktop.artpad_colour_palettes(91);
- colourpalette93.BackColor = ShiftOSDesktop.artpad_colour_palettes(92);
- colourpalette94.BackColor = ShiftOSDesktop.artpad_colour_palettes(93);
- colourpalette95.BackColor = ShiftOSDesktop.artpad_colour_palettes(94);
- colourpalette96.BackColor = ShiftOSDesktop.artpad_colour_palettes(95);
- colourpalette97.BackColor = ShiftOSDesktop.artpad_colour_palettes(96);
- colourpalette98.BackColor = ShiftOSDesktop.artpad_colour_palettes(97);
- colourpalette99.BackColor = ShiftOSDesktop.artpad_colour_palettes(98);
- colourpalette100.BackColor = ShiftOSDesktop.artpad_colour_palettes(99);
- colourpalette101.BackColor = ShiftOSDesktop.artpad_colour_palettes(100);
- colourpalette102.BackColor = ShiftOSDesktop.artpad_colour_palettes(101);
- colourpalette103.BackColor = ShiftOSDesktop.artpad_colour_palettes(102);
- colourpalette104.BackColor = ShiftOSDesktop.artpad_colour_palettes(103);
- colourpalette105.BackColor = ShiftOSDesktop.artpad_colour_palettes(104);
- colourpalette106.BackColor = ShiftOSDesktop.artpad_colour_palettes(105);
- colourpalette107.BackColor = ShiftOSDesktop.artpad_colour_palettes(106);
- colourpalette108.BackColor = ShiftOSDesktop.artpad_colour_palettes(107);
- colourpalette109.BackColor = ShiftOSDesktop.artpad_colour_palettes(108);
- colourpalette110.BackColor = ShiftOSDesktop.artpad_colour_palettes(109);
- colourpalette111.BackColor = ShiftOSDesktop.artpad_colour_palettes(110);
- colourpalette112.BackColor = ShiftOSDesktop.artpad_colour_palettes(111);
- colourpalette113.BackColor = ShiftOSDesktop.artpad_colour_palettes(112);
- colourpalette114.BackColor = ShiftOSDesktop.artpad_colour_palettes(113);
- colourpalette115.BackColor = ShiftOSDesktop.artpad_colour_palettes(114);
- colourpalette116.BackColor = ShiftOSDesktop.artpad_colour_palettes(115);
- colourpalette117.BackColor = ShiftOSDesktop.artpad_colour_palettes(116);
- colourpalette118.BackColor = ShiftOSDesktop.artpad_colour_palettes(117);
- colourpalette119.BackColor = ShiftOSDesktop.artpad_colour_palettes(118);
- colourpalette120.BackColor = ShiftOSDesktop.artpad_colour_palettes(119);
- colourpalette121.BackColor = ShiftOSDesktop.artpad_colour_palettes(120);
- colourpalette122.BackColor = ShiftOSDesktop.artpad_colour_palettes(121);
- colourpalette123.BackColor = ShiftOSDesktop.artpad_colour_palettes(122);
- colourpalette124.BackColor = ShiftOSDesktop.artpad_colour_palettes(123);
- colourpalette125.BackColor = ShiftOSDesktop.artpad_colour_palettes(124);
- colourpalette126.BackColor = ShiftOSDesktop.artpad_colour_palettes(125);
- colourpalette127.BackColor = ShiftOSDesktop.artpad_colour_palettes(126);
- colourpalette128.BackColor = ShiftOSDesktop.artpad_colour_palettes(127);
- */
- }
-
- public void savecolors()
- {/*
- ShiftOSDesktop.artpad_colour_palettes(0) = colourpalette1.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(1) = colourpalette2.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(2) = colourpalette3.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(3) = colourpalette4.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(4) = colourpalette5.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(5) = colourpalette6.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(6) = colourpalette7.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(7) = colourpalette8.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(8) = colourpalette9.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(9) = colourpalette10.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(10) = colourpalette11.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(11) = colourpalette12.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(12) = colourpalette13.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(13) = colourpalette14.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(14) = colourpalette15.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(15) = colourpalette16.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(16) = colourpalette17.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(17) = colourpalette18.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(18) = colourpalette19.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(19) = colourpalette20.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(20) = colourpalette21.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(21) = colourpalette22.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(22) = colourpalette23.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(23) = colourpalette24.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(24) = colourpalette25.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(25) = colourpalette26.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(26) = colourpalette27.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(27) = colourpalette28.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(28) = colourpalette29.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(29) = colourpalette30.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(30) = colourpalette31.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(31) = colourpalette32.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(32) = colourpalette33.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(33) = colourpalette34.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(34) = colourpalette35.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(35) = colourpalette36.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(36) = colourpalette37.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(37) = colourpalette38.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(38) = colourpalette39.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(39) = colourpalette40.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(40) = colourpalette41.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(41) = colourpalette42.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(42) = colourpalette43.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(43) = colourpalette44.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(44) = colourpalette45.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(45) = colourpalette46.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(46) = colourpalette47.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(47) = colourpalette48.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(48) = colourpalette49.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(49) = colourpalette50.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(50) = colourpalette51.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(51) = colourpalette52.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(52) = colourpalette53.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(53) = colourpalette54.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(54) = colourpalette55.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(55) = colourpalette56.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(56) = colourpalette57.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(57) = colourpalette58.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(58) = colourpalette59.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(59) = colourpalette60.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(60) = colourpalette61.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(61) = colourpalette62.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(62) = colourpalette63.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(63) = colourpalette64.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(64) = colourpalette65.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(65) = colourpalette66.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(66) = colourpalette67.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(67) = colourpalette68.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(68) = colourpalette69.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(69) = colourpalette70.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(70) = colourpalette71.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(71) = colourpalette72.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(72) = colourpalette73.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(73) = colourpalette74.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(74) = colourpalette75.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(75) = colourpalette76.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(76) = colourpalette77.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(77) = colourpalette78.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(78) = colourpalette79.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(79) = colourpalette80.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(80) = colourpalette81.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(81) = colourpalette82.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(82) = colourpalette83.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(83) = colourpalette84.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(84) = colourpalette85.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(85) = colourpalette86.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(86) = colourpalette87.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(87) = colourpalette88.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(88) = colourpalette89.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(89) = colourpalette90.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(90) = colourpalette91.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(91) = colourpalette92.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(92) = colourpalette93.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(93) = colourpalette94.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(94) = colourpalette95.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(95) = colourpalette96.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(96) = colourpalette97.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(97) = colourpalette98.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(98) = colourpalette99.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(99) = colourpalette100.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(100) = colourpalette101.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(101) = colourpalette102.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(102) = colourpalette103.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(103) = colourpalette104.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(104) = colourpalette105.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(105) = colourpalette106.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(106) = colourpalette107.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(107) = colourpalette108.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(108) = colourpalette109.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(109) = colourpalette110.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(110) = colourpalette111.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(111) = colourpalette112.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(112) = colourpalette113.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(113) = colourpalette114.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(114) = colourpalette115.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(115) = colourpalette116.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(116) = colourpalette117.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(117) = colourpalette118.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(118) = colourpalette119.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(119) = colourpalette120.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(120) = colourpalette121.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(121) = colourpalette122.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(122) = colourpalette123.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(123) = colourpalette124.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(124) = colourpalette125.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(125) = colourpalette126.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(126) = colourpalette127.BackColor;
- ShiftOSDesktop.artpad_colour_palettes(127) = colourpalette128.BackColor;
- */
- }
- //</unused>
public void settoolcolours()
{
@@ -1858,6 +1538,12 @@ namespace ShiftOS.WinForms.Applications
ctrl.Tag = "keepbg";
ctrl.BackColor = Color.Black;
}
+ setuppreview();
+ settoolcolours();
+ AddFonts();
+ setuptoolbox();
+ determinevisiblepalettes();
+
}
public void OnSkinLoad()
diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs
index 83f41d2..d7f03a0 100644
--- a/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs
+++ b/ShiftOS.WinForms/Applications/AudioPlayer.Designer.cs
@@ -52,10 +52,193 @@ namespace ShiftOS.WinForms.Applications
/// </summary>
private void InitializeComponent()
{
- components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AudioPlayer));
+ this.wpaudio = new AxWMPLib.AxWindowsMediaPlayer();
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.lbtracks = new System.Windows.Forms.ListBox();
+ this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnplay = new System.Windows.Forms.Button();
+ this.pgplaytime = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.addSongToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.shuffleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.loopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).BeginInit();
+ this.toolStripContainer1.ContentPanel.SuspendLayout();
+ this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
+ this.toolStripContainer1.SuspendLayout();
+ this.flcontrols.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // wpaudio
+ //
+ this.wpaudio.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wpaudio.Enabled = true;
+ this.wpaudio.Location = new System.Drawing.Point(0, 0);
+ this.wpaudio.Name = "wpaudio";
+ this.wpaudio.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wpaudio.OcxState")));
+ this.wpaudio.Size = new System.Drawing.Size(798, 471);
+ this.wpaudio.TabIndex = 0;
+ this.wpaudio.Visible = false;
+ //
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.lbtracks);
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.flcontrols);
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(798, 447);
+ this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer1.LeftToolStripPanelVisible = false;
+ this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
+ this.toolStripContainer1.Name = "toolStripContainer1";
+ this.toolStripContainer1.RightToolStripPanelVisible = false;
+ this.toolStripContainer1.Size = new System.Drawing.Size(798, 471);
+ this.toolStripContainer1.TabIndex = 1;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // toolStripContainer1.TopToolStripPanel
+ //
+ this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
+ //
+ // lbtracks
+ //
+ this.lbtracks.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lbtracks.FormattingEnabled = true;
+ this.lbtracks.Location = new System.Drawing.Point(0, 0);
+ this.lbtracks.Name = "lbtracks";
+ this.lbtracks.Size = new System.Drawing.Size(798, 418);
+ this.lbtracks.TabIndex = 1;
+ this.lbtracks.SelectedIndexChanged += new System.EventHandler(this.lbtracks_SelectedIndexChanged);
+ //
+ // flcontrols
+ //
+ this.flcontrols.AutoSize = true;
+ this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcontrols.Controls.Add(this.btnplay);
+ this.flcontrols.Controls.Add(this.pgplaytime);
+ this.flcontrols.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.flcontrols.Location = new System.Drawing.Point(0, 418);
+ this.flcontrols.Name = "flcontrols";
+ this.flcontrols.Size = new System.Drawing.Size(798, 29);
+ this.flcontrols.TabIndex = 0;
+ //
+ // btnplay
+ //
+ this.btnplay.AutoSize = true;
+ this.btnplay.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnplay.Location = new System.Drawing.Point(3, 3);
+ this.btnplay.Name = "btnplay";
+ this.btnplay.Size = new System.Drawing.Size(37, 23);
+ this.btnplay.TabIndex = 0;
+ this.btnplay.Text = "Play";
+ this.btnplay.UseVisualStyleBackColor = true;
+ this.btnplay.Click += new System.EventHandler(this.btnplay_Click);
+ //
+ // pgplaytime
+ //
+ this.pgplaytime.Location = new System.Drawing.Point(46, 3);
+ this.pgplaytime.Maximum = 100;
+ this.pgplaytime.Name = "pgplaytime";
+ this.pgplaytime.Size = new System.Drawing.Size(749, 23);
+ this.pgplaytime.TabIndex = 1;
+ this.pgplaytime.Tag = "keepbg";
+ this.pgplaytime.Text = "shiftedProgressBar1";
+ this.pgplaytime.Value = 0;
+ this.pgplaytime.MouseDown += new System.Windows.Forms.MouseEventHandler(this.startScrub);
+ this.pgplaytime.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseMove);
+ this.pgplaytime.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseUp);
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addSongToolStripMenuItem,
+ this.clearToolStripMenuItem,
+ this.shuffleToolStripMenuItem,
+ this.removeToolStripMenuItem,
+ this.loopToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(798, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // addSongToolStripMenuItem
+ //
+ this.addSongToolStripMenuItem.Name = "addSongToolStripMenuItem";
+ this.addSongToolStripMenuItem.Size = new System.Drawing.Size(71, 20);
+ this.addSongToolStripMenuItem.Text = "Add Song";
+ this.addSongToolStripMenuItem.Click += new System.EventHandler(this.addSongToolStripMenuItem_Click);
+ //
+ // clearToolStripMenuItem
+ //
+ this.clearToolStripMenuItem.Name = "clearToolStripMenuItem";
+ this.clearToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
+ this.clearToolStripMenuItem.Text = "Clear";
+ this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click);
+ //
+ // shuffleToolStripMenuItem
+ //
+ this.shuffleToolStripMenuItem.Name = "shuffleToolStripMenuItem";
+ this.shuffleToolStripMenuItem.Size = new System.Drawing.Size(56, 20);
+ this.shuffleToolStripMenuItem.Text = "Shuffle";
+ this.shuffleToolStripMenuItem.Click += new System.EventHandler(this.shuffleToolStripMenuItem_Click);
+ //
+ // removeToolStripMenuItem
+ //
+ this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
+ this.removeToolStripMenuItem.Size = new System.Drawing.Size(62, 20);
+ this.removeToolStripMenuItem.Text = "Remove";
+ this.removeToolStripMenuItem.Click += new System.EventHandler(this.removeToolStripMenuItem_Click);
+ //
+ // loopToolStripMenuItem
+ //
+ this.loopToolStripMenuItem.CheckOnClick = true;
+ this.loopToolStripMenuItem.Name = "loopToolStripMenuItem";
+ this.loopToolStripMenuItem.Size = new System.Drawing.Size(46, 20);
+ this.loopToolStripMenuItem.Text = "Loop";
+ //
+ // AudioPlayer
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.toolStripContainer1);
+ this.Controls.Add(this.wpaudio);
+ this.Name = "AudioPlayer";
+ this.Size = new System.Drawing.Size(798, 471);
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).EndInit();
+ this.toolStripContainer1.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer1.ContentPanel.PerformLayout();
+ this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
+ this.toolStripContainer1.TopToolStripPanel.PerformLayout();
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
+ this.flcontrols.ResumeLayout(false);
+ this.flcontrols.PerformLayout();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.ResumeLayout(false);
+
}
#endregion
+
+ private AxWMPLib.AxWindowsMediaPlayer wpaudio;
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem addSongToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem shuffleToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
+ private System.Windows.Forms.ListBox lbtracks;
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
+ private System.Windows.Forms.Button btnplay;
+ private Controls.ShiftedProgressBar pgplaytime;
+ private System.Windows.Forms.ToolStripMenuItem loopToolStripMenuItem;
}
}
diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.cs b/ShiftOS.WinForms/Applications/AudioPlayer.cs
index b8be6af..9940ddd 100644
--- a/ShiftOS.WinForms/Applications/AudioPlayer.cs
+++ b/ShiftOS.WinForms/Applications/AudioPlayer.cs
@@ -32,9 +32,15 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
+using NAudio;
+using System.Threading;
namespace ShiftOS.WinForms.Applications
{
+ [AppscapeEntry("Audio Player", "Play music and other sounds on your computer.", 3047, 1000, "file_skimmer", "Entertainment")]
+ [Launcher("Audio Player", false, null, "Entertainment")]
+ [WinOpen("audio_player")]
+ [DefaultTitle("Audio Player")]
public partial class AudioPlayer : UserControl, IShiftOSWindow
{
public AudioPlayer()
@@ -42,18 +48,24 @@ namespace ShiftOS.WinForms.Applications
InitializeComponent();
}
+ NAudio.Wave.WaveOut o = null;
+
+
public void OnLoad()
{
-
+ wpaudio.Hide();
}
public void OnSkinLoad()
{
-
+ pgplaytime.Width = flcontrols.Width - btnplay.Width - 25;
}
public bool OnUnload()
{
+ o?.Dispose();
+ mp3?.Dispose();
+ memstream?.Dispose();
return true;
}
@@ -61,5 +73,170 @@ namespace ShiftOS.WinForms.Applications
{
}
+
+ private void addSongToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".mp3", ".wav" }, FileOpenerStyle.Open, (path) =>
+ {
+ if (!lbtracks.Items.Contains(path))
+ lbtracks.Items.Add(path);
+ else
+ Infobox.Show("Song already added!", "That song is already added to the Audio Player playlist.");
+ });
+ }
+
+ private void clearToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ lbtracks.Items.Clear();
+ }
+
+ private void shuffleToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var lst = new object[lbtracks.Items.Count];
+ lbtracks.Items.CopyTo(lst, 0);
+ var shuffle = new List<object>(lst);
+ shuffle.Shuffle();
+ lbtracks.Items.Clear();
+ lbtracks.Items.AddRange(shuffle.ToArray());
+ }
+
+ private void removeToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ lbtracks.Items.RemoveAt(lbtracks.SelectedIndex);
+ }
+
+ private void btnplay_Click(object sender, EventArgs e)
+ {
+ if(o == null)
+ {
+ if (lbtracks.Items.Count > 0)
+ {
+ Play(lbtracks.Items[0].ToString());
+ btnplay.Text = "Pause";
+ }
+ else
+ Infobox.Show("Error", "No tracks to play! Please add a track to the playlist.");
+ }
+ else if(o.PlaybackState == NAudio.Wave.PlaybackState.Paused)
+ {
+ o.Resume();
+ btnplay.Text = "Pause";
+ }
+ else if(o.PlaybackState == NAudio.Wave.PlaybackState.Playing)
+ {
+ o.Pause();
+ btnplay.Text = "Play";
+ }
+ }
+
+ System.IO.Stream memstream = null;
+ NAudio.Wave.Mp3FileReader mp3 = null;
+
+ public void Play(string track)
+ {
+ if (o != null)
+ {
+ o.Dispose();
+ mp3.Dispose();
+ memstream.Dispose();
+ }
+ var bytes = ShiftOS.Objects.ShiftFS.Utils.ReadAllBytes(track);
+ memstream = new System.IO.MemoryStream(bytes);
+ mp3 = new NAudio.Wave.Mp3FileReader(memstream);
+ o = new NAudio.Wave.WaveOut();
+ o.Init(mp3);
+ o.Play();
+
+ pgplaytime.Value = 0;
+ pgplaytime.Maximum = (int)mp3.Length;
+ new Thread(() =>
+ {
+ while (o.PlaybackState == NAudio.Wave.PlaybackState.Playing || o.PlaybackState == NAudio.Wave.PlaybackState.Paused)
+ {
+ long time = mp3.Position;
+ this.Invoke(new Action(() =>
+ {
+ pgplaytime.Value = (int)time;
+ }));
+ Thread.Sleep(50);
+ }
+ if (o.PlaybackState == NAudio.Wave.PlaybackState.Stopped)
+ {
+ this.Invoke(new Action(() =>
+ {
+ if (lbtracks.SelectedIndex < lbtracks.Items.Count - 1)
+ {
+ lbtracks.SelectedIndex++;
+ }
+ else if (loopToolStripMenuItem.Checked == true)
+ {
+ lbtracks.SelectedIndex = 0;
+ }
+ }));
+ }
+ }).Start();
+ }
+
+ private void lbtracks_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ Play(lbtracks.SelectedItem.ToString());
+ }
+ catch { }
+ }
+
+ bool scrubbing = false;
+
+ private void startScrub(object sender, MouseEventArgs e)
+ {
+ scrubbing = true;
+ }
+
+ static public double linear(double x, double x0, double x1, double y0, double y1)
+ {
+ if ((x1 - x0) == 0)
+ {
+ return (y0 + y1) / 2;
+ }
+ return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
+ }
+
+ private void pgplaytime_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (mp3 != null)
+ try
+ {
+ if (scrubbing)
+ {
+ long s_pos = (long)linear(e.X, 0, pgplaytime.Width, 0, (double)mp3.Length);
+ mp3.Position = s_pos;
+ }
+ }
+ catch { }
+ }
+
+ private void pgplaytime_MouseUp(object sender, MouseEventArgs e)
+ {
+ scrubbing = false;
+ }
+ }
+
+ public static class ListExtensions
+ {
+ private static Random rng = new Random();
+
+ public static void Shuffle<T>(this IList<T> list)
+ {
+ int n = list.Count;
+ while (n > 1)
+ {
+ n--;
+ int k = rng.Next(n + 1);
+ T value = list[k];
+ list[k] = list[n];
+ list[n] = value;
+ }
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/AudioPlayer.resx b/ShiftOS.WinForms/Applications/AudioPlayer.resx
new file mode 100644
index 0000000..d484b91
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/AudioPlayer.resx
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="wpaudio.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtwAAAAIB
+ AAAAAQAAAAAAAAAAAAAAAKIAAAAAAwAACAAAAAAABQAAAAAAAADwPwMAAAAAAAUAAAAAAAAAAAAIAAIA
+ AAAAAAMAAQAAAAsA//8DAAAAAAALAP//CAACAAAAAAADADIAAAALAAAACAAKAAAAbgBvAG4AZQAAAAsA
+ AAALAAAACwD//wsA//8LAAAACAACAAAAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAALAAAAelIAAK4w
+ AAAL
+</value>
+ </data>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs
index d4b7211..d51b732 100644
--- a/ShiftOS.WinForms/Applications/Chat.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs
@@ -61,13 +61,23 @@ namespace ShiftOS.WinForms.Applications
this.tsbottombar = new System.Windows.Forms.ToolStrip();
this.txtuserinput = new System.Windows.Forms.ToolStripTextBox();
this.btnsend = new System.Windows.Forms.ToolStripButton();
+ this.pnlstart = new System.Windows.Forms.Panel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.txtchatid = new System.Windows.Forms.TextBox();
+ this.btnjoin = new System.Windows.Forms.Button();
this.panel1.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.tsbottombar.SuspendLayout();
+ this.pnlstart.SuspendLayout();
+ this.flowLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
+ this.panel1.Controls.Add(this.pnlstart);
this.panel1.Controls.Add(this.rtbchat);
this.panel1.Controls.Add(this.toolStrip1);
this.panel1.Controls.Add(this.tsbottombar);
@@ -141,6 +151,82 @@ namespace ShiftOS.WinForms.Applications
this.btnsend.Text = "Send";
this.btnsend.Click += new System.EventHandler(this.btnsend_Click);
//
+ // pnlstart
+ //
+ this.pnlstart.Controls.Add(this.flowLayoutPanel1);
+ this.pnlstart.Controls.Add(this.label3);
+ this.pnlstart.Controls.Add(this.label2);
+ this.pnlstart.Controls.Add(this.label1);
+ this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlstart.Location = new System.Drawing.Point(0, 25);
+ this.pnlstart.Name = "pnlstart";
+ this.pnlstart.Size = new System.Drawing.Size(633, 268);
+ this.pnlstart.TabIndex = 4;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label1.Location = new System.Drawing.Point(0, 0);
+ this.label1.Name = "label1";
+ this.label1.Padding = new System.Windows.Forms.Padding(10);
+ this.label1.Size = new System.Drawing.Size(143, 33);
+ this.label1.TabIndex = 0;
+ this.label1.Tag = "header1";
+ this.label1.Text = "Welcome to SimpleSRC!";
+ //
+ // label2
+ //
+ this.label2.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label2.Location = new System.Drawing.Point(0, 33);
+ this.label2.Name = "label2";
+ this.label2.Padding = new System.Windows.Forms.Padding(10);
+ this.label2.Size = new System.Drawing.Size(633, 52);
+ this.label2.TabIndex = 1;
+ this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." +
+ " All you have to do is enter a chat code or system name, and SimpleSRC will try " +
+ "to initiate a chat for you.";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label3.Location = new System.Drawing.Point(0, 85);
+ this.label3.Name = "label3";
+ this.label3.Padding = new System.Windows.Forms.Padding(10);
+ this.label3.Size = new System.Drawing.Size(79, 33);
+ this.label3.TabIndex = 2;
+ this.label3.Tag = "header3";
+ this.label3.Text = "Join a chat";
+ //
+ // flowLayoutPanel1
+ //
+ this.flowLayoutPanel1.AutoSize = true;
+ this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flowLayoutPanel1.Controls.Add(this.txtchatid);
+ this.flowLayoutPanel1.Controls.Add(this.btnjoin);
+ this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29);
+ this.flowLayoutPanel1.TabIndex = 3;
+ //
+ // txtchatid
+ //
+ this.txtchatid.Location = new System.Drawing.Point(3, 3);
+ this.txtchatid.Name = "txtchatid";
+ this.txtchatid.Size = new System.Drawing.Size(192, 20);
+ this.txtchatid.TabIndex = 0;
+ //
+ // btnjoin
+ //
+ this.btnjoin.Location = new System.Drawing.Point(201, 3);
+ this.btnjoin.Name = "btnjoin";
+ this.btnjoin.Size = new System.Drawing.Size(75, 23);
+ this.btnjoin.TabIndex = 1;
+ this.btnjoin.Text = "Join";
+ this.btnjoin.UseVisualStyleBackColor = true;
+ //
// Chat
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -154,6 +240,10 @@ namespace ShiftOS.WinForms.Applications
this.toolStrip1.PerformLayout();
this.tsbottombar.ResumeLayout(false);
this.tsbottombar.PerformLayout();
+ this.pnlstart.ResumeLayout(false);
+ this.pnlstart.PerformLayout();
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.flowLayoutPanel1.PerformLayout();
this.ResumeLayout(false);
}
@@ -168,5 +258,12 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.ToolStrip tsbottombar;
private System.Windows.Forms.ToolStripTextBox txtuserinput;
private System.Windows.Forms.ToolStripButton btnsend;
+ private System.Windows.Forms.Panel pnlstart;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.TextBox txtchatid;
+ private System.Windows.Forms.Button btnjoin;
}
}
diff --git a/ShiftOS.WinForms/Applications/Chat.cs b/ShiftOS.WinForms/Applications/Chat.cs
index 6c7528c..7a2de81 100644
--- a/ShiftOS.WinForms/Applications/Chat.cs
+++ b/ShiftOS.WinForms/Applications/Chat.cs
@@ -33,61 +33,27 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using ShiftOS.Engine;
+using System.Threading;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
+ [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(string chatId)
+ public Chat()
{
InitializeComponent();
- id = chatId;
- ServerManager.MessageReceived += (msg) =>
- {
- if (msg.Name == "chat_msgreceived")
- {
- try
- {
- this.Invoke(new Action(() =>
- {
- try
- {
- var args = JsonConvert.DeserializeObject<Dictionary<string, string>>(msg.Contents);
- var cmsg = new ShiftOS.Objects.ChatMessage(args["Username"] as string, args["SystemName"] as string, args["Message"] as string, args["Channel"] as string);
- if (id == cmsg.Channel)
- rtbchat.AppendText($"[{cmsg.Username}@{cmsg.SystemName}] {cmsg.Message}{Environment.NewLine}");
- }
- catch (Exception ex)
- {
- rtbchat.AppendText($"[system@multiuserdomain] Exception thrown by client: {ex}");
- }
- }));
- }
- catch { }
- }
- };
- }
-
- public void SendMessage(string msg)
- {
- if (!string.IsNullOrWhiteSpace(msg))
- {
- rtbchat.AppendText($"[{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}] {msg}{Environment.NewLine}");
-
- ServerManager.SendMessage("chat_send", JsonConvert.SerializeObject(new ShiftOS.Objects.ChatMessage(SaveSystem.CurrentSave.Username, SaveSystem.CurrentSave.SystemName, msg, id)));
- }
- else
- {
- rtbchat.AppendText($"[sys@multiuserdomain] You can't send blank messages. (only you can see this)");
- }
}
-
- private string id = "";
-
public void OnLoad()
{
- SendMessage("User has joined the chat.");
+ AllInstances.Add(this);
+ if (!string.IsNullOrWhiteSpace(ChatID))
+ pnlstart.SendToBack();
RefreshUserInput();
}
@@ -98,8 +64,8 @@ namespace ShiftOS.WinForms.Applications
public bool OnUnload()
{
- SendMessage("User has left the chat.");
- id = null;
+ AllInstances.Remove(this);
+ ChatID = null;
return true;
}
@@ -132,15 +98,102 @@ namespace ShiftOS.WinForms.Applications
{
rtbchat.SelectionStart = rtbchat.Text.Length;
rtbchat.ScrollToCaret();
- tschatid.Text = id;
- tsuserdata.Text = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}";
+ tschatid.Text = ChatID;
+ AppearanceManager.SetWindowTitle(this, tschatid.Text + " - SimpleSRC Client");
+ tsuserdata.Text = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}";
RefreshUserInput();
}
+ public static readonly List<Chat> AllInstances = new List<Chat>();
+
+ public static void SendMessage(string user, string destination, string msg)
+ {
+ foreach(var chat in AllInstances)
+ {
+ chat.PostMessage(user, destination, msg);
+ }
+ }
+
+ public string ChatID = "";
+
+ public void PostMessage(string user, string destination, string message)
+ {
+ if (ChatID == destination)
+ {
+ this.Invoke(new Action(() =>
+ {
+ rtbchat.SelectionFont = new Font(rtbchat.Font, FontStyle.Bold);
+ rtbchat.AppendText($"[{user}] ");
+ rtbchat.SelectionFont = rtbchat.Font;
+ rtbchat.AppendText(message);
+ rtbchat.AppendText(Environment.NewLine + Environment.NewLine);
+ }));
+ }
+ }
+
private void btnsend_Click(object sender, EventArgs e)
{
- SendMessage(txtuserinput.Text);
+ //Update ALL chat windows with this message if they're connected to this chat.
+ SendMessage($"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}", ChatID, txtuserinput.Text);
txtuserinput.Text = "";
}
+
+ [Story("story_thefennfamily")]
+ public static void Story_TheFennFamily()
+ {
+ bool complete = false;
+ Infobox.Show("SimpleSRC", "A direct message has been sent to you on SimpleSRC from user \"maureenfenn@trisys\".", () =>
+ {
+ string ch = "maureenfenn@trisys";
+ var c = new Chat();
+ c.ChatID = ch;
+ AppearanceManager.SetupWindow(c);
+ string you = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}";
+
+ var t = new Thread(() =>
+ {
+ SendMessage(you, ch, "User has joined the chat.");
+ Thread.Sleep(2000);
+ SendMessage(ch, ch, "Hello, " + you + ". My name is Maureen. Maureen Fenn.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "I am the author of the various Tri applications you may see on Appscape.");
+ Thread.Sleep(2000);
+ SendMessage(ch, ch, "I need your help with something...");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "Firstly, a little backstory. There was a time in ShiftOS when none of us were connected.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "There wasn't a Digital Society, we didn't have chat applications or anything...");
+ Thread.Sleep(2000);
+ SendMessage(ch, ch, "All we had was the Shiftnet.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "However, in 2016, something happened called the \"connected revolution\". It was like, the invention of the Internet - it was huge for the world of ShiftOS.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "Before this, the only way you could earn Codepoints was through playing games in ShiftOS.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "I was the one who coded those games, and I would put them on a Shiftnet website that you can still access today, shiftnet/main/shiftgames.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "But when the Connected Revolution took place, things got difficult. My son, Nalyr Fenn, was born, and people stopped using my software and instead moved on to hacking eachother and stealing peoples' Codepoints.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "When Nalyr's sentience levels reached near human - i.e, he grew up, we decided to start TriOffice. It was a huge success, thanks to Aiden Nirh, the guy who runs Appscape.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "However... a few months ago he cut contact with us and we stopped receiving Codepoints from TriOffice.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "I'm running low - I can't afford to keep my system running much longer. You have to help!");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "Perhaps, you could breach Aiden's server and look for clues as to why he's against us? I'll reward you with the last Codepoints I have.");
+ Thread.Sleep(2500);
+ SendMessage(you, ch, "Alright, I'm in - but I don't know where to begin...");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "A little birdie tells me you know about the RTS exploits going around... Try using that on Aiden's server. You can find his systemname on Appscape under \"Contact Us.\" He has a mailserver on Appscape - and also has RTS on the same server.");
+ Thread.Sleep(2500);
+ SendMessage(ch, ch, "Good luck... My life depends on you!");
+ complete = true;
+ });
+ t.IsBackground = true;
+ t.Start();
+ });
+ while (!complete)
+ Thread.Sleep(10);
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/Dialog.cs b/ShiftOS.WinForms/Applications/Dialog.cs
index 26e3040..f9d0b86 100644
--- a/ShiftOS.WinForms/Applications/Dialog.cs
+++ b/ShiftOS.WinForms/Applications/Dialog.cs
@@ -27,10 +27,13 @@ using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
+using System.IO;
using System.Linq;
+using System.Media;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
+using Microsoft.VisualBasic.Devices;
using ShiftOS.Engine;
namespace ShiftOS.WinForms.Applications
@@ -49,6 +52,7 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
AppearanceManager.SetWindowTitle(this, this.Title);
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.infobox);
}
public void OnSkinLoad()
@@ -65,10 +69,10 @@ namespace ShiftOS.WinForms.Applications
{
}
- internal void OpenInternal(string title, string msg)
+ internal void OpenInternal(string title, string msg, Action c)
{
- AppearanceManager.SetupWindow(this);
Title = title;
+ AppearanceManager.SetupDialog(this);
lbmessage.Text = msg;
txtinput.Hide();
flyesno.Hide();
@@ -76,20 +80,22 @@ namespace ShiftOS.WinForms.Applications
btnok.Click += (o, a) =>
{
AppearanceManager.Close(this);
+ c?.Invoke();
};
}
- public void Open(string title, string msg)
+ public void Open(string title, string msg, Action c = null)
{
- new Dialog().OpenInternal(title, msg);
+ new Dialog().OpenInternal(title, msg, c);
}
- public void PromptTextInternal(string title, string message, Action<string> callback)
+ public void PromptTextInternal(string title, string message, Action<string> callback, bool isPassword)
{
- AppearanceManager.SetupWindow(this);
Title = title;
+ AppearanceManager.SetupDialog(this);
lbmessage.Text = message;
+ txtinput.UseSystemPasswordChar = isPassword;
txtinput.Show();
flyesno.Hide();
btnok.Show();
@@ -109,9 +115,9 @@ namespace ShiftOS.WinForms.Applications
};
}
- public void PromptText(string title, string message, Action<string> callback)
+ public void PromptText(string title, string message, Action<string> callback, bool isPassword)
{
- new Dialog().PromptTextInternal(title, message, callback);
+ new Dialog().PromptTextInternal(title, message, callback, isPassword);
}
public void PromptYesNo(string title, string message, Action<bool> callback)
@@ -123,8 +129,8 @@ namespace ShiftOS.WinForms.Applications
public void PromptYesNoInternal(string title, string message, Action<bool> callback)
{
- AppearanceManager.SetupWindow(this);
Title = title;
+ AppearanceManager.SetupDialog(this);
lbmessage.Text = message;
txtinput.Hide();
flyesno.Show();
diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs
index b1b7ed9..b3d2cea 100644
--- a/ShiftOS.WinForms/Applications/Downloader.cs
+++ b/ShiftOS.WinForms/Applications/Downloader.cs
@@ -41,8 +41,12 @@ using System.IO.Compression;
namespace ShiftOS.WinForms.Applications
{
- [Launcher("Downloader", false, null, "Networking")]
+ [MultiplayerOnly]
+ [Launcher("Downloader", true, "al_downloader", "Networking")]
[DefaultIcon("iconDownloader")]
+ [WinOpen("downloader")]
+ [DefaultTitle("Downloader")]
+ [RequiresUpgrade("downloader")]
public partial class Downloader : UserControl, IShiftOSWindow
{
public Downloader()
@@ -173,18 +177,13 @@ namespace ShiftOS.WinForms.Applications
/// <returns>Download speed in bytes.</returns>
public static int GetDownloadSpeed()
{
- switch (SaveSystem.CurrentSave.ShiftnetSubscription)
- {
- case 0:
- return 256/*B*/;
- case 1:
- return 1024 * 1024/*KB*/;
- case 2:
- return 1024 * 10240/*KB*/;
- case 3:
- return 1024 * 1024 * 1024/*MB*/;
- }
- return 256;
+ return GetAllSubscriptions()[SaveSystem.CurrentSave.ShiftnetSubscription].DownloadSpeed;
+ }
+
+ public static ShiftOS.Objects.EngineShiftnetSubscription[] GetAllSubscriptions()
+ {
+ //For now we'll have them hard-coded into the client but in future they'll be in the MUD.
+ return JsonConvert.DeserializeObject<ShiftOS.Objects.EngineShiftnetSubscription[]>(Properties.Resources.ShiftnetServices);
}
public static void StartDownload(Download down)
diff --git a/ShiftOS.WinForms/Applications/FileDialog.cs b/ShiftOS.WinForms/Applications/FileDialog.cs
index 308be7d..ba92f08 100644
--- a/ShiftOS.WinForms/Applications/FileDialog.cs
+++ b/ShiftOS.WinForms/Applications/FileDialog.cs
@@ -60,9 +60,20 @@ namespace ShiftOS.WinForms.Applications
try
{
var itm = lvitems.SelectedItems[0];
- if (FileExists(currentdir + "/" + itm.Text))
+ if (cbfiletypes.Text != "Directory")
{
- txtfilename.Text = itm.Text;
+ if (FileExists(currentdir + "/" + itm.Text))
+ {
+ txtfilename.Text = itm.Text;
+ }
+ }
+ else
+ {
+ if (DirectoryExists(currentdir + "/" + itm.Text))
+ {
+ txtfilename.Text = itm.Text;
+ }
+
}
}
catch { }
@@ -72,23 +83,41 @@ namespace ShiftOS.WinForms.Applications
{
string fname = "";
fname = (!string.IsNullOrWhiteSpace(txtfilename.Text)) ? txtfilename.Text : "";
- fname = (!fname.EndsWith(cbfiletypes.SelectedItem.ToString())) ? fname + cbfiletypes.SelectedItem.ToString() : fname;
- fname = (fname == cbfiletypes.SelectedItem.ToString()) ? "" : fname;
+ if (cbfiletypes.Text != "Directory")
+ {
+ fname = (!fname.EndsWith(cbfiletypes.SelectedItem.ToString())) ? fname + cbfiletypes.SelectedItem.ToString() : fname;
+ fname = (fname == cbfiletypes.SelectedItem.ToString()) ? "" : fname;
+ }
switch (style)
{
case FileOpenerStyle.Open:
-
- if(FileExists(currentdir + "/" + fname))
+ if (cbfiletypes.Text == "Directory")
{
- callback?.Invoke(currentdir + "/" + fname);
- this.Close();
+ if (DirectoryExists(currentdir + "/" + fname))
+ {
+ callback?.Invoke(currentdir + "/" + fname);
+ this.Close();
+ }
+ else
+ {
+ Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}");
+ }
+
}
else
{
- Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}");
+ if (FileExists(currentdir + "/" + fname))
+ {
+ callback?.Invoke(currentdir + "/" + fname);
+ this.Close();
+ }
+ else
+ {
+ Infobox.Show("{FILE_NOT_FOUND}", "{FILE_NOT_FOUND_EXP}");
+ }
}
break;
case FileOpenerStyle.Save:
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
index b75f801..965e4eb 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.Designer.cs
@@ -54,10 +54,15 @@ namespace ShiftOS.WinForms.Applications
{
this.lvitems = new System.Windows.Forms.ListView();
this.panel1 = new System.Windows.Forms.Panel();
+ this.pinnedItems = new System.Windows.Forms.TreeView();
this.lbcurrentfolder = new System.Windows.Forms.Label();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.newFolderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.connectToRemoteServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.moveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.pinToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.panel1.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
@@ -65,16 +70,19 @@ namespace ShiftOS.WinForms.Applications
// lvitems
//
this.lvitems.Dock = System.Windows.Forms.DockStyle.Fill;
- this.lvitems.Location = new System.Drawing.Point(0, 0);
+ this.lvitems.Location = new System.Drawing.Point(149, 0);
this.lvitems.Name = "lvitems";
- this.lvitems.Size = new System.Drawing.Size(634, 332);
+ this.lvitems.Size = new System.Drawing.Size(485, 332);
this.lvitems.TabIndex = 0;
this.lvitems.UseCompatibleStateImageBehavior = false;
+ this.lvitems.ItemSelectionChanged += new System.Windows.Forms.ListViewItemSelectionChangedEventHandler(this.lvitems_ItemSelectionChanged);
+ this.lvitems.SelectedIndexChanged += new System.EventHandler(this.lvitems_SelectedIndexChanged);
this.lvitems.DoubleClick += new System.EventHandler(this.lvitems_DoubleClick);
//
// panel1
//
this.panel1.Controls.Add(this.lvitems);
+ this.panel1.Controls.Add(this.pinnedItems);
this.panel1.Controls.Add(this.lbcurrentfolder);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 24);
@@ -82,6 +90,15 @@ namespace ShiftOS.WinForms.Applications
this.panel1.Size = new System.Drawing.Size(634, 345);
this.panel1.TabIndex = 1;
//
+ // pinnedItems
+ //
+ this.pinnedItems.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pinnedItems.Location = new System.Drawing.Point(0, 0);
+ this.pinnedItems.Name = "pinnedItems";
+ this.pinnedItems.Size = new System.Drawing.Size(149, 332);
+ this.pinnedItems.TabIndex = 3;
+ this.pinnedItems.Click += new System.EventHandler(this.pinnedItems_Click);
+ //
// lbcurrentfolder
//
this.lbcurrentfolder.Dock = System.Windows.Forms.DockStyle.Bottom;
@@ -95,7 +112,11 @@ namespace ShiftOS.WinForms.Applications
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.newFolderToolStripMenuItem,
- this.deleteToolStripMenuItem});
+ this.deleteToolStripMenuItem,
+ this.connectToRemoteServerToolStripMenuItem,
+ this.copyToolStripMenuItem,
+ this.moveToolStripMenuItem,
+ this.pinToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(634, 24);
@@ -114,6 +135,35 @@ 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
+ //
+ this.connectToRemoteServerToolStripMenuItem.Name = "connectToRemoteServerToolStripMenuItem";
+ this.connectToRemoteServerToolStripMenuItem.Size = new System.Drawing.Size(153, 20);
+ this.connectToRemoteServerToolStripMenuItem.Text = "Connect to remote server";
+ this.connectToRemoteServerToolStripMenuItem.Visible = false;
+ //
+ // copyToolStripMenuItem
+ //
+ this.copyToolStripMenuItem.Name = "copyToolStripMenuItem";
+ this.copyToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
+ this.copyToolStripMenuItem.Text = "Copy";
+ this.copyToolStripMenuItem.Click += new System.EventHandler(this.copyToolStripMenuItem_Click);
+ //
+ // moveToolStripMenuItem
+ //
+ this.moveToolStripMenuItem.Name = "moveToolStripMenuItem";
+ this.moveToolStripMenuItem.Size = new System.Drawing.Size(49, 20);
+ this.moveToolStripMenuItem.Text = "Move";
+ this.moveToolStripMenuItem.Click += new System.EventHandler(this.moveToolStripMenuItem_Click);
+ //
+ // pinToolStripMenuItem
+ //
+ this.pinToolStripMenuItem.Name = "pinToolStripMenuItem";
+ this.pinToolStripMenuItem.Size = new System.Drawing.Size(36, 20);
+ this.pinToolStripMenuItem.Text = "Pin";
+ this.pinToolStripMenuItem.Click += new System.EventHandler(this.pinToolStripMenuItem_Click);
//
// FileSkimmer
//
@@ -140,5 +190,10 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem newFolderToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem connectToRemoteServerToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem moveToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem pinToolStripMenuItem;
+ private System.Windows.Forms.TreeView pinnedItems;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/FileSkimmer.cs b/ShiftOS.WinForms/Applications/FileSkimmer.cs
index 2881dc0..218e9e2 100644
--- a/ShiftOS.WinForms/Applications/FileSkimmer.cs
+++ b/ShiftOS.WinForms/Applications/FileSkimmer.cs
@@ -34,8 +34,8 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using static ShiftOS.Objects.ShiftFS.Utils;
-using Newtonsoft.Json;
using ShiftOS.Engine;
+using Newtonsoft.Json;
namespace ShiftOS.WinForms.Applications
{
@@ -125,6 +125,20 @@ namespace ShiftOS.WinForms.Applications
private string currentdir = "";
+ public void pinDirectory(string path)
+ {
+ int amountsCalled = -1;
+ amountsCalled = amountsCalled + 1;
+ List<string> Pinned = new List<string>();
+ if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
+ {
+ Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
+ }
+ Pinned.Add(path);
+ WriteAllText(Paths.GetPath("data") + "/pinned_items.dat", JsonConvert.SerializeObject(Pinned));
+ ResetList();
+ }
+
public void ChangeDirectory(string path)
{
currentdir = path;
@@ -145,8 +159,40 @@ namespace ShiftOS.WinForms.Applications
}
}
+ public void PopulatePinned(TreeNode node, string[] items)
+ {
+ foreach(var dir in items)
+ {
+ var treenode = new TreeNode();
+ if (DirectoryExists(dir))
+ {
+ var dinf = GetDirectoryInfo(dir);
+ treenode.Text = dinf.Name;
+ }
+ else if (FileExists(dir))
+ {
+ var finf = GetFileInfo(dir);
+ treenode.Text = finf.Name;
+ }
+ treenode.Tag = dir;
+ node.Nodes.Add(treenode);
+ }
+ }
+
public void ResetList()
{
+ pinnedItems.Nodes.Clear();
+ List<string> Pinned = new List<string>();
+ if(FileExists(Paths.GetPath("data") + "/pinned_items.dat"))
+ {
+ Pinned = JsonConvert.DeserializeObject<List<string>>(ReadAllText(Paths.GetPath("data") + "/pinned_items.dat"));
+ }
+ var node = new TreeNode();
+ node.Text = "Pinned";
+ PopulatePinned(node, Pinned.ToArray());
+ pinnedItems.Nodes.Add(node);
+ node.ExpandAll();
+
if(lvitems.LargeImageList == null)
{
lvitems.LargeImageList = new ImageList();
@@ -233,6 +279,8 @@ namespace ShiftOS.WinForms.Applications
return Properties.Resources.fileicon10;
case FileType.TextFile:
return Properties.Resources.fileicon2;
+ case FileType.CommandFormat:
+ return Properties.Resources.fileiconcf;
default:
return Properties.Resources.fileicon1;
}
@@ -257,6 +305,9 @@ namespace ShiftOS.WinForms.Applications
public void OnUpgrade()
{
+ moveToolStripMenuItem.Visible = false;
+ copyToolStripMenuItem.Visible = false;
+ deleteToolStripMenuItem.Visible = false;
}
private void newFolderToolStripMenuItem_Click(object sender, EventArgs e)
@@ -281,7 +332,170 @@ namespace ShiftOS.WinForms.Applications
}
});
}
- }
-
+ private void lvitems_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ try
+ {
+ if (currentdir != "__system")
+ {
+ var itm = lvitems.SelectedItems[0];
+ if (itm.Tag.ToString() != "__..")
+ {
+ 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");
+ }
+ }
+ }
+ }
+ catch
+ {
+ moveToolStripMenuItem.Visible = false;
+ copyToolStripMenuItem.Visible = false;
+ }
+ }
+
+ private void lvitems_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
+ {
+ if(lvitems.SelectedItems.Count == 0)
+ {
+ moveToolStripMenuItem.Visible = false;
+ copyToolStripMenuItem.Visible = false;
+ deleteToolStripMenuItem.Visible = false;
+ }
+ }
+
+ private void copyToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ string path = currentdir + "/" + lvitems.SelectedItems[0].Tag.ToString();
+ if (DirectoryExists(path))
+ {
+ FileSkimmerBackend.GetFile(new[] { "Directory" }, FileOpenerStyle.Save, (newPath) =>
+ {
+ Copy(path, newPath);
+ ResetList();
+ });
+ }
+ else if (FileExists(path))
+ {
+ string[] psplit = path.Split('.');
+ string ext = "." + psplit[psplit.Length - 1];
+ FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, (newPath) =>
+ {
+ Copy(path, newPath);
+ ResetList();
+ });
+
+ }
+ }
+ catch
+ {
+
+ }
+ }
+
+ private void moveToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ string path = currentdir + "/" + lvitems.SelectedItems[0].Tag.ToString();
+ if (DirectoryExists(path))
+ {
+ FileSkimmerBackend.GetFile(new[] { "Directory" }, FileOpenerStyle.Save, (newPath) =>
+ {
+ Utils.Move(path, newPath);
+ ResetList();
+ });
+ }
+ else if (FileExists(path))
+ {
+ string[] psplit = path.Split('.');
+ string ext = psplit[psplit.Length - 1];
+ FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, (newPath) =>
+ {
+ Utils.Move(path, newPath);
+ ResetList();
+ });
+
+ }
+ }
+ catch
+ {
+
+ }
+
+ }
+
+ 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 { }
+ }
+
+ private void pinToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ Infobox.PromptYesNo("Pin folder", "Are you sure you want to pin \"" + lvitems.SelectedItems[0].Text + "\"?", (result) =>
+ {
+ if (result == true)
+ {
+ if (currentdir != "__system" && lvitems.SelectedItems[0].Text != "Up one")
+ {
+ pinDirectory(currentdir + "/" + lvitems.SelectedItems[0].Text);
+ ResetList();
+ }
+ else
+ {
+ Infobox.Show("Cannot Pin", "You can only pin files or folders.");
+ }
+
+ }
+ });
+ }
+ catch { }
+ }
+
+ private void pinnedItems_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ if (pinnedItems.SelectedNode != null)
+ {
+ string path = pinnedItems.SelectedNode.Tag.ToString();
+ if (DirectoryExists(path))
+ {
+ currentdir = path;
+ ResetList();
+ }
+ else if (FileExists(path))
+ {
+ FileSkimmerBackend.OpenFile(path);
+ }
+ }
+ }
+ catch { }
+ }
+ }
}
diff --git a/ShiftOS.WinForms/Applications/FormatEditor.Designer.cs b/ShiftOS.WinForms/Applications/FormatEditor.Designer.cs
new file mode 100644
index 0000000..536ea62
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/FormatEditor.Designer.cs
@@ -0,0 +1,225 @@
+/*
+ * 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.Applications
+{
+ partial class FormatEditor
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.panelEditor = new System.Windows.Forms.Panel();
+ this.btnAddText = new System.Windows.Forms.Button();
+ this.btnAddOptionalText = new System.Windows.Forms.Button();
+ this.btnAddRegexText = new System.Windows.Forms.Button();
+ this.btnAddCommand = new System.Windows.Forms.Button();
+ this.lblExampleCommand = new System.Windows.Forms.Label();
+ this.btnAddColor = new System.Windows.Forms.Button();
+ this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+ this.btnTest = new System.Windows.Forms.Button();
+ this.btnSave = new System.Windows.Forms.Button();
+ this.btnLoad = new System.Windows.Forms.Button();
+ this.btnApply = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // panelEditor
+ //
+ this.panelEditor.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.panelEditor.AutoScroll = true;
+ this.panelEditor.Location = new System.Drawing.Point(4, 4);
+ this.panelEditor.Name = "panelEditor";
+ this.panelEditor.Size = new System.Drawing.Size(589, 46);
+ this.panelEditor.TabIndex = 1;
+ //
+ // btnAddText
+ //
+ this.btnAddText.Location = new System.Drawing.Point(4, 56);
+ this.btnAddText.Name = "btnAddText";
+ this.btnAddText.Size = new System.Drawing.Size(75, 23);
+ this.btnAddText.TabIndex = 2;
+ this.btnAddText.Text = "Add Text";
+ this.btnAddText.UseVisualStyleBackColor = true;
+ this.btnAddText.Click += new System.EventHandler(this.btnAddText_Click);
+ //
+ // btnAddOptionalText
+ //
+ this.btnAddOptionalText.Location = new System.Drawing.Point(85, 56);
+ this.btnAddOptionalText.Name = "btnAddOptionalText";
+ this.btnAddOptionalText.Size = new System.Drawing.Size(107, 23);
+ this.btnAddOptionalText.TabIndex = 3;
+ this.btnAddOptionalText.Text = "Add Optional Text";
+ this.btnAddOptionalText.UseVisualStyleBackColor = true;
+ this.btnAddOptionalText.Click += new System.EventHandler(this.btnAddOptionalText_Click);
+ //
+ // btnAddRegexText
+ //
+ this.btnAddRegexText.Location = new System.Drawing.Point(198, 56);
+ this.btnAddRegexText.Name = "btnAddRegexText";
+ this.btnAddRegexText.Size = new System.Drawing.Size(107, 23);
+ this.btnAddRegexText.TabIndex = 4;
+ this.btnAddRegexText.Text = "Add Regex Text";
+ this.btnAddRegexText.UseVisualStyleBackColor = true;
+ this.btnAddRegexText.Click += new System.EventHandler(this.btnAddRegexText_Click);
+ //
+ // btnAddCommand
+ //
+ this.btnAddCommand.Location = new System.Drawing.Point(4, 85);
+ this.btnAddCommand.Name = "btnAddCommand";
+ this.btnAddCommand.Size = new System.Drawing.Size(85, 23);
+ this.btnAddCommand.TabIndex = 5;
+ this.btnAddCommand.Text = "+ Namespace";
+ this.btnAddCommand.UseVisualStyleBackColor = true;
+ this.btnAddCommand.Click += new System.EventHandler(this.btnAddCommand_Click);
+ //
+ // lblExampleCommand
+ //
+ this.lblExampleCommand.AutoSize = true;
+ this.lblExampleCommand.Location = new System.Drawing.Point(4, 115);
+ this.lblExampleCommand.Name = "lblExampleCommand";
+ this.lblExampleCommand.Size = new System.Drawing.Size(290, 13);
+ this.lblExampleCommand.TabIndex = 8;
+ this.lblExampleCommand.Text = "Create a command and an example usage will show up here";
+ //
+ // btnAddColor
+ //
+ this.btnAddColor.Location = new System.Drawing.Point(311, 56);
+ this.btnAddColor.Name = "btnAddColor";
+ this.btnAddColor.Size = new System.Drawing.Size(64, 23);
+ this.btnAddColor.TabIndex = 9;
+ this.btnAddColor.Text = "Add Color";
+ this.btnAddColor.UseVisualStyleBackColor = true;
+ this.btnAddColor.Click += new System.EventHandler(this.btnAddColor_Click);
+ //
+ // richTextBox1
+ //
+ this.richTextBox1.Location = new System.Drawing.Point(7, 132);
+ this.richTextBox1.Multiline = false;
+ this.richTextBox1.Name = "richTextBox1";
+ this.richTextBox1.Size = new System.Drawing.Size(476, 23);
+ this.richTextBox1.TabIndex = 10;
+ this.richTextBox1.Text = "";
+ this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
+ //
+ // btnTest
+ //
+ this.btnTest.Location = new System.Drawing.Point(490, 132);
+ this.btnTest.Name = "btnTest";
+ this.btnTest.Size = new System.Drawing.Size(47, 23);
+ this.btnTest.TabIndex = 11;
+ this.btnTest.Text = "Test";
+ this.btnTest.UseVisualStyleBackColor = true;
+ this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
+ //
+ // btnSave
+ //
+ this.btnSave.Location = new System.Drawing.Point(7, 161);
+ this.btnSave.Name = "btnSave";
+ this.btnSave.Size = new System.Drawing.Size(47, 23);
+ this.btnSave.TabIndex = 13;
+ this.btnSave.Text = "Save";
+ this.btnSave.UseVisualStyleBackColor = true;
+ this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
+ //
+ // btnLoad
+ //
+ this.btnLoad.Location = new System.Drawing.Point(60, 161);
+ this.btnLoad.Name = "btnLoad";
+ this.btnLoad.Size = new System.Drawing.Size(47, 23);
+ this.btnLoad.TabIndex = 14;
+ this.btnLoad.Text = "Load";
+ this.btnLoad.UseVisualStyleBackColor = true;
+ this.btnLoad.Click += new System.EventHandler(this.btnLoad_Click);
+ //
+ // btnApply
+ //
+ this.btnApply.Location = new System.Drawing.Point(113, 161);
+ this.btnApply.Name = "btnApply";
+ this.btnApply.Size = new System.Drawing.Size(47, 23);
+ this.btnApply.TabIndex = 15;
+ this.btnApply.Text = "Apply";
+ this.btnApply.UseVisualStyleBackColor = true;
+ this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
+ //
+ // FormatEditor
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.btnApply);
+ this.Controls.Add(this.btnLoad);
+ this.Controls.Add(this.btnSave);
+ this.Controls.Add(this.btnTest);
+ this.Controls.Add(this.richTextBox1);
+ this.Controls.Add(this.btnAddColor);
+ this.Controls.Add(this.lblExampleCommand);
+ this.Controls.Add(this.btnAddText);
+ this.Controls.Add(this.btnAddOptionalText);
+ this.Controls.Add(this.btnAddRegexText);
+ this.Controls.Add(this.btnAddCommand);
+ this.Controls.Add(this.panelEditor);
+ this.Name = "FormatEditor";
+ this.Size = new System.Drawing.Size(596, 426);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Panel panelEditor;
+ private System.Windows.Forms.Button btnAddText;
+ private System.Windows.Forms.Button btnAddOptionalText;
+ private System.Windows.Forms.Button btnAddRegexText;
+ private System.Windows.Forms.Button btnAddCommand;
+ private System.Windows.Forms.Label lblExampleCommand;
+ private System.Windows.Forms.Button btnAddColor;
+ private System.Windows.Forms.RichTextBox richTextBox1;
+ private System.Windows.Forms.Button btnTest;
+ private System.Windows.Forms.Button btnSave;
+ private System.Windows.Forms.Button btnLoad;
+ private System.Windows.Forms.Button btnApply;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/FormatEditor.cs b/ShiftOS.WinForms/Applications/FormatEditor.cs
new file mode 100644
index 0000000..6c84661
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/FormatEditor.cs
@@ -0,0 +1,186 @@
+/*
+ * 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.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Applications {
+ [MultiplayerOnly]
+ [Launcher("Format Editor", true, "al_format_editor", "Customization")]
+ [AppscapeEntry("Format Editor", "Edit the syntax of your Terminal to be however you like.", 740, 750, "file_skimmer", "Customization")]
+ [WinOpen("formateditor")]
+ [DefaultTitle("Format Editor")]
+ [DefaultIcon("iconFormatEditor")]
+ public partial class FormatEditor : UserControl, IShiftOSWindow {
+
+ IList<CommandFormat> parts = new List<CommandFormat>();
+ CommandParser parser = new CommandParser();
+ IList<Panel> editorBoxes = new List<Panel>();
+
+ string commandMode = "namespace";
+ int avcount = 0;
+
+ public FormatEditor() {
+ InitializeComponent();
+ }
+
+ public void OnLoad() {
+ OnUpgrade();
+ }
+
+ public void OnSkinLoad() { }
+
+ public bool OnUnload() { return true; }
+
+ public void OnUpgrade() {
+ btnAddOptionalText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_optional_text");
+ btnAddRegexText.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_regex");
+ btnAddColor.Visible = ShiftoriumFrontend.UpgradeInstalled("format_editor_syntax_highlighting");
+ }
+
+ private void addPart(CommandFormat part) {
+ parser.AddPart(part);
+
+ addPart(part.Draw());
+ }
+
+ private void addPart(Control part) {
+ Panel container = new Panel();
+
+ Control drawnPart = part;
+ container.Size = drawnPart.Size;
+ container.Controls.Add(drawnPart);
+
+ int woffset = 0;
+ if (editorBoxes.Count > 0) {
+ woffset = editorBoxes.Last().Width + editorBoxes.Last().Location.X;
+ } else {
+ woffset = 0;
+ }
+
+ container.Location = new Point(woffset, 0);
+ editorBoxes.Add(container);
+ panelEditor.Controls.Add(container);
+ }
+
+ private void btnAddText_Click(object sender, EventArgs e) {
+ addPart(new CommandFormatText());
+ }
+
+ private void btnAddOptionalText_Click(object sender, EventArgs e) {
+ addPart(new CommandFormatOptionalText());
+ }
+
+ private void btnAddRegexText_Click(object sender, EventArgs e) {
+
+ }
+
+ private void btnAddColor_Click(object sender, EventArgs e) {
+
+ }
+
+ private void btnAddCommand_Click(object sender, EventArgs e) {
+ switch (commandMode) {
+ case "namespace":
+ addPart(new CommandFormatNamespace());
+ commandMode = "command";
+ btnAddCommand.Text = "+ Command";
+ break;
+ case "command":
+ addPart(new CommandFormatCommand());
+ commandMode = "argument";
+ btnAddCommand.Text = "+ Argument";
+ break;
+ case "argument":
+ addPart(new CommandFormatArgument());
+ commandMode = "value";
+ btnAddCommand.Text = "+ \"Value\"";
+ break;
+ case "value":
+ addPart(new CommandFormatValue());
+ avcount++;
+ if (avcount >= 2) {
+ commandMode = "";
+ btnAddCommand.Text = "";
+ btnAddCommand.Enabled = false;
+ }else {
+ commandMode = "argument";
+ btnAddCommand.Text = "+ Argument";
+ }
+ break;
+ }
+ }
+
+ private void richTextBox1_TextChanged(object sender, EventArgs e) {
+ var result = parser.ParseCommand(richTextBox1.Text);
+
+ if (result.Equals(default(KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>))) {
+ lblExampleCommand.Text = "Syntax Error";
+ } else {
+ string argvs = "{";
+
+ foreach (KeyValuePair<string, string> entry in result.Value) {
+ argvs += entry.Key + "=\"" + entry.Value + "\", ";
+ }
+
+ argvs += "}";
+
+ lblExampleCommand.Text = result.Key + argvs;
+ }
+ }
+
+ private void btnTest_Click(object sender, EventArgs e) {
+
+ }
+
+ private void btnSave_Click(object sender, EventArgs e) {
+ CurrentCommandParser.parser = parser;
+
+ FileSkimmerBackend.GetFile(new string[] { ".cf" }, FileOpenerStyle.Save, new Action<string>((result) => {
+ Objects.ShiftFS.Utils.WriteAllText(result, parser.Save());
+ }));
+ }
+
+ private void btnLoad_Click(object sender, EventArgs e) {
+ FileSkimmerBackend.GetFile(new string[] { ".cf" }, FileOpenerStyle.Open, new Action<string>((result) => {
+ parser = CommandParser.Load(Objects.ShiftFS.Utils.ReadAllText(result));
+ foreach(CommandFormat part in parser.parts) {
+ addPart(part.Draw());
+ }
+ }));
+ }
+
+ private void btnApply_Click(object sender, EventArgs e) {
+ CurrentCommandParser.parser = parser;
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/FormatEditor.resx b/ShiftOS.WinForms/Applications/FormatEditor.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/FormatEditor.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs
index 2dfe7ec..85f95bd 100644
--- a/ShiftOS.WinForms/Applications/GraphicPicker.cs
+++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs
@@ -37,6 +37,7 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
[DefaultTitle("Choose graphic")] [DefaultIcon("icongraphicpicker")]
public partial class GraphicPicker : UserControl, IShiftOSWindow
{
@@ -82,12 +83,11 @@ 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<string>((file) =>
+ AppearanceManager.SetupDialog(new FileDialog(new[] { ".png", ".gif", ".jpg", ".bmp", ".pic" }, FileOpenerStyle.Open, new Action<string>((file) =>
{
ImageAsBinary = Utils.ReadAllBytes(file);
System.IO.File.WriteAllBytes("temp_bin.bmp", ImageAsBinary);
Image = SkinEngine.ImageFromBinary(ImageAsBinary);
- Image.Save("temp.bmp", System.Drawing.Imaging.ImageFormat.Bmp);
Setup();
})));
}
diff --git a/ShiftOS.WinForms/Applications/Installer.Designer.cs b/ShiftOS.WinForms/Applications/Installer.Designer.cs
new file mode 100644
index 0000000..b01986d
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Installer.Designer.cs
@@ -0,0 +1,157 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class Installer
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.lbtitle = new System.Windows.Forms.Label();
+ this.pnlselectfile = new System.Windows.Forms.Panel();
+ this.btnstart = new System.Windows.Forms.Button();
+ this.btnbrowse = new System.Windows.Forms.Button();
+ this.txtfilepath = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.lbprogress = new System.Windows.Forms.Label();
+ this.pginstall = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
+ this.pnlselectfile.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // lbtitle
+ //
+ this.lbtitle.AutoSize = true;
+ this.lbtitle.Location = new System.Drawing.Point(14, 13);
+ this.lbtitle.Name = "lbtitle";
+ this.lbtitle.Size = new System.Drawing.Size(155, 13);
+ this.lbtitle.TabIndex = 0;
+ this.lbtitle.Tag = "header2";
+ this.lbtitle.Text = "Installing MUD Control Centre...";
+ //
+ // pnlselectfile
+ //
+ this.pnlselectfile.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.pnlselectfile.Controls.Add(this.btnstart);
+ this.pnlselectfile.Controls.Add(this.btnbrowse);
+ this.pnlselectfile.Controls.Add(this.txtfilepath);
+ this.pnlselectfile.Controls.Add(this.label1);
+ this.pnlselectfile.Location = new System.Drawing.Point(17, 48);
+ this.pnlselectfile.Name = "pnlselectfile";
+ this.pnlselectfile.Size = new System.Drawing.Size(414, 85);
+ this.pnlselectfile.TabIndex = 1;
+ this.pnlselectfile.VisibleChanged += new System.EventHandler(this.pnlselectfile_VisibleChanged);
+ //
+ // btnstart
+ //
+ this.btnstart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnstart.Location = new System.Drawing.Point(255, 59);
+ this.btnstart.Name = "btnstart";
+ this.btnstart.Size = new System.Drawing.Size(75, 23);
+ this.btnstart.TabIndex = 3;
+ this.btnstart.Text = "Start";
+ this.btnstart.UseVisualStyleBackColor = true;
+ this.btnstart.Click += new System.EventHandler(this.btnstart_Click);
+ //
+ // btnbrowse
+ //
+ this.btnbrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnbrowse.Location = new System.Drawing.Point(336, 60);
+ this.btnbrowse.Name = "btnbrowse";
+ this.btnbrowse.Size = new System.Drawing.Size(75, 23);
+ this.btnbrowse.TabIndex = 2;
+ this.btnbrowse.Text = "Browse...";
+ this.btnbrowse.UseVisualStyleBackColor = true;
+ this.btnbrowse.Click += new System.EventHandler(this.btnbrowse_Click);
+ //
+ // txtfilepath
+ //
+ this.txtfilepath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtfilepath.Location = new System.Drawing.Point(16, 34);
+ this.txtfilepath.Name = "txtfilepath";
+ this.txtfilepath.Size = new System.Drawing.Size(395, 20);
+ this.txtfilepath.TabIndex = 1;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(13, 9);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(126, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Select a .stp file to install.";
+ //
+ // lbprogress
+ //
+ this.lbprogress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lbprogress.AutoSize = true;
+ this.lbprogress.Location = new System.Drawing.Point(17, 140);
+ this.lbprogress.Name = "lbprogress";
+ this.lbprogress.Size = new System.Drawing.Size(35, 13);
+ this.lbprogress.TabIndex = 3;
+ this.lbprogress.Text = "label1";
+ //
+ // pginstall
+ //
+ this.pginstall.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.pginstall.Location = new System.Drawing.Point(17, 161);
+ this.pginstall.Maximum = 100;
+ this.pginstall.Name = "pginstall";
+ this.pginstall.Size = new System.Drawing.Size(414, 23);
+ this.pginstall.TabIndex = 2;
+ this.pginstall.Text = "shiftedProgressBar1";
+ this.pginstall.Value = 0;
+ //
+ // Installer
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lbprogress);
+ this.Controls.Add(this.pginstall);
+ this.Controls.Add(this.pnlselectfile);
+ this.Controls.Add(this.lbtitle);
+ this.Name = "Installer";
+ this.Size = new System.Drawing.Size(447, 203);
+ this.pnlselectfile.ResumeLayout(false);
+ this.pnlselectfile.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbtitle;
+ private System.Windows.Forms.Panel pnlselectfile;
+ private Controls.ShiftedProgressBar pginstall;
+ private System.Windows.Forms.Label lbprogress;
+ private System.Windows.Forms.Button btnstart;
+ private System.Windows.Forms.Button btnbrowse;
+ private System.Windows.Forms.TextBox txtfilepath;
+ private System.Windows.Forms.Label label1;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/Installer.cs b/ShiftOS.WinForms/Applications/Installer.cs
new file mode 100644
index 0000000..bd40a6d
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Installer.cs
@@ -0,0 +1,259 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using System.Threading;
+using static ShiftOS.Objects.ShiftFS.Utils;
+using Newtonsoft.Json;
+
+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()
+ {
+ InitializeComponent();
+ lbtitle.Text = "Select file";
+ }
+
+ public void InitiateInstall(Installation install)
+ {
+ pnlselectfile.Hide();
+ pginstall.Show();
+ lbprogress.Show();
+ lbtitle.Text = install.Name;
+ install.ProgressReported += (p) =>
+ {
+ Desktop.InvokeOnWorkerThread(new Action(() =>
+ {
+ pginstall.Value = p;
+ }));
+ };
+ install.StatusReported += (s) =>
+ {
+ Desktop.InvokeOnWorkerThread(new Action(() =>
+ {
+ lbprogress.Text = s;
+ }));
+ };
+ install.InstallCompleted += () =>
+ {
+ Desktop.InvokeOnWorkerThread(new Action(() =>
+ {
+ lbtitle.Text = "Select file";
+ pnlselectfile.Show();
+ }));
+ isInstalling = false;
+ InstallCompleted?.Invoke();
+ };
+ while (!this.Visible)
+ {
+
+ }
+ isInstalling = true;
+ install.Install();
+ }
+
+ public void OnLoad()
+ {
+ btnstart.Hide();
+ pginstall.Hide();
+ lbprogress.Hide();
+ }
+
+ private bool isInstalling = false;
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ return !isInstalling; //Don't close if an install is running.
+ }
+
+ public void OnUpgrade()
+ {
+
+ }
+
+ private void pnlselectfile_VisibleChanged(object sender, EventArgs e)
+ {
+ if(this.ParentForm != null)
+ {
+ this.ParentForm.Height = (pnlselectfile.Visible == true) ? this.ParentForm.Height + pnlselectfile.Height : this.ParentForm.Height - pnlselectfile.Height;
+ }
+ }
+ public event Action InstallCompleted;
+
+ private void btnbrowse_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".stp" }, FileOpenerStyle.Open, (file) =>
+ {
+ txtfilepath.Text = file;
+ btnstart.Show();
+ });
+ }
+
+ private void btnstart_Click(object sender, EventArgs e)
+ {
+ if (FileExists(txtfilepath.Text))
+ {
+ var install = new StpInstallation(txtfilepath.Text);
+ InitiateInstall(install);
+ }
+ else
+ {
+ Infobox.Show("File not found.", "The file you requested was not found on the system.");
+ }
+ }
+ }
+
+ public abstract class Installation
+ {
+ /// <summary>
+ /// The display name of the installation.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Occurs when the installation updates its status.
+ /// </summary>
+ public event Action<string> StatusReported;
+ /// <summary>
+ /// Occurs when the installation updates its progress percentage.
+ /// </summary>
+ public event Action<int> ProgressReported;
+ /// <summary>
+ /// Occurs when the installation completes.
+ /// </summary>
+ public event Action InstallCompleted;
+
+ /// <summary>
+ /// Start the installation.
+ /// </summary>
+ public void Install()
+ {
+ var t = new System.Threading.Thread(() =>
+ {
+ ProgressReported?.Invoke(0);
+ StatusReported?.Invoke("");
+ Run();
+ ProgressReported?.Invoke(100);
+ StatusReported?.Invoke("Installation completed.");
+ InstallCompleted?.Invoke();
+ });
+ t.IsBackground = true;
+ t.Start();
+ }
+
+ /// <summary>
+ /// Sets the install progress percentage.
+ /// </summary>
+ /// <param name="value">The installation percentage.</param>
+ protected void SetProgress(int value)
+ {
+ if (value < 0 || value > 100)
+ throw new ArgumentOutOfRangeException("value", "A percentage is typically between 0 and 100.... derp...");
+ ProgressReported?.Invoke(value);
+ }
+
+ /// <summary>
+ /// Sets the install status text.
+ /// </summary>
+ /// <param name="status">Text to display as status.</param>
+ protected void SetStatus(string status)
+ {
+ StatusReported?.Invoke(status);
+ }
+
+ /// <summary>
+ /// User-defined code to run during install. Once this code is ran, the installation is complete.
+ /// </summary>
+ protected abstract void Run();
+ }
+
+ public class StpInstallation : Installation
+ {
+ public StpInstallation(string stpfile) : base()
+ {
+ if (!FileExists(stpfile))
+ throw new System.IO.FileNotFoundException("An attempt to install a ShiftOS setup package failed because the package was not found.", stpfile);
+ string json = ReadAllText(stpfile);
+ var contents = JsonConvert.DeserializeObject<StpContents>(json);
+ this.Name = contents.Name;
+ Contents = contents;
+ }
+
+ public StpContents Contents { get; set; }
+
+ protected override void Run()
+ {
+ if (Shiftorium.UpgradeInstalled(Contents.Upgrade))
+ {
+ Infobox.Show("Installation failed.", "This package has already been installed.");
+ return;
+ }
+
+ if (!string.IsNullOrWhiteSpace(Contents.Dependencies))
+ {
+ SetStatus("Checking Shiftorium for dependencies...");
+ string[] dependencies = Contents.Dependencies.Split(';');
+ for (int i = 0; i < dependencies.Length; i++)
+ {
+ if (Shiftorium.UpgradeInstalled(dependencies[i]))
+ {
+ double percent = (i / dependencies.Length) * 100;
+ SetProgress((int)percent);
+ }
+ else
+ {
+ var upg = Shiftorium.GetDefaults().FirstOrDefault(x => x.Id == dependencies[i]);
+ Infobox.Show("Missing dependency!", $"You are missing the following Shiftorium Upgrade: {upg.Name}\r\n\r\nThe installation cannot continue.");
+ return;
+ }
+ Thread.Sleep(250);
+ }
+ }
+ SetStatus("Installing...");
+ SetProgress(0);
+ for(int i = 0; i < 100; i++)
+ {
+ SetProgress(i);
+ Thread.Sleep(50);
+ }
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ Shiftorium.Buy(Contents.Upgrade, 0);
+ Infobox.Show("Install complete.", "The installation has completed successfully.");
+ SaveSystem.SaveGame();
+ });
+ }
+ }
+
+ public class StpContents : RequiresUpgradeAttribute
+ {
+ public StpContents(string name, string author, string dependencies = "") : base(name.ToLower().Replace(" ", "_"))
+ {
+ Name = name;
+ Author = author;
+ Dependencies = dependencies;
+ }
+
+ public string Name { get; set; }
+ public string Author { get; set; }
+ public string Dependencies { get; set; }
+ }
+
+}
diff --git a/ShiftOS.WinForms/Applications/Installer.resx b/ShiftOS.WinForms/Applications/Installer.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/Installer.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.Designer.cs
index ba4c4f1..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();
@@ -148,6 +152,8 @@ namespace ShiftOS.WinForms.Applications
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();
@@ -180,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);
@@ -281,26 +286,12 @@ 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
//
//
// toolStripContainer1.ContentPanel
//
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.pnlclasses);
this.toolStripContainer1.ContentPanel.Controls.Add(this.you_systemstatus);
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_all);
this.toolStripContainer1.ContentPanel.Controls.Add(this.shop_view);
@@ -322,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);
@@ -1198,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);
@@ -1336,8 +1400,12 @@ 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;
+ private System.Windows.Forms.Button btnchooseclass;
+ private System.Windows.Forms.ListBox lbclasses;
+ private System.Windows.Forms.Label lbclassdesc;
+ private System.Windows.Forms.Label lbclasstitle;
}
}
diff --git a/ShiftOS.WinForms/Applications/MUDControlCentre.cs b/ShiftOS.WinForms/Applications/MUDControlCentre.cs
index 02fe868..97212e7 100644
--- a/ShiftOS.WinForms/Applications/MUDControlCentre.cs
+++ b/ShiftOS.WinForms/Applications/MUDControlCentre.cs
@@ -38,7 +38,8 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
- [RequiresUpgrade("mud_fundamentals")]
+ [MultiplayerOnly]
+ [RequiresUpgrade("mud_control_centre")]
[Launcher("MUD Control Centre", true, "al_mud_control_centre", "Networking")]
[WinOpen("mud_control_centre")]
[DefaultIcon("iconSysinfo")]
@@ -99,7 +100,7 @@ namespace ShiftOS.WinForms.Applications
{
ServerManager.SendMessage("shop_removeowned", JsonConvert.SerializeObject(new
{
- username = SaveSystem.CurrentSave.Username
+ username = SaveSystem.CurrentUser.Username
}));
ShowCreateShop();
}
@@ -176,6 +177,42 @@ namespace ShiftOS.WinForms.Applications
};
}
+
+
+ internal void ShowClasses()
+ {
+ var descriptions = new Dictionary<UserClass, string> {
+
+ { UserClass.Skinner, "Skinners, otherwise known as \"Shifters\" due to their excessive use of the Shifter application, like to customize ShiftOS to look like other operating systems or even have an entirely different UI. They gain heaps of codepoints from it, and like to sell their skins for even more Codepoints." },
+ { UserClass.Hacker, "Hackers are notorious for taking down large groups and individuals of which have many useful documents and Codepoints on their system. Hackers enjoy the rush of typing malicious commands into their terminals and seeing how they affect their target." },
+ { UserClass.Investigator, "Much like hackers, investigators are skilled with a terminal and breaching systems, but they don't do it directly for monetary gain. They will search a target's system for any files and clues that may lead to them being guilty of a crime within the digital society. Unlike Hackers, Investigators mostly have higher reputations in society, and go after those with lower reputations."},
+ { UserClass.Explorer, "Explorers like to venture the vast regions of the multi-user domain and Shiftnet looking for secrets, hidden tools and software, and finding the hidden truths behind their screen. Explorers don't always know how to hack, but if it involves finding a secret about ShiftOS, they will do it. They typically do not have malicious intent."},
+ { UserClass.SafetyActivist, "Safety Activists are skilled with exploitation and hacking, but they only go after the worst there is in the multi-user domain. Crime rings, large hacker groups, you name it. Their primary goal is keeping the multi-user domain safe." },
+ { UserClass.PenetrationTester, "Penetration testers go hand-in-hand with Safety Activists. They go after the good guys, but rather than attacking them, they alert them that an exploit was found in their service and that this exploit should be fixed. They are a gray subject though - you never know if you are dealing with a genuine pen-tester or a hacker skilled with social engineering. Be careful." },
+ { UserClass.Collector, "Collectors go well with Explorers - however, Collectors are the ones who open shops. They like to find rare objects and sell them for Codepoints." },
+ {UserClass.Programmer, "Programmers are the ones who write applications and services for ShiftOS and the multi-user domain. Depending on the code that they write, they can be seen as either morally wrong sentiences or morally correct sentiences, it's up to their decisions." },
+
+ };
+
+ lbclasses.Items.Clear();
+ lbclasses.SelectedIndexChanged += (o, a) =>
+ {
+ newClass = (UserClass)Enum.Parse(typeof(UserClass), lbclasses.SelectedItem.ToString());
+ lbclassdesc.Text = descriptions[newClass];
+ lbclasstitle.Text = newClass.ToString();
+ };
+ foreach (var kv in descriptions)
+ {
+ lbclasses.Items.Add(kv.Key.ToString());
+
+ }
+ menuStrip1.Hide();
+ pnlclasses.Show();
+ pnlclasses.BringToFront();
+ }
+
+ UserClass newClass = UserClass.None;
+
public void ListAllChats(Channel[] channels)
{
shop_all.BringToFront();
@@ -237,9 +274,10 @@ namespace ShiftOS.WinForms.Applications
}
+ [Obsolete("MUD control center is dying! KILL IT!")]
public void OpenChat(string id)
{
- AppearanceManager.SetupWindow(new Chat(id));
+// AppearanceManager.SetupWindow(new Chat(id));
}
private Shop editingShop = null;
@@ -252,7 +290,7 @@ namespace ShiftOS.WinForms.Applications
creatingShop = true;
editingShop.Name = "My shop";
editingShop.Description = "My shop has lots of awesome items. You should buy from my shop.";
- editingShop.Owner = SaveSystem.CurrentSave.Username;
+ editingShop.Owner = SaveSystem.CurrentUser.Username;
editingShop.Items = new List<ShopItem>();
shop_editor.BringToFront();
PopulateShopEditor();
@@ -364,7 +402,7 @@ namespace ShiftOS.WinForms.Applications
lbprice.Text = $"Cost: {item.Cost} CP";
btnbuy.Show();
};
- if(shop.Owner == SaveSystem.CurrentSave.Username)
+ if(shop.Owner == SaveSystem.CurrentUser.Username)
{
btneditshop.Show();
}
@@ -522,7 +560,7 @@ namespace ShiftOS.WinForms.Applications
you_systemstatus.BringToFront();
- lblsysstatus.Text = $@"Username: {SaveSystem.CurrentSave.Username}
+ lblsysstatus.Text = $@"Username: {SaveSystem.CurrentUser.Username}
System name: {SaveSystem.CurrentSave.SystemName}
Codepoints: {SaveSystem.CurrentSave.Codepoints}
@@ -532,6 +570,8 @@ System version: {SaveSystem.CurrentSave.MajorVersion}.{SaveSystem.CurrentSave.Mi
Shared scripts: {scripts}
+Reputation: {SaveSystem.CurrentSave.RawReputation} ({SaveSystem.CurrentSave.Reputation})
+
Current legions: {legionname}";
}
@@ -551,7 +591,7 @@ Current legions: {legionname}";
private void tsMemos_Click(object sender, EventArgs e)
{
ServerManager.SendMessage("get_memos_for_user", $@"{{
- username: ""{SaveSystem.CurrentSave.Username}""
+ username: ""{SaveSystem.CurrentUser.Username}""
}}");
you_memos.BringToFront();
}
@@ -603,6 +643,11 @@ Current legions: {legionname}";
ServerManager.SendMessage("legion_get_all", "");
}
+ public void ShowLegionSelector()
+ {
+ ServerManager.SendMessage("legion_get_all", "");
+ }
+
private void btnjoinlegion_Click(object sender, EventArgs e)
{
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
@@ -611,8 +656,12 @@ Current legions: {legionname}";
SaveSystem.SaveGame();
ServerManager.SendMessage("user_get_legion", JsonConvert.SerializeObject(SaveSystem.CurrentSave));
+ LegionChanged?.Invoke();
+
}
+ public event Action LegionChanged;
+
private void btnleavelegion_Click(object sender, EventArgs e)
{
string shortname = lblegiontitle.Text.Split(']')[0].Remove(0, 1);
@@ -763,7 +812,7 @@ Current legions: {legionname}";
{
ServerManager.SendMessage("user_shop_check", JsonConvert.SerializeObject(new
{
- username = SaveSystem.CurrentSave.Username
+ username = SaveSystem.CurrentUser.Username
}));
}
@@ -846,7 +895,7 @@ Current legions: {legionname}";
private void myShopToolStripMenuItem_Click(object sender, EventArgs e)
{
- ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentSave.Username);
+ ServerManager.SendMessage("user_get_shop", SaveSystem.CurrentUser.Username);
}
private void btneditshop_Click(object sender, EventArgs e)
@@ -874,7 +923,7 @@ Current legions: {legionname}";
{
ServerManager.SendMessage("delete_save", JsonConvert.SerializeObject(new ClientSave
{
- Username = SaveSystem.CurrentSave.Username,
+ Username = SaveSystem.CurrentUser.Username,
Password = SaveSystem.CurrentSave.Password
}));
@@ -889,5 +938,21 @@ Current legions: {legionname}";
}
});
}
+
+ public event Action ClassChanged;
+
+ private void btnchooseclass_Click(object sender, EventArgs e)
+ {
+ if(newClass != UserClass.None)
+ {
+ SaveSystem.CurrentSave.Class = newClass;
+ SaveSystem.SaveGame();
+ ClassChanged?.Invoke();
+ menuStrip1.Show();
+ pnlclasses.SendToBack();
+ this.SetupSystemStatus();
+ return;
+ }
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/NameChanger.cs b/ShiftOS.WinForms/Applications/NameChanger.cs
index ca76e57..5506aea 100644
--- a/ShiftOS.WinForms/Applications/NameChanger.cs
+++ b/ShiftOS.WinForms/Applications/NameChanger.cs
@@ -38,8 +38,9 @@ using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications {
- [Launcher("Name Changer", true, "al_name_changer", "Customization")]
- [RequiresUpgrade("name_changer")]
+ [MultiplayerOnly]
+ [Launcher("Name Changer", false, null, "Customization")]
+ [AppscapeEntry("Name Changer", "Want to change the names of applications within ShiftOS? This application lets you do just that.", 342, 500, "skinning;file_skimmer;wm_titlebar", "Customization")]
[WinOpen("name_changer")]
[DefaultTitle("Name Changer")]
[DefaultIcon("iconNameChanger")]
diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs
index faaf0f5..0254e94 100644
--- a/ShiftOS.WinForms/Applications/Pong.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs
@@ -79,6 +79,19 @@ 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.pnlmultiplayerhandshake = new System.Windows.Forms.Panel();
+ this.lvotherplayers = new System.Windows.Forms.ListView();
+ this.lbmpstatus = new System.Windows.Forms.Label();
+ this.pnlintro = new System.Windows.Forms.Panel();
+ this.btnmatchmake = new System.Windows.Forms.Button();
+ this.Label6 = new System.Windows.Forms.Label();
+ this.btnstartgame = new System.Windows.Forms.Button();
+ this.Label8 = new System.Windows.Forms.Label();
+ this.pnlhighscore = new System.Windows.Forms.Panel();
+ this.lbhighscore = new System.Windows.Forms.ListView();
+ 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 +104,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();
@@ -109,10 +119,6 @@ namespace ShiftOS.WinForms.Applications
this.btnlosetryagain = new System.Windows.Forms.Button();
this.Label5 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
- this.pnlintro = new System.Windows.Forms.Panel();
- this.Label6 = new System.Windows.Forms.Label();
- this.btnstartgame = new System.Windows.Forms.Button();
- this.Label8 = new System.Windows.Forms.Label();
this.lblbeatai = new System.Windows.Forms.Label();
this.lblcountdown = new System.Windows.Forms.Label();
this.ball = new ShiftOS.WinForms.Controls.Canvas();
@@ -122,16 +128,15 @@ 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.pnlmultiplayerhandshake.SuspendLayout();
+ this.pnlintro.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
@@ -157,11 +162,12 @@ namespace ShiftOS.WinForms.Applications
// pgcontents
//
this.pgcontents.BackColor = System.Drawing.Color.White;
+ this.pgcontents.Controls.Add(this.pnlmultiplayerhandshake);
+ this.pgcontents.Controls.Add(this.pnlintro);
this.pgcontents.Controls.Add(this.pnlhighscore);
this.pgcontents.Controls.Add(this.pnlgamestats);
this.pgcontents.Controls.Add(this.pnlfinalstats);
this.pgcontents.Controls.Add(this.pnllose);
- this.pgcontents.Controls.Add(this.pnlintro);
this.pgcontents.Controls.Add(this.lblbeatai);
this.pgcontents.Controls.Add(this.lblcountdown);
this.pgcontents.Controls.Add(this.ball);
@@ -174,11 +180,155 @@ 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(912, 504);
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);
//
+ // pnlmultiplayerhandshake
+ //
+ this.pnlmultiplayerhandshake.Controls.Add(this.lvotherplayers);
+ this.pnlmultiplayerhandshake.Controls.Add(this.lbmpstatus);
+ this.pnlmultiplayerhandshake.Location = new System.Drawing.Point(446, 88);
+ this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake";
+ this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231);
+ this.pnlmultiplayerhandshake.TabIndex = 15;
+ this.pnlmultiplayerhandshake.Visible = false;
+ //
+ // lvotherplayers
+ //
+ this.lvotherplayers.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lvotherplayers.Location = new System.Drawing.Point(0, 45);
+ this.lvotherplayers.MultiSelect = false;
+ this.lvotherplayers.Name = "lvotherplayers";
+ this.lvotherplayers.Size = new System.Drawing.Size(396, 186);
+ this.lvotherplayers.TabIndex = 1;
+ this.lvotherplayers.UseCompatibleStateImageBehavior = false;
+ this.lvotherplayers.View = System.Windows.Forms.View.Details;
+ this.lvotherplayers.DoubleClick += new System.EventHandler(this.lvotherplayers_DoubleClick);
+ //
+ // lbmpstatus
+ //
+ this.lbmpstatus.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbmpstatus.Location = new System.Drawing.Point(0, 0);
+ this.lbmpstatus.Name = "lbmpstatus";
+ this.lbmpstatus.Size = new System.Drawing.Size(396, 45);
+ this.lbmpstatus.TabIndex = 0;
+ this.lbmpstatus.Tag = "header2";
+ this.lbmpstatus.Text = "Waiting for other players...";
+ this.lbmpstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // pnlintro
+ //
+ this.pnlintro.Controls.Add(this.btnmatchmake);
+ 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(0, 0);
+ this.pnlintro.Name = "pnlintro";
+ this.pnlintro.Size = new System.Drawing.Size(595, 303);
+ this.pnlintro.TabIndex = 13;
+ this.pnlintro.Tag = "header2";
+ //
+ // btnmatchmake
+ //
+ this.btnmatchmake.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnmatchmake.Location = new System.Drawing.Point(188, 253);
+ this.btnmatchmake.Name = "btnmatchmake";
+ this.btnmatchmake.Size = new System.Drawing.Size(242, 28);
+ this.btnmatchmake.TabIndex = 16;
+ this.btnmatchmake.Text = "Or, play against another Shifter!";
+ this.btnmatchmake.UseVisualStyleBackColor = true;
+ this.btnmatchmake.Click += new System.EventHandler(this.btnmatchmake_Click);
+ //
+ // Label6
+ //
+ this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Label6.Location = new System.Drawing.Point(3, 39);
+ this.Label6.Name = "Label6";
+ this.Label6.Size = new System.Drawing.Size(589, 159);
+ this.Label6.TabIndex = 15;
+ this.Label6.Text = "{PONG_DESC}";
+ this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.Label6.Click += new System.EventHandler(this.Label6_Click);
+ //
+ // btnstartgame
+ //
+ this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.btnstartgame.Location = new System.Drawing.Point(188, 215);
+ this.btnstartgame.Name = "btnstartgame";
+ this.btnstartgame.Size = new System.Drawing.Size(242, 28);
+ this.btnstartgame.TabIndex = 15;
+ this.btnstartgame.Text = "{PLAY}";
+ this.btnstartgame.UseVisualStyleBackColor = true;
+ this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click);
+ //
+ // Label8
+ //
+ this.Label8.AutoSize = true;
+ this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.Label8.ForeColor = System.Drawing.Color.Black;
+ this.Label8.Location = new System.Drawing.Point(250, 5);
+ this.Label8.Name = "Label8";
+ this.Label8.Size = new System.Drawing.Size(280, 31);
+ this.Label8.TabIndex = 14;
+ this.Label8.Text = "{PONG_WELCOME}";
+ this.Label8.Click += new System.EventHandler(this.Label8_Click);
+ //
+ // 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.Location = new System.Drawing.Point(0, 36);
+ this.lbhighscore.Name = "lbhighscore";
+ this.lbhighscore.Size = new System.Drawing.Size(539, 246);
+ this.lbhighscore.TabIndex = 1;
+ this.lbhighscore.UseCompatibleStateImageBehavior = false;
+ //
+ // 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 +342,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 +457,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 +491,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 +503,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 +514,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 +534,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 +554,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;
//
@@ -497,50 +620,6 @@ namespace ShiftOS.WinForms.Applications
this.Label1.Text = "You lose!";
this.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
//
- // pnlintro
- //
- 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.Name = "pnlintro";
- this.pnlintro.Size = new System.Drawing.Size(595, 303);
- this.pnlintro.TabIndex = 13;
- //
- // Label6
- //
- this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.Label6.Location = new System.Drawing.Point(3, 39);
- this.Label6.Name = "Label6";
- this.Label6.Size = new System.Drawing.Size(589, 227);
- this.Label6.TabIndex = 15;
- this.Label6.Text = "{PONG_DESC}";
- this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- this.Label6.Click += new System.EventHandler(this.Label6_Click);
- //
- // btnstartgame
- //
- this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.btnstartgame.Location = new System.Drawing.Point(186, 273);
- this.btnstartgame.Name = "btnstartgame";
- this.btnstartgame.Size = new System.Drawing.Size(242, 28);
- this.btnstartgame.TabIndex = 15;
- this.btnstartgame.Text = "{PLAY}";
- this.btnstartgame.UseVisualStyleBackColor = true;
- this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click);
- //
- // Label8
- //
- this.Label8.AutoSize = true;
- this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
- this.Label8.ForeColor = System.Drawing.Color.Black;
- this.Label8.Location = new System.Drawing.Point(250, 5);
- this.Label8.Name = "Label8";
- this.Label8.Size = new System.Drawing.Size(280, 31);
- this.Label8.TabIndex = 14;
- this.Label8.Text = "{PONG_WELCOME}";
- this.Label8.Click += new System.EventHandler(this.Label8_Click);
- //
// lblbeatai
//
this.lblbeatai.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
@@ -548,6 +627,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 +657,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 +666,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(878, 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 +678,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(912, 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, 460);
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(440, 460);
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, 460);
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 +732,24 @@ 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(912, 504);
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.pnlmultiplayerhandshake.ResumeLayout(false);
+ this.pnlintro.ResumeLayout(false);
+ this.pnlintro.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);
}
@@ -732,7 +795,7 @@ namespace ShiftOS.WinForms.Applications
internal System.Windows.Forms.Label Label8;
internal System.Windows.Forms.Timer tmrstoryline;
private System.Windows.Forms.Panel pnlhighscore;
- private System.Windows.Forms.ListBox lbhighscore;
+ private System.Windows.Forms.ListView lbhighscore;
private System.Windows.Forms.Label label10;
internal Canvas pgcontents;
internal Canvas ball;
@@ -740,5 +803,9 @@ namespace ShiftOS.WinForms.Applications
internal System.Windows.Forms.Label label12;
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
private System.Windows.Forms.Button button2;
+ internal System.Windows.Forms.Button btnmatchmake;
+ private System.Windows.Forms.Panel pnlmultiplayerhandshake;
+ private System.Windows.Forms.ListView lvotherplayers;
+ private System.Windows.Forms.Label lbmpstatus;
}
}
diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs
index af1e156..84177b7 100644
--- a/ShiftOS.WinForms/Applications/Pong.cs
+++ b/ShiftOS.WinForms/Applications/Pong.cs
@@ -29,14 +29,17 @@ 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;
using ShiftOS.Objects;
+using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
[Launcher("Pong", true, "al_pong", "Games")]
[WinOpen("pong")]
[DefaultIcon("iconPong")]
@@ -79,9 +82,51 @@ namespace ShiftOS.WinForms.Applications
private void pongMain_MouseMove(object sender, MouseEventArgs e)
{
var loc = this.PointToClient(MousePosition);
- paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2));
+ if (IsMultiplayerSession)
+ {
+ if (IsLeader)
+ {
+ paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2));
+ ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleHuman.Top.ToString());
+ }
+ else
+ {
+ paddleComputer.Location = new Point(paddleComputer.Location.X, (loc.Y) - (paddleComputer.Height / 2));
+ ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleComputer.Top.ToString());
+ }
+ }
+ else
+ {
+ 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;
}
+ int OpponentY = 0;
+
+ bool IsLeader = true;
+
+ int LeaderX = 0;
+ int LeaderY = 0;
// ERROR: Handles clauses are not supported in C#
private void gameTimer_Tick(object sender, EventArgs e)
@@ -93,40 +138,52 @@ namespace ShiftOS.WinForms.Applications
paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor;
//Check if paddle upgrade has been bought and change paddles accordingly
- if (ShiftoriumFrontend.UpgradeInstalled("pong_increased_paddle_size"))
- {
- paddleHuman.Height = 150;
- paddleComputer.Height = 150;
- }
+ //if (ShiftoriumFrontend.UpgradeInstalled("pong_increased_paddle_size"))
+ //{
+ // paddleHuman.Height = 150;
+ // paddleComputer.Height = 150;
+ //}
+ //I don't know the point of this but I'm fucking 86ing it. - Michael
//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.Y > paddleComputer.Location.Y + 50)
- {
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed);
- }
- if (ball.Location.Y < paddleComputer.Location.Y + 50)
- {
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed);
- }
- casualposition = rand.Next(-150, 201);
- }
+ if (IsMultiplayerSession == true)
+ {
+ //If we're multiplayer, then we want to set the computer Y to the opponent's Y.
+ //If we're the leader, we set the AI paddle, else we set the player paddle.
+ if (IsLeader)
+ paddleComputer.Top = OpponentY;
else
- {
- //used to be me.location.y
- if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition)
+ paddleHuman.Top = OpponentY;
+ }
+ else
+ {
+ if (aiShouldIsbeEnabled)
+ if (ball.Location.X > (this.Width - (this.Width / 3)) - xVel * 10 && xVel > 0)
{
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed);
+ if (ball.Location.Y > paddleComputer.Location.Y + 50)
+ {
+ paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed);
+ }
+ if (ball.Location.Y < paddleComputer.Location.Y + 50)
+ {
+ paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed);
+ }
+ casualposition = rand.Next(-150, 201);
}
- //used to be me.location.y
- if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition)
+ else
{
- paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed);
+ //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);
+ }
+ //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);
+ }
}
- }
-
+ }
//Set Xvel and Yvel speeds from decimal
if (xVel > 0)
xVel = (int)Math.Round(xveldec);
@@ -137,148 +194,455 @@ namespace ShiftOS.WinForms.Applications
if (yVel < 0)
yVel = (int)-Math.Round(yveldec);
- // Move the game ball.
- ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel);
+ bool BallPhysics = true;
- // Check for top wall.
- if (ball.Location.Y < 0)
+ if (IsMultiplayerSession)
{
- ball.Location = new Point(ball.Location.X, 0);
- yVel = -yVel;
+ //Logic for moving the ball in Multiplayer.
+ if (IsLeader)
+ {
+ ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel);
+ }
+ else
+ {
+ //Move it to the leader's ball position.
+ ball.Location = new Point(LeaderX, LeaderY);
+ BallPhysics = false;
+ }
}
-
- // Check for bottom wall.
- if (ball.Location.Y > pgcontents.Height - ball.Height)
- {
- ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height);
- yVel = -yVel;
+ else
+ {// Move the game ball.
+ ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel);
}
-
- // Check for player paddle.
- if (ball.Bounds.IntersectsWith(paddleHuman.Bounds))
+ if (BallPhysics)
{
- ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width, ball.Location.Y);
- //randomly increase x or y speed of ball
- switch (rand.Next(1, 3))
+ // Check for top wall.
+ if (ball.Location.Y < 0)
{
- case 1:
- xveldec = xveldec + incrementx;
- break;
- case 2:
- if (yveldec > 0)
- yveldec = yveldec + incrementy;
- if (yveldec < 0)
- yveldec = yveldec - incrementy;
- break;
+ ball.Location = new Point(ball.Location.X, 0);
+ yVel = -yVel;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound);
}
- xVel = -xVel;
- }
- // Check for computer paddle.
- if (ball.Bounds.IntersectsWith(paddleComputer.Bounds))
- {
- ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width + 1, ball.Location.Y);
- xveldec = xveldec + incrementx;
- xVel = -xVel;
+ // Check for bottom wall.
+ if (ball.Location.Y > pgcontents.Height - ball.Height)
+ {
+ ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height);
+ yVel = -yVel;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound);
+ }
+
+
+ // Check for player paddle.
+ if (ball.Bounds.IntersectsWith(paddleHuman.Bounds))
+ {
+ ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width + 1, ball.Location.Y);
+ //randomly increase x or y speed of ball
+ switch (rand.Next(1, 3))
+ {
+ case 1:
+ xveldec = xveldec + incrementx;
+ break;
+ case 2:
+ if (yveldec > 0)
+ yveldec = yveldec + incrementy;
+ if (yveldec < 0)
+ yveldec = yveldec - incrementy;
+ break;
+ }
+ xVel = -xVel;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound);
+
+ }
+
+ // Check for computer paddle.
+ if (ball.Bounds.IntersectsWith(paddleComputer.Bounds))
+ {
+ ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width - 1, ball.Location.Y);
+ xveldec = xveldec + incrementx;
+ xVel = -xVel;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound);
+ }
}
+
+
// Check for left wall.
if (ball.Location.X < -100)
{
- ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
- paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
- if (xVel > 0)
- xVel = -xVel;
- pnllose.Show();
- gameTimer.Stop();
- counter.Stop();
- lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}");
- if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2"))
+ //If we are in multiplayer, and not the leader, we won.
+ if (IsMultiplayerSession)
{
- totalreward = levelrewards[level - 1] + beatairewardtotal;
- double onePercent = (totalreward / 100);
- lblbutyougained.Show();
- lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}"));
- SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100));
+ if (IsLeader)
+ {
+ //We lost.
+ NotifyLoseToTarget();
+ }
+ else
+ {
+ //We won.
+ NotifyWinToTarget();
+ Win();
+ }
}
else
{
- lblbutyougained.Hide();
+ ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
+ paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
+ if (xVel > 0)
+ xVel = -xVel;
+ pnllose.Show();
+ gameTimer.Stop();
+ counter.Stop();
+ lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}");
+ if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2"))
+ {
+ totalreward = levelrewards[level - 1] + beatairewardtotal;
+ double onePercent = (totalreward / 100);
+ lblbutyougained.Show();
+ lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}"));
+ SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100));
+ }
+ else
+ {
+ lblbutyougained.Hide();
+ }
}
}
// Check for right wall.
if (ball.Location.X > this.Width - ball.Size.Width - paddleComputer.Width + 100)
{
- ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
- paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
- if (xVel > 0)
- xVel = -xVel;
- beatairewardtotal = beatairewardtotal + beataireward;
- lblbeatai.Show();
- lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD_SECONDARY}}: {beataireward}");
- tmrcountdown.Start();
- gameTimer.Stop();
- counter.Stop();
+ if (IsMultiplayerSession)
+ {
+ //If we are the leader we won.
+ if (IsLeader)
+ {
+ NotifyWinToTarget();
+ Win();
+ }
+ else
+ {
+ NotifyLoseToTarget();
+ }
+ }
+ else
+ {
+ Win();
+ }
}
- //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy
- lblstatsX.Text = Localization.Parse("{H_VEL}: ") + xveldec;
- lblstatsY.Text = Localization.Parse("{V_VEL}: ") + yveldec;
- lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString();
- lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}");
+ if (IsMultiplayerSession)
+ {
+ if (IsLeader)
+ {
+ ServerManager.Forward(OpponentGUID, "pong_mp_setballpos", JsonConvert.SerializeObject(ball.Location));
+ }
+ }
- if (xVel > 20 || xVel < -20)
+ if (IsLeader)
{
- paddleHuman.Width = Math.Abs(xVel);
- paddleComputer.Width = Math.Abs(xVel);
+ //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy
+ lblstatsX.Text = "X vel: " + xveldec;
+ lblstatsY.Text = "Y vel: " + yveldec;
+ lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString();
+ lbllevelandtime.Text = "Level: " + level + " - " + secondsleft + " seconds left";
+
+ if (xVel > 20 || xVel < -20)
+ {
+ paddleHuman.Width = Math.Abs(xVel);
+ paddleComputer.Width = Math.Abs(xVel);
+ }
+ else
+ {
+ paddleHuman.Width = 20;
+ paddleComputer.Width = 20;
+ }
}
- else
+ if (!IsMultiplayerSession)
+ {
+ computerspeed = Math.Abs(yVel);
+ }
+ }
+ }
+
+ public void ServerMessageReceivedHandler(ServerMessage msg)
+ {
+ if (IsMultiplayerSession)
+ {
+ if (msg.Name == "pong_mp_setballpos")
+ {
+ var pt = JsonConvert.DeserializeObject<Point>(msg.Contents);
+ LeaderX = pt.X;
+ LeaderY = pt.Y;
+ }
+ else if (msg.Name == "pong_mp_left")
+ {
+ this.Invoke(new Action(() =>
+ {
+ AppearanceManager.Close(this);
+ }));
+ Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped.");
+ }
+ else if (msg.Name == "pong_mp_youlose")
+ {
+ this.Invoke(new Action(LoseMP));
+ }
+ else if (msg.Name == "pong_mp_setopponenty")
+ {
+ int y = Convert.ToInt32(msg.Contents);
+ OpponentY = y;
+ }
+ else if (msg.Name == "pong_handshake_matchmake")
+ {
+ if (!PossibleMatchmakes.Contains(msg.Contents))
+ PossibleMatchmakes.Add(msg.Contents);
+ this.Invoke(new Action(ListMatchmakes));
+ }
+ else if (msg.Name == "pong_handshake_resendid")
+ {
+ ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID);
+ }
+ else if (msg.Name == "pong_handshake_complete")
+ {
+ IsLeader = true;
+
+ OpponentGUID = msg.Contents;
+ LeaveMatchmake();
+ this.Invoke(new Action(() =>
+ {
+ pnlmultiplayerhandshake.Hide();
+ StartLevel();
+ }));
+ }
+ else if(msg.Name == "pong_mp_levelcompleted")
+ {
+ level = Convert.ToInt32(msg.Contents) + 1;
+ this.Invoke(new Action(CompleteLevel));
+ }
+ else if (msg.Name == "pong_handshake_chosen")
+ {
+ IsLeader = false;
+ LeaveMatchmake();
+ OpponentGUID = msg.Contents;
+ YouGUID = ServerManager.thisGuid.ToString();
+ //Start the timers.
+ counter.Start();
+ SendFollowerGUID();
+ this.Invoke(new Action(() =>
+ {
+ pnlmultiplayerhandshake.Hide();
+ }));
+ }
+ else if(msg.Name == "pong_mp_cashedout")
+ {
+ this.Invoke(new Action(() =>
+ {
+ btncashout_Click(this, EventArgs.Empty);
+ }));
+ Infobox.Show("Cashed out.", "The other player has cashed out their Codepoints. Therefore, we have automatically cashed yours out.");
+ }
+ else if(msg.Name == "pong_mp_startlevel")
+ {
+ OpponentAgrees = true;
+ if(YouAgree == false)
+ {
+ Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer)=>
+ {
+ YouAgree = answer;
+ ServerManager.Forward(OpponentGUID, "pong_mp_level_callback", YouAgree.ToString());
+ });
+ }
+ }
+ else if(msg.Name == "pong_mp_level_callback")
+ {
+ bool agreed = bool.Parse(msg.Contents);
+ OpponentAgrees = agreed;
+ if (OpponentAgrees)
+ {
+ if (IsLeader)
+ {
+ //this.Invoke(new Action(()))
+ }
+ }
+ }
+ else if (msg.Name == "pong_handshake_left")
+ {
+ if (this.PossibleMatchmakes.Contains(msg.Contents))
+ this.PossibleMatchmakes.Remove(msg.Contents);
+ this.Invoke(new Action(ListMatchmakes));
+ }
+ else if(msg.Name == "pong_mp_clockupdate")
{
- paddleHuman.Width = 20;
- paddleComputer.Width = 20;
+ secondsleft = Convert.ToInt32(msg.Contents);
}
+ else if (msg.Name == "pong_mp_youwin")
+ {
+ this.Invoke(new Action(Win));
+ }
+ }
+ }
- computerspeed = Math.Abs(yVel);
+ bool OpponentAgrees = false;
+ bool YouAgree = false;
- // pgcontents.Refresh()
- // pgcontents.CreateGraphics.FillRectangle(Brushes.Black, ball.Location.X, ball.Location.Y, ball.Width, ball.Height)
+ public void ListMatchmakes()
+ {
+ lvotherplayers.Items.Clear();
+ var c = new ColumnHeader();
+ c.Width = lvotherplayers.Width;
+ c.Text = "Player";
+ lvotherplayers.Columns.Clear();
+ lvotherplayers.Columns.Add(c);
+
+ lvotherplayers.FullRowSelect = true;
+ foreach (var itm in PossibleMatchmakes)
+ {
+ if (itm != YouGUID)
+ {
+ var l = new ListViewItem();
+ l.Text = itm;
+ lvotherplayers.Items.Add(l);
+ }
+ }
+ if (PossibleMatchmakes.Count > 0)
+ {
+ lbmpstatus.Text = "Select a player.";
+ }
+ else
+ {
+ lbmpstatus.Text = "Waiting for players...";
}
}
+ public void NotifyLoseToTarget()
+ {
+ ServerManager.Forward(OpponentGUID, "pong_mp_youwin", null);
+ }
+
+ public void NotifyWinToTarget()
+ {
+ ServerManager.Forward(OpponentGUID, "pong_mp_youlose", null);
+ }
+
+ public void LeaveMatchmake()
+ {
+ ServerManager.Forward("all", "pong_handshake_left", YouGUID);
+ }
+
+ List<string> PossibleMatchmakes = new List<string>();
+
+ public void SendLeaderGUID(string target)
+ {
+ ServerManager.Forward(target, "pong_handshake_chosen", YouGUID);
+ }
+
+
+ public void StartMultiplayer()
+ {
+ IsMultiplayerSession = true;
+ YouGUID = ServerManager.thisGuid.ToString();
+ ServerManager.SendMessage("pong_handshake_matchmake", YouGUID);
+ StartMatchmake();
+ }
+
+ public void StartMatchmake()
+ {
+ pnlmultiplayerhandshake.Show();
+ pnlmultiplayerhandshake.CenterParent();
+ pnlmultiplayerhandshake.BringToFront();
+
+ ServerManager.Forward("all", "pong_handshake_resendid", null);
+
+ }
+
+
+ public void SendFollowerGUID()
+ {
+ ServerManager.Forward(OpponentGUID, "pong_handshake_complete", YouGUID);
+ }
+
+ public void LoseMP()
+ {
+ ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
+ if(IsLeader)
+ if (xVel > 0)
+ xVel = -xVel;
+ lblbeatai.Show();
+ lblbeatai.Text = "The opponent has beaten you!";
+ tmrcountdown.Start();
+ gameTimer.Stop();
+ counter.Stop();
+
+ }
+
+ public void Win()
+ {
+ ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2);
+ paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y);
+ if (xVel > 0)
+ xVel = -xVel;
+ beatairewardtotal = beatairewardtotal + beataireward;
+ lblbeatai.Show();
+ lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD_SECONDARY}}: {beataireward}");
+ tmrcountdown.Start();
+ gameTimer.Stop();
+ counter.Stop();
+
+ }
+
+ public void CompleteLevel()
+ {
+ if (SaveSystem.CurrentSave.UniteAuthToken != null)
+ {
+ try
+ {
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ if (unite.GetPongLevel() < level)
+ unite.SetPongLevel(level);
+ }
+ catch { }
+ }
+ //Only set these stats if the user is the leader.
+ if (IsLeader)
+ {
+ secondsleft = 60;
+ level = level + 1;
+ generatenextlevel();
+ }
+
+ pnlgamestats.Show();
+ pnlgamestats.BringToFront();
+ pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2));
+
+ counter.Stop();
+ gameTimer.Stop();
+
+ }
+
// ERROR: Handles clauses are not supported in C#
private void counter_Tick(object sender, EventArgs e)
{
- if (this.Left < Screen.PrimaryScreen.Bounds.Width)
+ if (IsLeader)
{
- secondsleft = secondsleft - 1;
- if (secondsleft == 1)
+ if (this.Left < Screen.PrimaryScreen.Bounds.Width)
{
- secondsleft = 60;
- level = level + 1;
- generatenextlevel();
- pnlgamestats.Show();
- pnlgamestats.BringToFront();
- pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2));
+ secondsleft = secondsleft - 1;
+ if (secondsleft == 0)
+ {
+ CompleteLevel();
+ }
- counter.Stop();
- gameTimer.Stop();
- SendHighscores();
+ lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString();
}
- lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: ") + (levelrewards[level - 1] + beatairewardtotal).ToString();
}
+ SetupStats();
}
+ [Obsolete("This method does nothing. Use UniteClient for highscore queries.")]
public void SendHighscores()
{
- var highscore = new PongHighscore
- {
- UserName = $"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}",
- HighestLevel = level,
- HighestCodepoints = totalreward
- };
- ServerManager.SendMessage("pong_sethighscore", JsonConvert.SerializeObject(highscore));
}
// ERROR: Handles clauses are not supported in C#
@@ -485,15 +849,18 @@ namespace ShiftOS.WinForms.Applications
case 1:
lblcountdown.Text = "1";
countdown = countdown - 1;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound);
break;
case 2:
lblcountdown.Text = "2";
countdown = countdown - 1;
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound);
break;
case 3:
lblcountdown.Text = "3";
countdown = countdown - 1;
lblcountdown.Show();
+ ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound);
break;
}
@@ -511,6 +878,27 @@ namespace ShiftOS.WinForms.Applications
lblfinalcomputerreward.Text = beatairewardtotal.ToString();
lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}");
SaveSystem.TransferCodepointsFrom("pong", totalreward);
+ if (!string.IsNullOrWhiteSpace(SaveSystem.CurrentSave.UniteAuthToken))
+ {
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ if (unite.GetPongCP() < totalreward)
+ {
+ unite.SetPongCP(totalreward);
+ }
+ }
+ if (IsMultiplayerSession)
+ {
+ ServerManager.Forward(OpponentGUID, "pong_mp_cashedout", null);
+ StopMultiplayerSession();
+ }
+ }
+
+ public void StopMultiplayerSession()
+ {
+ IsMultiplayerSession = false;
+ IsLeader = true;
+ OpponentGUID = "";
+ YouGUID = "";
}
private void newgame()
@@ -560,27 +948,69 @@ namespace ShiftOS.WinForms.Applications
SetupHighScores();
}
+ bool IsMultiplayerSession = false;
+
+ string YouGUID = "";
+ string OpponentGUID = "";
+
public void SetupHighScores()
{
lbhighscore.Items.Clear();
- ServerManager.MessageReceived += (msg) =>
+ lbhighscore.View = View.Details;
+ lbhighscore.FullRowSelect = true;
+ lbhighscore.Columns.Clear();
+ var n = new ColumnHeader();
+ n.Text = "Player";
+ n.Width = lbhighscore.Width / 3;
+ var l = new ColumnHeader();
+ l.Text = "Level";
+ l.Width = n.Width;
+ var c = new ColumnHeader();
+ c.Text = "Codepoints";
+ c.Width = n.Width;
+ lbhighscore.Columns.Add(n);
+ lbhighscore.Columns.Add(l);
+ lbhighscore.Columns.Add(c);
+
+ var t = new Thread(() =>
{
- if(msg.Name == "pong_highscores")
+ try
{
- var hs = JsonConvert.DeserializeObject<List<PongHighscore>>(msg.Contents);
-
- var orderedhs = hs.OrderByDescending(i => i.HighestLevel);
- foreach(var score in orderedhs)
+ var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken);
+ var hs = unite.GetPongHighscores();
+ foreach (var score in hs.Highscores)
{
+ if(this.ParentForm.Visible == false)
+ {
+ Thread.CurrentThread.Abort();
+ }
+ string username = unite.GetDisplayNameId(score.UserId);
this.Invoke(new Action(() =>
{
- lbhighscore.Items.Add($"{score.UserName}\t\t\t{score.HighestLevel}\t\t{score.HighestCodepoints} CP");
+ var name_item = new ListViewItem();
+ name_item.Text = username;
+ lbhighscore.Items.Add(name_item);
+ name_item.SubItems.Add(score.Level.ToString());
+ name_item.SubItems.Add(score.CodepointsCashout.ToString());
}));
}
}
- };
- ServerManager.SendMessage("pong_gethighscores", null);
+ catch
+ {
+ try
+ {
+ if (this.ParentForm.Visible == true)
+ {
+ Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time.");
+ this.Invoke(new Action(pnlgamestats.BringToFront));
+ }
+ }
+ catch { } //JUST. ABORT. THE. FUCKING. THREAD.
+ return;
+ }
+ });
+ t.Start();
pnlhighscore.Show();
}
@@ -596,6 +1026,11 @@ namespace ShiftOS.WinForms.Applications
newgame();
}
+ public void StartLevel()
+ {
+ newgame();
+ }
+
// ERROR: Handles clauses are not supported in C#
private void btnstartgame_Click(object sender, EventArgs e)
{
@@ -651,24 +1086,58 @@ namespace ShiftOS.WinForms.Applications
pnlhighscore.Hide();
pnlgamestats.Hide();
pnlfinalstats.Hide();
+ CenterPanels();
+ lblbeatai.Hide();
+ ServerManager.MessageReceived += this.ServerMessageReceivedHandler;
}
public void OnSkinLoad()
{
+ CenterPanels();
+ this.SizeChanged += (o, a) =>
+ {
+ CenterPanels();
+ };
}
public bool OnUnload()
{
+ if(IsMultiplayerSession == true)
+ {
+ if(!string.IsNullOrWhiteSpace(OpponentGUID))
+ ServerManager.Forward(OpponentGUID, "pong_mp_left", null);
+ LeaveMatchmake();
+ }
+ ServerManager.MessageReceived -= this.ServerMessageReceivedHandler;
+
return true;
}
public void OnUpgrade()
{
+ CenterPanels();
}
private void button2_Click(object sender, EventArgs e)
{
pnlhighscore.Hide();
}
+
+ private void btnmatchmake_Click(object sender, EventArgs e)
+ {
+ this.StartMultiplayer();
+ pnlintro.Hide();
+ lblbeatai.Text = "Beat the other player to earn Codepoints.";
+ lblcountdown.Text = "Waiting for another player...";
+ lblcountdown.Left = (this.Width - lblcountdown.Width) / 2;
+ }
+
+ private void lvotherplayers_DoubleClick(object sender, EventArgs e)
+ {
+ if(lvotherplayers.SelectedItems.Count > 0)
+ {
+ SendLeaderGUID(lvotherplayers.SelectedItems[0].Text);
+ }
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs
index f1c1d22..42e19f8 100644
--- a/ShiftOS.WinForms/Applications/ShiftLetters.cs
+++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs
@@ -36,8 +36,9 @@ using System.Windows.Forms;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
[Launcher("ShiftLetters", false, null, "Games")]
- [RequiresUpgrade("shiftletters")]
+ [AppscapeEntry("ShiftLetters", "Let's see how much you know about ShiftOS by playing this tiny little Hangman game! Shiftorium Upgrades exist to allow you to buy different word sets!", 300, 150, null, "Games")]
[WinOpen("shiftletters")]
[DefaultIcon("iconShiftLetters")]
public partial class ShiftLetters : UserControl, IShiftOSWindow
@@ -50,7 +51,7 @@ namespace ShiftOS.WinForms.Applications
"shiftorium", "codepoints", "shiftletters", "shops", "mud", "notification", "namechanger",
"skinning", "skinloader", "calculator", "fileskimmer", "lua", "shiftnet", "terminal", "textpad"};
List<String> contributorsWordlist = new List<string> { "philipadams", "carverh", "computelinux", "lempamo",
- "wowmom", "michaeltheshifter", "arencclc", "therandommelon", "pfg", "craftxbox"};
+ "wowmom", "michaeltheshifter", "arencllc", "therandommelon", "pfg", "craftxbox", "ashifter"};
List<string> osWordlist = new List<string>
{
@@ -90,7 +91,8 @@ namespace ShiftOS.WinForms.Applications
"vienna",
"whistler",
"windowsxp",
- "windowsforworkgroups"
+ "windowsforworkgroups",
+ "shiftos"
};
public ShiftLetters()
diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs
new file mode 100644
index 0000000..8b43636
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/ShiftLotto.Designer.cs
@@ -0,0 +1,231 @@
+/*
+ * 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.Applications
+{
+ partial class ShiftLotto
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ShiftLotto));
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.button1 = new System.Windows.Forms.Button();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.cpUpDown = new System.Windows.Forms.NumericUpDown();
+ this.difUpDown = new System.Windows.Forms.NumericUpDown();
+ this.label1 = new System.Windows.Forms.Label();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.label7 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.cpUpDown)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.difUpDown)).BeginInit();
+ this.SuspendLayout();
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(19, 49);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(376, 39);
+ this.label2.TabIndex = 2;
+ this.label2.Text = resources.GetString("label2.Text");
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(35, 122);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(60, 13);
+ this.label3.TabIndex = 3;
+ this.label3.Text = "Codepoints\r\n";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(319, 122);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(47, 13);
+ this.label4.TabIndex = 4;
+ this.label4.Text = "Difficulty";
+ //
+ // button1
+ //
+ this.button1.Location = new System.Drawing.Point(22, 164);
+ this.button1.Name = "button1";
+ this.button1.Size = new System.Drawing.Size(369, 23);
+ this.button1.TabIndex = 6;
+ this.button1.Text = "Go!";
+ this.button1.UseVisualStyleBackColor = true;
+ this.button1.Click += new System.EventHandler(this.button1_Click);
+ //
+ // label5
+ //
+ this.label5.Location = new System.Drawing.Point(120, 136);
+ this.label5.Name = "label5";
+ this.label5.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ this.label5.Size = new System.Drawing.Size(173, 23);
+ this.label5.TabIndex = 7;
+ this.label5.Text = "0 CP";
+ this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(173, 122);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(74, 13);
+ this.label6.TabIndex = 8;
+ this.label6.Text = "You could win";
+ //
+ // cpUpDown
+ //
+ this.cpUpDown.Location = new System.Drawing.Point(22, 138);
+ this.cpUpDown.Maximum = new decimal(new int[] {
+ 1000000,
+ 0,
+ 0,
+ 0});
+ this.cpUpDown.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.cpUpDown.Name = "cpUpDown";
+ this.cpUpDown.Size = new System.Drawing.Size(92, 20);
+ this.cpUpDown.TabIndex = 9;
+ this.cpUpDown.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ //
+ // difUpDown
+ //
+ this.difUpDown.Location = new System.Drawing.Point(299, 138);
+ this.difUpDown.Maximum = new decimal(new int[] {
+ 1000,
+ 0,
+ 0,
+ 0});
+ this.difUpDown.Minimum = new decimal(new int[] {
+ 10,
+ 0,
+ 0,
+ 0});
+ this.difUpDown.Name = "difUpDown";
+ this.difUpDown.Size = new System.Drawing.Size(92, 20);
+ this.difUpDown.TabIndex = 10;
+ this.difUpDown.Value = new decimal(new int[] {
+ 10,
+ 0,
+ 0,
+ 0});
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(147, 20);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(115, 13);
+ this.label1.TabIndex = 11;
+ this.label1.Text = "Welcome to ShiftLotto!";
+ //
+ // timer1
+ //
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ //
+ // label7
+ //
+ this.label7.Location = new System.Drawing.Point(22, 190);
+ this.label7.Name = "label7";
+ this.label7.RightToLeft = System.Windows.Forms.RightToLeft.No;
+ this.label7.Size = new System.Drawing.Size(369, 23);
+ this.label7.TabIndex = 12;
+ this.label7.Text = "Current CP: 0 CP";
+ this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // ShiftLotto
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.label7);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.difUpDown);
+ this.Controls.Add(this.cpUpDown);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.button1);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Name = "ShiftLotto";
+ this.Size = new System.Drawing.Size(419, 252);
+ ((System.ComponentModel.ISupportInitialize)(this.cpUpDown)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.difUpDown)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Button button1;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.NumericUpDown cpUpDown;
+ private System.Windows.Forms.NumericUpDown difUpDown;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Timer timer1;
+ private System.Windows.Forms.Label label7;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs
new file mode 100644
index 0000000..5ab8154
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs
@@ -0,0 +1,134 @@
+/*
+ * 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.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [Launcher("ShiftLotto", true, "al_shiftlotto", "Games")]
+ [MultiplayerOnly]
+ [DefaultIcon("iconShiftLotto")]
+ [RequiresUpgrade("shiftlotto")]
+ [WinOpen("shiftlotto")]
+ public partial class ShiftLotto : UserControl, IShiftOSWindow
+ {
+ public ShiftLotto()
+ {
+ InitializeComponent();
+ }
+
+ public void OnLoad()
+ {
+ timer1.Start();
+ }
+
+
+ public void OnSkinLoad()
+ {
+
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+
+ }
+
+ // The Dynamic Display
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0));
+ int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0));
+ label5.Text = codePoints * difficulty + " CP";
+ label7.Text = "Current CP: " + SaveSystem.CurrentSave.Codepoints.ToString() + " CP";
+ }
+
+ private void button1_Click(object sender, EventArgs e)
+ {
+ // Make codePoints and difficulty in this function
+ int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0));
+ int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0));
+
+ if (SaveSystem.CurrentSave.Codepoints <= 9)
+ {
+ Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!");
+ }
+ else
+ {
+ if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0)
+ {
+ Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!");
+ }
+ else
+ {
+ // Create Random Ints
+ Random rnd = new Random();
+
+ // Set their highest possible number to Difficulty
+ int guessedNumber = rnd.Next(0, difficulty);
+ int winningNumber = rnd.Next(0, difficulty);
+
+ // Multiply CodePoints * Difficulty
+ int jackpot = codePoints * difficulty;
+
+ // Test the random ints
+ if (guessedNumber == winningNumber)
+ {
+ // If you win
+
+ // Add Codepoints
+ SaveSystem.TransferCodepointsFrom("shiftlotto", jackpot);
+
+ // Infobox
+ Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. ");
+ }
+ else
+ {
+ // If you fail
+
+ // Remove Codepoints
+ SaveSystem.TransferCodepointsToVoid(jackpot);
+
+
+
+ // Infobox
+ Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account.");
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.resx b/ShiftOS.WinForms/Applications/ShiftLotto.resx
new file mode 100644
index 0000000..4664613
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/ShiftLotto.resx
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="label2.Text" xml:space="preserve">
+ <value>ShiftLotto lets you to turn a few codepoints into a FOURTUNE! All you need to
+do is bet a certain amount of codepoints, set a difficulty, and try your luck.
+ There have been many winners - Will you be one too?</value>
+ </data>
+ <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs
index 1df4f2e..5ba0e0b 100644
--- a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs
@@ -52,90 +52,76 @@ namespace ShiftOS.WinForms.Applications
/// </summary>
private void InitializeComponent()
{
- this.pictureBox1 = new System.Windows.Forms.PictureBox();
- this.easyPanel = new System.Windows.Forms.TableLayoutPanel();
- this.buttonE = new System.Windows.Forms.Button();
- this.buttonM = new System.Windows.Forms.Button();
- this.buttonH = new System.Windows.Forms.Button();
+ this.panelGameStatus = new System.Windows.Forms.PictureBox();
+ this.gamePanel = new System.Windows.Forms.TableLayoutPanel();
+ this.buttonEasy = new System.Windows.Forms.Button();
+ this.buttonMedium = new System.Windows.Forms.Button();
+ this.buttonHard = new System.Windows.Forms.Button();
this.lblmines = new System.Windows.Forms.Label();
this.lbltime = new System.Windows.Forms.Label();
this.lblinfo = new System.Windows.Forms.Label();
this.lblinfo2 = new System.Windows.Forms.Label();
- this.flagButton = new System.Windows.Forms.PictureBox();
- this.mediumPanel = new System.Windows.Forms.TableLayoutPanel();
- this.hardPanel = new System.Windows.Forms.TableLayoutPanel();
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
- ((System.ComponentModel.ISupportInitialize)(this.flagButton)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.panelGameStatus)).BeginInit();
this.SuspendLayout();
//
- // pictureBox1
- //
- this.pictureBox1.BackgroundImage = global::ShiftOS.WinForms.Properties.Resources.SweeperNormalFace;
- this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
- this.pictureBox1.Image = global::ShiftOS.WinForms.Properties.Resources.SweeperNormalFace;
- this.pictureBox1.Location = new System.Drawing.Point(264, 3);
- this.pictureBox1.Name = "pictureBox1";
- this.pictureBox1.Size = new System.Drawing.Size(32, 32);
- this.pictureBox1.TabIndex = 0;
- this.pictureBox1.TabStop = false;
- //
- // easyPanel
- //
- this.easyPanel.ColumnCount = 9;
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F));
- this.easyPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
- this.easyPanel.Location = new System.Drawing.Point(4, 40);
- this.easyPanel.Name = "easyPanel";
- this.easyPanel.RowCount = 9;
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11136F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11025F));
- this.easyPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11025F));
- this.easyPanel.Size = new System.Drawing.Size(541, 308);
- this.easyPanel.TabIndex = 1;
- //
- // buttonE
- //
- this.buttonE.Location = new System.Drawing.Point(4, 354);
- this.buttonE.Name = "buttonE";
- this.buttonE.Size = new System.Drawing.Size(75, 23);
- this.buttonE.TabIndex = 2;
- this.buttonE.Text = "Easy";
- this.buttonE.UseVisualStyleBackColor = true;
- this.buttonE.Click += new System.EventHandler(this.buttonE_Click);
- //
- // buttonM
- //
- this.buttonM.Location = new System.Drawing.Point(244, 354);
- this.buttonM.Name = "buttonM";
- this.buttonM.Size = new System.Drawing.Size(75, 23);
- this.buttonM.TabIndex = 3;
- this.buttonM.Text = "Medium";
- this.buttonM.UseVisualStyleBackColor = true;
- this.buttonM.Click += new System.EventHandler(this.buttonM_Click);
- //
- // buttonH
- //
- this.buttonH.Location = new System.Drawing.Point(470, 354);
- this.buttonH.Name = "buttonH";
- this.buttonH.Size = new System.Drawing.Size(75, 23);
- this.buttonH.TabIndex = 4;
- this.buttonH.Text = "Hard";
- this.buttonH.UseVisualStyleBackColor = true;
- this.buttonH.Click += new System.EventHandler(this.buttonH_Click);
+ // panelGameStatus
+ //
+ this.panelGameStatus.BackgroundImage = global::ShiftOS.WinForms.Properties.Resources.SweeperNormalFace;
+ this.panelGameStatus.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
+ this.panelGameStatus.Image = global::ShiftOS.WinForms.Properties.Resources.SweeperNormalFace;
+ this.panelGameStatus.Location = new System.Drawing.Point(264, 3);
+ this.panelGameStatus.Name = "panelGameStatus";
+ this.panelGameStatus.Size = new System.Drawing.Size(32, 32);
+ this.panelGameStatus.TabIndex = 0;
+ this.panelGameStatus.TabStop = false;
+ this.panelGameStatus.Click += new System.EventHandler(this.panelGameStatus_Click);
+ //
+ // gamePanel
+ //
+ this.gamePanel.AutoScroll = true;
+ this.gamePanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.gamePanel.ColumnCount = 1;
+ this.gamePanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
+ this.gamePanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
+ this.gamePanel.Location = new System.Drawing.Point(4, 40);
+ this.gamePanel.MaximumSize = new System.Drawing.Size(553, 308);
+ this.gamePanel.MinimumSize = new System.Drawing.Size(553, 308);
+ this.gamePanel.Name = "gamePanel";
+ this.gamePanel.RowCount = 1;
+ this.gamePanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.gamePanel.Size = new System.Drawing.Size(553, 308);
+ this.gamePanel.TabIndex = 1;
+ this.gamePanel.Paint += new System.Windows.Forms.PaintEventHandler(this.gamePanel_Paint);
+ //
+ // buttonEasy
+ //
+ this.buttonEasy.Location = new System.Drawing.Point(4, 354);
+ this.buttonEasy.Name = "buttonEasy";
+ this.buttonEasy.Size = new System.Drawing.Size(75, 23);
+ this.buttonEasy.TabIndex = 2;
+ this.buttonEasy.Text = "Easy";
+ this.buttonEasy.UseVisualStyleBackColor = true;
+ this.buttonEasy.Click += new System.EventHandler(this.buttonEasy_Click);
+ //
+ // buttonMedium
+ //
+ this.buttonMedium.Location = new System.Drawing.Point(244, 354);
+ this.buttonMedium.Name = "buttonMedium";
+ this.buttonMedium.Size = new System.Drawing.Size(75, 23);
+ this.buttonMedium.TabIndex = 3;
+ this.buttonMedium.Text = "Medium";
+ this.buttonMedium.UseVisualStyleBackColor = true;
+ this.buttonMedium.Click += new System.EventHandler(this.buttonMedium_Click);
+ //
+ // buttonHard
+ //
+ this.buttonHard.Location = new System.Drawing.Point(482, 354);
+ this.buttonHard.Name = "buttonHard";
+ this.buttonHard.Size = new System.Drawing.Size(75, 23);
+ this.buttonHard.TabIndex = 4;
+ this.buttonHard.Text = "Hard";
+ this.buttonHard.UseVisualStyleBackColor = true;
+ this.buttonHard.Click += new System.EventHandler(this.buttonHard_Click);
//
// lblmines
//
@@ -169,139 +155,26 @@ namespace ShiftOS.WinForms.Applications
this.lblinfo2.AutoSize = true;
this.lblinfo2.Location = new System.Drawing.Point(4, 22);
this.lblinfo2.Name = "lblinfo2";
- this.lblinfo2.Size = new System.Drawing.Size(128, 13);
+ this.lblinfo2.Size = new System.Drawing.Size(231, 13);
this.lblinfo2.TabIndex = 8;
- this.lblinfo2.Text = "Right Button: Toggle Flag";
- //
- // flagButton
- //
- this.flagButton.Image = global::ShiftOS.WinForms.Properties.Resources.SweeperTileBlock;
- this.flagButton.Location = new System.Drawing.Point(525, 14);
- this.flagButton.Name = "flagButton";
- this.flagButton.Size = new System.Drawing.Size(20, 20);
- this.flagButton.TabIndex = 9;
- this.flagButton.TabStop = false;
- this.flagButton.Click += new System.EventHandler(this.flagButton_Click);
- //
- // mediumPanel
- //
- this.mediumPanel.ColumnCount = 16;
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249042F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.249044F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
- this.mediumPanel.Location = new System.Drawing.Point(4, 41);
- this.mediumPanel.Name = "mediumPanel";
- this.mediumPanel.RowCount = 16;
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249183F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.248558F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.248558F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.mediumPanel.Size = new System.Drawing.Size(541, 307);
- this.mediumPanel.TabIndex = 2;
- //
- // hardPanel
- //
- this.hardPanel.ColumnCount = 27;
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F));
- this.hardPanel.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize;
- this.hardPanel.Location = new System.Drawing.Point(4, 40);
- this.hardPanel.Name = "hardPanel";
- this.hardPanel.RowCount = 16;
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249183F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.249182F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.248558F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.248558F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 6.251231F));
- this.hardPanel.Size = new System.Drawing.Size(541, 308);
- this.hardPanel.TabIndex = 3;
+ this.lblinfo2.Text = "Right click to flag, middle click to question mark";
//
// ShiftSweeper
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.hardPanel);
- this.Controls.Add(this.mediumPanel);
- this.Controls.Add(this.flagButton);
this.Controls.Add(this.lblinfo2);
this.Controls.Add(this.lblinfo);
this.Controls.Add(this.lbltime);
this.Controls.Add(this.lblmines);
- this.Controls.Add(this.buttonH);
- this.Controls.Add(this.buttonM);
- this.Controls.Add(this.buttonE);
- this.Controls.Add(this.easyPanel);
- this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.buttonHard);
+ this.Controls.Add(this.buttonMedium);
+ this.Controls.Add(this.buttonEasy);
+ this.Controls.Add(this.gamePanel);
+ this.Controls.Add(this.panelGameStatus);
this.Name = "ShiftSweeper";
- this.Size = new System.Drawing.Size(563, 414);
- ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
- ((System.ComponentModel.ISupportInitialize)(this.flagButton)).EndInit();
+ this.Size = new System.Drawing.Size(596, 426);
+ ((System.ComponentModel.ISupportInitialize)(this.panelGameStatus)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -309,17 +182,14 @@ namespace ShiftOS.WinForms.Applications
#endregion
- private System.Windows.Forms.PictureBox pictureBox1;
- private System.Windows.Forms.TableLayoutPanel easyPanel;
- private System.Windows.Forms.Button buttonE;
- private System.Windows.Forms.Button buttonM;
- private System.Windows.Forms.Button buttonH;
+ private System.Windows.Forms.PictureBox panelGameStatus;
+ private System.Windows.Forms.TableLayoutPanel gamePanel;
+ private System.Windows.Forms.Button buttonEasy;
+ private System.Windows.Forms.Button buttonMedium;
+ private System.Windows.Forms.Button buttonHard;
private System.Windows.Forms.Label lblmines;
private System.Windows.Forms.Label lbltime;
private System.Windows.Forms.Label lblinfo;
private System.Windows.Forms.Label lblinfo2;
- private System.Windows.Forms.PictureBox flagButton;
- private System.Windows.Forms.TableLayoutPanel mediumPanel;
- private System.Windows.Forms.TableLayoutPanel hardPanel;
}
}
diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs
index c746017..f23ed73 100644
--- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs
+++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs
@@ -1,4 +1,4 @@
-/*
+/*
* MIT License
*
* Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs
@@ -33,338 +33,334 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
-namespace ShiftOS.WinForms.Applications
-{
+namespace ShiftOS.WinForms.Applications {
[Launcher("ShiftSweeper", true, "al_shiftsweeper", "Games")]
- [RequiresUpgrade("shiftsweeper")]
+ [AppscapeEntry("ShiftSweeper", "A simple Minesweeper game built for ShiftOS! Careful, it's a hard one.", 1600, 800, "shiftletters", "Games")]
+ [MultiplayerOnly]
[WinOpen("shiftsweeper")]
[DefaultIcon("iconShiftSweeper")]
- public partial class ShiftSweeper : UserControl, IShiftOSWindow
- {
- private bool gameplayed = false;
- private bool flagtime = false;
- private int mineCount = 0;
- private int origminecount;
- private int[,] minemap; //Represents status of tiles. 0-8 = how many mines surrounding. -1 = mine. -2 = flagged mine. -3 to -11 = flagged safe.
+ public partial class ShiftSweeper : UserControl, IShiftOSWindow {
+ int[,] game;
+ int[,] currentGame;
+ bool gameCreated = false;
+ int gameBombCount;
+ int currentGameWidth;
+ int currentGameHeight;
+
private Timer ticking = new Timer();
private int minetimer;
- private TableLayoutPanel minefieldPanel;
-
- public ShiftSweeper() { InitializeComponent(); }
- public void OnLoad()
- {
- buttonE.Visible = true;
- buttonM.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_medium");
- buttonH.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_hard");
- ticking.Interval = 1000;
- ticking.Tick += Ticking_Tick;
- easyPanel.Visible = false;
- mediumPanel.Visible = false;
- hardPanel.Visible = false;
+ private static readonly Random random = new Random();
+
+ Size tileSize;
+
+ Dictionary<int, string> buttonImages = new Dictionary<int, string>(){
+ {-3, "?" },
+ {-2, ">" },
+ {-1, "#" },
+ {0, " " },
+ {1, "1" },
+ {2, "2" },
+ {3, "3" },
+ {4, "4" },
+ {5, "5" },
+ {6, "6" },
+ {7, "7" },
+ {8, "8" },
+ {9, "9" }
+ };
+
+ Dictionary<int, Bitmap> buttonImagess = new Dictionary<int, Bitmap>(){
+ {-2, Properties.Resources.SweeperTileFlag }
+ };
+
+ // Properties.Resources.SweeperTileBomb
+
+ const int QUESTIONED = -3;
+ const int FLAGGED = -2;
+ const int UNDISCOVERED = -1;
+ const int REMOVE = -10;
+
+ public ShiftSweeper() {
+ InitializeComponent();
}
- private void Ticking_Tick(object sender, EventArgs e)
- {
+ private void Ticking_Tick(object sender, EventArgs e) {
minetimer++;
lbltime.Text = "Time: " + minetimer.ToString();
+ /*lbltime.Text = Localization.Parse("{SHIFTSWEEPER_TIME}", new Dictionary<string, string>{
+ {"%time", minetimer.ToString()}
+ });*/
}
- public void OnSkinLoad() { }
+ public void OnLoad() {
+ OnUpgrade();
- public bool OnUnload() { return true; }
+ ticking.Interval = 1000;
+ ticking.Tick += Ticking_Tick;
+ }
- public void OnUpgrade() { }
+ public void OnSkinLoad() {
- private void buttonE_Click(object sender, EventArgs e) { startGame(0); }
+ }
- private void clearPreviousGame()
- {
- if (minemap != null) for (int x = 0; x < minefieldPanel.ColumnCount; x++)
- {
- for (int y = 0; y < minefieldPanel.RowCount; y++)
- {
- minemap[x, y] = 0;
+ public bool OnUnload() {
+ return true;
+ }
- if (minefieldPanel.GetControlFromPosition(x,y) != null)
- {
- minefieldPanel.Controls.Remove(minefieldPanel.GetControlFromPosition(x, y));
+ public void OnUpgrade() {
+ buttonEasy.Visible = true;
+ buttonMedium.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_medium");
+ buttonHard.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_hard");
+ }
+
+ public void startGame(int w, int h, int b) {
+ panelGameStatus.Image = Properties.Resources.SweeperNormalFace;
+
+ if (gamePanel.RowCount > w || gamePanel.ColumnCount > h) {
+ for (int y = 0; y < gamePanel.ColumnCount; y++) {
+ for (int x = 0; x < gamePanel.RowCount; x++) {
+ updateTile(x, y, REMOVE);
}
}
}
+ gamePanel.RowCount = w;
+ gamePanel.ColumnCount = h;
+
+ game = new int[w, h];
+ currentGame = new int[w, h];
+
+ tileSize = new Size(23, 23);
+
+ gameCreated = false;
+
+ currentGameWidth = w;
+ currentGameHeight = h;
+ gameBombCount = b;
+
+ for (int y = 0; y < h; y++) {
+ for (int x = 0; x < w; x++) {
+ updateTile(x, y, UNDISCOVERED);
+ }
+ }
}
- private void startGame(int d)
- {
- pictureBox1.Image = Properties.Resources.SweeperNormalFace;
- clearPreviousGame();
- lbltime.Text = "Time: 0";
- minetimer = 0;
- ticking.Start();
- if (minefieldPanel != null) minefieldPanel.Visible = false;
- switch (d)
- {
- case 0:
- minefieldPanel = easyPanel;
- mineCount = 10;
- minefieldPanel.ColumnCount = 9;
- minefieldPanel.RowCount = 9;
- break;
-
- case 1:
- minefieldPanel = mediumPanel;
- mineCount = 40;
- minefieldPanel.ColumnCount = 16;
- minefieldPanel.RowCount = 16;
- break;
-
- case 2:
- minefieldPanel = hardPanel;
- mineCount = 99;
- minefieldPanel.ColumnCount = 30;
- minefieldPanel.RowCount = 16;
- break;
-
- default:
- throw new NullReferenceException();
+ public void updateTile(int x, int y, int type) {
+ Button tile = new Button();
+
+ if (type == REMOVE) {
+ } else {
+ tile.Text = buttonImages.ContainsKey(type) ? buttonImages[type] : "";
+ tile.BackgroundImage = buttonImagess.ContainsKey(type) ? buttonImagess[type] : tile.BackgroundImage;
+ tile.MouseDown += new MouseEventHandler(tile_ClickDown);
+ tile.MouseUp += new MouseEventHandler(tile_Click);
+ tile.FlatStyle = FlatStyle.Flat;
+ tile.FlatAppearance.BorderSize = (type == 0) ? 0 : 1;
+
+ tile.Size = tileSize;
+
+ currentGame[x, y] = type;
}
- minefieldPanel.Visible = true;
- origminecount = mineCount;
- lblmines.Text = "Mines: " + mineCount.ToString();
- buttonE.Enabled = false;
- buttonM.Enabled = false;
- buttonH.Enabled = false;
- gameplayed = true;
- makegrid();
+
+ var controlToRemove = gamePanel.GetControlFromPosition(y, x);
+
+ if (controlToRemove != null)
+ gamePanel.Controls.Remove(controlToRemove);
+
+ if (type != REMOVE)
+ gamePanel.Controls.Add(tile, y, x);
}
- private void makegrid()
- {
- Random rnd1 = new Random();
- minemap = new int[minefieldPanel.ColumnCount, minefieldPanel.RowCount];
-
- // Makes the minefield full of buttons
- for (int x = 0; x < minefieldPanel.ColumnCount; x++)
- {
- for (int y = 0; y < minefieldPanel.RowCount; y++)
- {
- minemap[x, y] = 0;
- minefieldPanel.Controls.Add(makeButton(x, y), x, y);
- }
+ private void tile_Click(object sender, EventArgs ee) {
+ panelGameStatus.Image = Properties.Resources.SweeperNormalFace;
+
+ MouseEventArgs e = (MouseEventArgs)ee;
+ Control sen = (Control)sender;
+ TableLayoutPanelCellPosition tilePos = gamePanel.GetPositionFromControl(sen);
+
+ if (e.Button == MouseButtons.Left) {
+ revealTile(tilePos.Row, tilePos.Column);
+ } else if (e.Button == MouseButtons.Right) {
+ toggleTileFlag(tilePos.Row, tilePos.Column);
+ } else if (e.Button == MouseButtons.Middle) {
+ toggleTileQuestionMark(tilePos.Row, tilePos.Column);
}
+ }
+
+ private void tile_ClickDown(object sender, EventArgs e) {
+ panelGameStatus.Image = Properties.Resources.SweeperClickFace;
+ }
+
+ private void createGameIfNotExists(int x, int y) {
+ if (!gameCreated) {
+ createGameIfNotExists();
+ int i = 0;
- // Placing the mines
- int currminecount = mineCount;
- while (currminecount > 0)
- {
- int mineX = rnd1.Next(minefieldPanel.ColumnCount);
- int mineY = rnd1.Next(minefieldPanel.RowCount);
-
- if (minemap[mineX, mineY] == 0)
- {
- minemap[mineX, mineY] = -1;
- currminecount--;
+ while (game[x, y] != 0 && i < 1000) {
+ i++;
+ createGameIfNotExists();
}
+
+ if(i > 999)
+ Infobox.Show("Error", "Failed to generate game");
+ return;
}
+ }
- // Setting the numbers
- for (int x = 0; x < minefieldPanel.ColumnCount; x++)
- {
- for (int y = 0; y < minefieldPanel.RowCount; y++)
- {
- if (minemap[x, y] != -1)
- {
- int numMines = 0;
- for (int xx = -1; xx < 2; xx++)
- {
- for (int yy = -1; yy < 2; yy++)
- {
- if (x + xx >= 0 && y + yy >= 0 && x + xx < minefieldPanel.ColumnCount && y + yy < minefieldPanel.RowCount)
- {
- if (minemap[x + xx, y + yy] == -1) numMines++;
- }
- }
- }
- minemap[x, y] = numMines;
- }
+ private void createGameIfNotExists() {
+ if (!gameCreated) {
+ for (int b = 0; b < gameBombCount; b++) { // place bombs
+ game[random.Next(0, currentGameWidth), random.Next(0, currentGameHeight)] = 9;
}
+ gameCreated = true;
+ ticking.Start();
}
}
- private Button makeButton(int col, int row)
- {
- Button bttn = new Button();
+ private int getBombCountInArea(int x, int y) {
+ createGameIfNotExists(x, y);
- bttn.Text = "";
- bttn.Name = col.ToString() + " " + row.ToString();
- Controls.AddRange(new System.Windows.Forms.Control[] { bttn, });
- bttn.Size = new System.Drawing.Size(minefieldPanel.Width / minefieldPanel.ColumnCount, (minefieldPanel.Height / minefieldPanel.RowCount) + 10);
- bttn.Click += new System.EventHandler(bttnOnclick);
- bttn.BackgroundImage = Properties.Resources.SweeperTileBlock;
- bttn.BackgroundImageLayout = ImageLayout.Stretch;
+ if (game[x, y] == 9) return 9;
- return bttn;
- }
+ int count = 0;
+ int w = currentGameWidth - 1;
+ int h = currentGameHeight - 1;
- private void bttnOnclick(object sender, EventArgs e)
- {
- if (!ticking.Enabled) return;
+ if (x > 0) count += game[x - 1, y] == 9 ? 1 : 0;
+ if (y > 0) count += game[x, y - 1] == 9 ? 1 : 0;
+ if (x < w) count += game[x + 1, y] == 9 ? 1 : 0;
+ if (y < h) count += game[x, y + 1] == 9 ? 1 : 0;
- Button bttnClick = sender as Button;
+ if (x > 0 && y > 0) count += game[x - 1, y - 1] == 9 ? 1 : 0;
+ if (x < w && y < h) count += game[x + 1, y + 1] == 9 ? 1 : 0;
+ if (x < w && y > 0) count += game[x + 1, y - 1] == 9 ? 1 : 0;
+ if (x > 0 && y < h) count += game[x - 1, y + 1] == 9 ? 1 : 0;
- if (bttnClick == null) return; //not a button.
+ return count;
+ }
- string[] split = bttnClick.Name.Split(new Char[] { ' ' });
+ private void revealTile(int x, int y) {
+ createGameIfNotExists(x, y);
- int x = System.Convert.ToInt32(split[0]);
- int y = System.Convert.ToInt32(split[1]);
+ int bombs = getBombCountInArea(x, y);
+ int previousBombs = currentGame[x, y];
+ updateTile(x, y, bombs);
- if (!flagtime)
- {
- if (minemap[x, y] == -1)
- {
- ticking.Enabled = false;
+ if (bombs == 0 && previousBombs == UNDISCOVERED) {
+ int w = currentGameWidth - 1;
+ int h = currentGameHeight - 1;
- buttonE.Enabled = true;
- buttonM.Enabled = true;
- buttonH.Enabled = true;
+ if (x > 0) revealTile(x - 1, y);
+ if (y > 0) revealTile(x, y - 1);
+ if (x < w) revealTile(x + 1, y);
+ if (y < h) revealTile(x, y + 1);
- pictureBox1.BackgroundImage = Properties.Resources.SweeperLoseFace;
+ if (x > 0 && y > 0) revealTile(x - 1, y - 1);
+ if (x < w && y < h) revealTile(x + 1, y + 1);
+ if (x < w && y > 0) revealTile(x + 1, y - 1);
+ if (x > 0 && y < h) revealTile(x - 1, y + 1);
+ }
- for (int xx = 0; xx < minefieldPanel.ColumnCount; xx++)
- {
- for (int yy = 0; yy < minefieldPanel.RowCount; yy++)
- {
- pictureBox1.BackgroundImage = Properties.Resources.SweeperLoseFace;
- minefieldPanel.GetControlFromPosition(xx, yy).Enabled = false;
- if (minemap[xx, yy] == -1)
- {
- minefieldPanel.GetControlFromPosition(xx, yy).BackgroundImage = Properties.Resources.SweeperTileBomb;
- }
+ if (bombs != 0) checkWinGame();
+ if (bombs == 9) loseGame();
+ }
- }
- }
- pictureBox1.Image = Properties.Resources.SweeperLoseFace;
- }
- else if (minemap[x, y] < -1) return;
- else removeBlank(x, y);
+ private void toggleTileFlag(int x, int y) {
+ if(currentGame[x,y] == UNDISCOVERED) {
+ updateTile(x, y, FLAGGED);
+ } else if(currentGame[x, y] == FLAGGED) {
+ updateTile(x, y, UNDISCOVERED);
}
- else
- {
- if (!bttnClick.Enabled) return;
-
- if (minemap[x, y] < -1)
- {
- minemap[x, y] = (minemap[x, y] * -1) - 3;
- bttnClick.BackgroundImage = Properties.Resources.SweeperTileBlock;
- mineCount++;
- }
- else
- {
- minemap[x, y] = (minemap[x, y] * -1) - 3;
- bttnClick.BackgroundImage = Properties.Resources.SweeperTileFlag;
- mineCount--;
- }
- lblmines.Text = "Mines: " + mineCount.ToString();
- bool wrongflags = false;
- if (mineCount == 0)
- {
- for (int xx = 0; xx < minefieldPanel.ColumnCount; xx++)
- {
- if (wrongflags) break;
- for (int yy = 0; yy < minefieldPanel.RowCount; yy++)
- {
- if (wrongflags) break;
- if (minemap[xx, yy] < -2) wrongflags = true;
- }
- }
- if (!wrongflags)
- {
- ticking.Enabled = false;
-
- buttonE.Enabled = true;
- buttonM.Enabled = true;
- buttonH.Enabled = true;
-
- for (int xx = 0; xx < minefieldPanel.ColumnCount; xx++)
- {
- for (int yy = 0; yy < minefieldPanel.RowCount; yy++)
- {
- minefieldPanel.GetControlFromPosition(xx, yy).Enabled = false;
- }
- }
- Int32 cp = 0;
- origminecount = origminecount * 10;
- if (minetimer < 31) cp = (origminecount * 3);
- if (minetimer < 61) cp = (Int32)(origminecount * 2.5);
- if (minetimer < 91) cp = (origminecount * 2);
- if (minetimer < 121) cp = (Int32)(origminecount * 1.5);
- if (minetimer > 120) cp = (origminecount * 1);
- SaveSystem.TransferCodepointsFrom("shiftsweeper", cp);
- pictureBox1.Image = Properties.Resources.SweeperWinFace;
+ checkWinGame();
+ }
+
+ private void toggleTileQuestionMark(int x, int y) {
+ if (currentGame[x, y] == UNDISCOVERED) {
+ updateTile(x, y, QUESTIONED);
+ } else if (currentGame[x, y] == QUESTIONED) {
+ updateTile(x, y, UNDISCOVERED);
+ }
+
+ checkWinGame();
+ }
+
+ private void buttonEasy_Click(object sender, EventArgs e) {
+ startGame(9, 9, 10);
+ }
+
+ private void buttonMedium_Click(object sender, EventArgs e) {
+ startGame(16, 16, 40);
+ }
+
+ private void buttonHard_Click(object sender, EventArgs e) {
+ startGame(30, 30, 99);
+ }
+
+ public void winGame() {
+ int cp = 0;
+ int origminecount = gameBombCount * 10;
+ if (minetimer < 31) cp = (origminecount * 3);
+ else if (minetimer < 61) cp = (Int32)(origminecount * 2.5);
+ else if (minetimer < 91) cp = (origminecount * 2);
+ else if (minetimer < 121) cp = (Int32)(origminecount * 1.5);
+ else if (minetimer > 120) cp = (origminecount * 1);
+ SaveSystem.TransferCodepointsFrom("shiftsweeper", cp);
+ panelGameStatus.Image = Properties.Resources.SweeperWinFace;
+ disableAllTiles(false);
+ }
+
+ public void loseGame() {
+ disableAllTiles(true);
+ panelGameStatus.Image = Properties.Resources.SweeperLoseFace;
+ }
+
+ public void disableAllTiles(bool showBombs) {
+ ticking.Stop();
+ minetimer = 0;
+ for (int y = 0; y < currentGameHeight; y++) {
+ for (int x = 0; x < currentGameWidth; x++) {
+ gamePanel.GetControlFromPosition(y, x).Visible = true;
+ gamePanel.GetControlFromPosition(y,x).Enabled = false;
+ if (game[x,y] == 9 && showBombs) {
+ gamePanel.GetControlFromPosition(y,x).BackgroundImage = Properties.Resources.SweeperTileBomb;
}
+
}
}
}
- private void removeBlank(int x, int y)
- {
- minefieldPanel.GetControlFromPosition(x, y).Enabled = false;
- trueform(x, y);
- if (minemap[x, y] != 0) return;
- for (int xx = -1; xx < 2; xx++)
- {
- for (int yy = -1; yy < 2; yy++)
- {
- if (x + xx >= 0 && y + yy >= 0 && x + xx < minefieldPanel.ColumnCount && y + yy < minefieldPanel.RowCount)
- {
- if (minefieldPanel.GetControlFromPosition(x + xx, y + yy).Enabled && minemap[x+xx,y+yy] != -1 && minemap[x + xx, y + yy] != -2)
- {
- minefieldPanel.GetControlFromPosition(x + xx, y + yy).Enabled = false;
- trueform(x + xx, y + yy);
- if (minemap[x + xx, y + yy] == 0)
- {
- removeBlank(x + xx, y + yy);
- }
+ public void checkWinGame() {
+ for(int y = 0; y < currentGameHeight; y++) {
+ for(int x = 0; x < currentGameWidth; x++) {
+ int tile = currentGame[x, y];
+ if(tile == UNDISCOVERED || tile == QUESTIONED) {
+ return;
+ }
+ if(tile == FLAGGED) {
+ if(game[x,y] != 9) {
+ // looks like you flagged the wrong thing...
+ return;
}
}
+ if(tile == 9) {
+ loseGame();
+ return;
+ }
+
}
}
+ winGame();
}
- private void trueform(int x, int y)
- {
- Button bttn = (Button)minefieldPanel.GetControlFromPosition(x, y);
- if (minemap[x,y] == 0) bttn.BackgroundImage = Properties.Resources.SweeperTile0;
- else if (minemap[x, y] == 1) bttn.BackgroundImage = Properties.Resources.SweeperTile1;
- else if (minemap[x, y] == 2) bttn.BackgroundImage = Properties.Resources.SweeperTile2;
- else if (minemap[x, y] == 3) bttn.BackgroundImage = Properties.Resources.SweeperTile3;
- else if (minemap[x, y] == 4) bttn.BackgroundImage = Properties.Resources.SweeperTile4;
- else if (minemap[x, y] == 5) bttn.BackgroundImage = Properties.Resources.SweeperTile5;
- else if (minemap[x, y] == 6) bttn.BackgroundImage = Properties.Resources.SweeperTile6;
- else if (minemap[x, y] == 7) bttn.BackgroundImage = Properties.Resources.SweeperTile7;
- else if (minemap[x, y] == 8) bttn.BackgroundImage = Properties.Resources.SweeperTile8;
- }
+ private void panelGameStatus_Click(object sender, EventArgs e) {
- private void buttonM_Click(object sender, EventArgs e) { startGame(1); }
+ }
- private void buttonH_Click(object sender, EventArgs e) { startGame(2); }
+ private void gamePanel_Paint(object sender, PaintEventArgs e) {
- private void flagButton_Click(object sender, EventArgs e)
- {
- if (flagtime)
- {
- flagButton.Image = Properties.Resources.SweeperTileBlock;
- flagtime = false;
- }
- else
- {
- flagButton.Image = Properties.Resources.SweeperTileFlag;
- flagtime = true;
- }
}
}
}
diff --git a/ShiftOS.WinForms/Applications/Shifter.Designer.cs b/ShiftOS.WinForms/Applications/Shifter.Designer.cs
index 44045b5..7ef20bf 100644
--- a/ShiftOS.WinForms/Applications/Shifter.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Shifter.Designer.cs
@@ -37,11 +37,15 @@ namespace ShiftOS.WinForms.Applications
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
- if (disposing && (components != null))
+ try
{
- components.Dispose();
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
}
- base.Dispose(disposing);
+ catch { }
}
#region Windows Form Designer generated code
@@ -52,103 +56,321 @@ namespace ShiftOS.WinForms.Applications
/// </summary>
private void InitializeComponent()
{
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Shifter));
this.panel1 = new System.Windows.Forms.Panel();
- this.panel4 = new System.Windows.Forms.Panel();
+ this.pnlpreview = new System.Windows.Forms.Panel();
+ this.pnlwindow = new System.Windows.Forms.Panel();
+ this.pnlcontents = new System.Windows.Forms.Panel();
+ this.pnltitle = new System.Windows.Forms.Panel();
+ this.pnlicon = new System.Windows.Forms.Panel();
+ this.pnlminimize = new System.Windows.Forms.Panel();
+ this.pnlmaximize = new System.Windows.Forms.Panel();
+ this.pnlclose = new System.Windows.Forms.Panel();
+ this.pnltitleleft = new System.Windows.Forms.Panel();
+ this.pnltitleright = new System.Windows.Forms.Panel();
+ this.lbtitletext = new System.Windows.Forms.Label();
+ this.pnlbottom = new System.Windows.Forms.Panel();
+ this.pnlbottomr = new System.Windows.Forms.Panel();
+ this.pnlbottoml = new System.Windows.Forms.Panel();
+ this.pnlright = new System.Windows.Forms.Panel();
+ this.pnlleft = new System.Windows.Forms.Panel();
+ this.pnlsettingsholder = new System.Windows.Forms.Panel();
this.flbody = new System.Windows.Forms.FlowLayoutPanel();
this.flcategory = new System.Windows.Forms.FlowLayoutPanel();
- this.panel3 = new System.Windows.Forms.Panel();
- this.label1 = new System.Windows.Forms.Label();
- this.panel2 = new System.Windows.Forms.Panel();
+ this.pnlcategoryholder = new System.Windows.Forms.Panel();
this.flmeta = new System.Windows.Forms.FlowLayoutPanel();
this.btnapply = new System.Windows.Forms.Button();
+ this.mspreview = new System.Windows.Forms.MenuStrip();
+ this.menuToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuItem1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.menuItem2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.subitem1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.subitem2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.subitem3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.separatorToolStripMenuItem = new System.Windows.Forms.ToolStripSeparator();
+ this.menuItem3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tspreview = new System.Windows.Forms.ToolStrip();
+ this.toolStripLabel1 = new System.Windows.Forms.ToolStripLabel();
+ this.toolStripButton1 = new System.Windows.Forms.ToolStripButton();
+ this.toolStripButton2 = new System.Windows.Forms.ToolStripButton();
+ this.toolStripButton3 = new System.Windows.Forms.ToolStripButton();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.toolStripTextBox1 = new System.Windows.Forms.ToolStripTextBox();
+ this.pnlintro = new System.Windows.Forms.Panel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.pnldesktoppreview = new System.Windows.Forms.Panel();
+ this.pnlscreensaver = new System.Windows.Forms.Panel();
+ this.pnlssicon = new System.Windows.Forms.Panel();
+ this.desktoppanel = new System.Windows.Forms.Panel();
+ 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.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.item1ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.item2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.item3ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.item4ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.item5ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.shutdownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.separatorToolStripMenuItem1 = new System.Windows.Forms.ToolStripSeparator();
this.panel1.SuspendLayout();
- this.panel4.SuspendLayout();
- this.panel3.SuspendLayout();
- this.panel2.SuspendLayout();
+ this.pnlpreview.SuspendLayout();
+ this.pnlwindow.SuspendLayout();
+ this.pnlcontents.SuspendLayout();
+ this.pnltitle.SuspendLayout();
+ this.pnlbottom.SuspendLayout();
+ this.pnlsettingsholder.SuspendLayout();
+ this.pnlcategoryholder.SuspendLayout();
+ this.mspreview.SuspendLayout();
+ this.tspreview.SuspendLayout();
+ this.pnlintro.SuspendLayout();
+ this.pnldesktoppreview.SuspendLayout();
+ this.pnlscreensaver.SuspendLayout();
+ this.desktoppanel.SuspendLayout();
+ this.sysmenuholder.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
+ this.pnladvancedal.SuspendLayout();
+ this.pnlalsystemactions.SuspendLayout();
+ this.pnlstatus.SuspendLayout();
this.SuspendLayout();
//
// panel1
//
- this.panel1.Controls.Add(this.panel4);
- this.panel1.Controls.Add(this.panel3);
- this.panel1.Controls.Add(this.panel2);
+ this.panel1.Controls.Add(this.pnlpreview);
+ this.panel1.Controls.Add(this.pnlsettingsholder);
+ this.panel1.Controls.Add(this.pnlcategoryholder);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(893, 539);
this.panel1.TabIndex = 0;
//
- // panel4
+ // pnlpreview
+ //
+ this.pnlpreview.Controls.Add(this.pnldesktoppreview);
+ this.pnlpreview.Controls.Add(this.pnlintro);
+ this.pnlpreview.Controls.Add(this.pnlwindow);
+ this.pnlpreview.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlpreview.Location = new System.Drawing.Point(136, 0);
+ this.pnlpreview.Name = "pnlpreview";
+ this.pnlpreview.Size = new System.Drawing.Size(757, 286);
+ this.pnlpreview.TabIndex = 1;
+ //
+ // pnlwindow
+ //
+ this.pnlwindow.Controls.Add(this.pnlcontents);
+ this.pnlwindow.Controls.Add(this.pnltitle);
+ this.pnlwindow.Controls.Add(this.pnlbottom);
+ this.pnlwindow.Controls.Add(this.pnlright);
+ this.pnlwindow.Controls.Add(this.pnlleft);
+ this.pnlwindow.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlwindow.Location = new System.Drawing.Point(0, 0);
+ this.pnlwindow.Name = "pnlwindow";
+ this.pnlwindow.Size = new System.Drawing.Size(757, 286);
+ this.pnlwindow.TabIndex = 0;
+ //
+ // pnlcontents
+ //
+ this.pnlcontents.BackColor = System.Drawing.Color.Black;
+ this.pnlcontents.Controls.Add(this.tspreview);
+ this.pnlcontents.Controls.Add(this.mspreview);
+ this.pnlcontents.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlcontents.ForeColor = System.Drawing.Color.White;
+ this.pnlcontents.Location = new System.Drawing.Point(2, 30);
+ this.pnlcontents.Name = "pnlcontents";
+ this.pnlcontents.Size = new System.Drawing.Size(753, 254);
+ this.pnlcontents.TabIndex = 9;
+ //
+ // pnltitle
+ //
+ this.pnltitle.BackColor = System.Drawing.Color.Black;
+ this.pnltitle.Controls.Add(this.pnlicon);
+ this.pnltitle.Controls.Add(this.pnlminimize);
+ this.pnltitle.Controls.Add(this.pnlmaximize);
+ this.pnltitle.Controls.Add(this.pnlclose);
+ this.pnltitle.Controls.Add(this.pnltitleleft);
+ this.pnltitle.Controls.Add(this.pnltitleright);
+ this.pnltitle.Controls.Add(this.lbtitletext);
+ this.pnltitle.Dock = System.Windows.Forms.DockStyle.Top;
+ this.pnltitle.Location = new System.Drawing.Point(2, 0);
+ this.pnltitle.Name = "pnltitle";
+ this.pnltitle.Size = new System.Drawing.Size(753, 30);
+ this.pnltitle.TabIndex = 5;
+ //
+ // pnlicon
+ //
+ this.pnlicon.Location = new System.Drawing.Point(9, -76);
+ this.pnlicon.Name = "pnlicon";
+ this.pnlicon.Size = new System.Drawing.Size(200, 100);
+ this.pnlicon.TabIndex = 6;
+ //
+ // pnlminimize
+ //
+ this.pnlminimize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.pnlminimize.BackColor = System.Drawing.Color.Green;
+ this.pnlminimize.Location = new System.Drawing.Point(672, 3);
+ this.pnlminimize.Name = "pnlminimize";
+ this.pnlminimize.Size = new System.Drawing.Size(24, 24);
+ this.pnlminimize.TabIndex = 3;
+ //
+ // pnlmaximize
+ //
+ this.pnlmaximize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.pnlmaximize.BackColor = System.Drawing.Color.Yellow;
+ this.pnlmaximize.Location = new System.Drawing.Point(699, 3);
+ this.pnlmaximize.Name = "pnlmaximize";
+ this.pnlmaximize.Size = new System.Drawing.Size(24, 24);
+ this.pnlmaximize.TabIndex = 2;
+ //
+ // pnlclose
+ //
+ this.pnlclose.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.pnlclose.BackColor = System.Drawing.Color.Red;
+ this.pnlclose.Location = new System.Drawing.Point(726, 3);
+ this.pnlclose.Name = "pnlclose";
+ this.pnlclose.Size = new System.Drawing.Size(24, 24);
+ this.pnlclose.TabIndex = 1;
//
- this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ // pnltitleleft
+ //
+ this.pnltitleleft.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pnltitleleft.Location = new System.Drawing.Point(0, 0);
+ this.pnltitleleft.Name = "pnltitleleft";
+ this.pnltitleleft.Size = new System.Drawing.Size(2, 30);
+ this.pnltitleleft.TabIndex = 4;
+ //
+ // pnltitleright
+ //
+ this.pnltitleright.Dock = System.Windows.Forms.DockStyle.Right;
+ this.pnltitleright.Location = new System.Drawing.Point(751, 0);
+ this.pnltitleright.Name = "pnltitleright";
+ this.pnltitleright.Size = new System.Drawing.Size(2, 30);
+ this.pnltitleright.TabIndex = 5;
+ //
+ // lbtitletext
+ //
+ this.lbtitletext.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.panel4.Controls.Add(this.flbody);
- this.panel4.Controls.Add(this.flcategory);
- this.panel4.Location = new System.Drawing.Point(154, 283);
- this.panel4.Name = "panel4";
- this.panel4.Size = new System.Drawing.Size(734, 253);
- this.panel4.TabIndex = 2;
+ this.lbtitletext.AutoSize = true;
+ this.lbtitletext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.lbtitletext.Font = new System.Drawing.Font("Consolas", 9F, System.Drawing.FontStyle.Bold);
+ this.lbtitletext.ForeColor = System.Drawing.Color.White;
+ this.lbtitletext.Location = new System.Drawing.Point(75, 9);
+ this.lbtitletext.Name = "lbtitletext";
+ this.lbtitletext.Size = new System.Drawing.Size(77, 14);
+ this.lbtitletext.TabIndex = 0;
+ this.lbtitletext.Text = "Title text";
+ this.lbtitletext.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ this.lbtitletext.UseMnemonic = false;
+ //
+ // pnlbottom
+ //
+ this.pnlbottom.BackColor = System.Drawing.Color.Black;
+ this.pnlbottom.Controls.Add(this.pnlbottomr);
+ this.pnlbottom.Controls.Add(this.pnlbottoml);
+ this.pnlbottom.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.pnlbottom.Location = new System.Drawing.Point(2, 284);
+ this.pnlbottom.Name = "pnlbottom";
+ this.pnlbottom.Size = new System.Drawing.Size(753, 2);
+ this.pnlbottom.TabIndex = 6;
+ //
+ // pnlbottomr
+ //
+ this.pnlbottomr.Dock = System.Windows.Forms.DockStyle.Right;
+ this.pnlbottomr.Location = new System.Drawing.Point(751, 0);
+ this.pnlbottomr.Name = "pnlbottomr";
+ this.pnlbottomr.Size = new System.Drawing.Size(2, 2);
+ this.pnlbottomr.TabIndex = 3;
+ //
+ // pnlbottoml
+ //
+ this.pnlbottoml.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pnlbottoml.Location = new System.Drawing.Point(0, 0);
+ this.pnlbottoml.Name = "pnlbottoml";
+ this.pnlbottoml.Size = new System.Drawing.Size(2, 2);
+ this.pnlbottoml.TabIndex = 2;
+ //
+ // pnlright
+ //
+ this.pnlright.BackColor = System.Drawing.Color.Black;
+ this.pnlright.Dock = System.Windows.Forms.DockStyle.Right;
+ this.pnlright.Location = new System.Drawing.Point(755, 0);
+ this.pnlright.Name = "pnlright";
+ this.pnlright.Size = new System.Drawing.Size(2, 286);
+ this.pnlright.TabIndex = 8;
+ //
+ // pnlleft
+ //
+ this.pnlleft.BackColor = System.Drawing.Color.Black;
+ this.pnlleft.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pnlleft.Location = new System.Drawing.Point(0, 0);
+ this.pnlleft.Name = "pnlleft";
+ this.pnlleft.Size = new System.Drawing.Size(2, 286);
+ this.pnlleft.TabIndex = 7;
+ //
+ // pnlsettingsholder
+ //
+ this.pnlsettingsholder.Controls.Add(this.flbody);
+ this.pnlsettingsholder.Controls.Add(this.flcategory);
+ this.pnlsettingsholder.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.pnlsettingsholder.Location = new System.Drawing.Point(136, 286);
+ this.pnlsettingsholder.Name = "pnlsettingsholder";
+ this.pnlsettingsholder.Padding = new System.Windows.Forms.Padding(10);
+ this.pnlsettingsholder.Size = new System.Drawing.Size(757, 253);
+ this.pnlsettingsholder.TabIndex = 2;
//
// flbody
//
this.flbody.AutoScroll = true;
this.flbody.Dock = System.Windows.Forms.DockStyle.Fill;
- this.flbody.Location = new System.Drawing.Point(126, 0);
+ this.flbody.Location = new System.Drawing.Point(136, 10);
this.flbody.Name = "flbody";
- this.flbody.Size = new System.Drawing.Size(608, 253);
+ this.flbody.Size = new System.Drawing.Size(611, 233);
this.flbody.TabIndex = 3;
//
// flcategory
//
this.flcategory.Dock = System.Windows.Forms.DockStyle.Left;
- this.flcategory.Location = new System.Drawing.Point(0, 0);
+ this.flcategory.Location = new System.Drawing.Point(10, 10);
this.flcategory.Name = "flcategory";
- this.flcategory.Size = new System.Drawing.Size(126, 253);
+ this.flcategory.Size = new System.Drawing.Size(126, 233);
this.flcategory.TabIndex = 2;
//
- // panel3
+ // pnlcategoryholder
//
- this.panel3.Controls.Add(this.label1);
- this.panel3.Location = new System.Drawing.Point(155, 12);
- this.panel3.Name = "panel3";
- this.panel3.Size = new System.Drawing.Size(640, 360);
- this.panel3.TabIndex = 1;
- //
- // label1
- //
- this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.label1.Location = new System.Drawing.Point(0, 0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(640, 360);
- this.label1.TabIndex = 0;
- this.label1.Text = "Preview not available.";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
- //
- // panel2
- //
- this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)));
- this.panel2.Controls.Add(this.flmeta);
- this.panel2.Controls.Add(this.btnapply);
- this.panel2.Location = new System.Drawing.Point(12, 12);
- this.panel2.Name = "panel2";
- this.panel2.Size = new System.Drawing.Size(136, 511);
- this.panel2.TabIndex = 0;
+ this.pnlcategoryholder.Controls.Add(this.flmeta);
+ this.pnlcategoryholder.Controls.Add(this.btnapply);
+ this.pnlcategoryholder.Dock = System.Windows.Forms.DockStyle.Left;
+ this.pnlcategoryholder.Location = new System.Drawing.Point(0, 0);
+ this.pnlcategoryholder.Name = "pnlcategoryholder";
+ this.pnlcategoryholder.Padding = new System.Windows.Forms.Padding(10);
+ this.pnlcategoryholder.Size = new System.Drawing.Size(136, 539);
+ this.pnlcategoryholder.TabIndex = 0;
//
// flmeta
//
this.flmeta.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.flmeta.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
- this.flmeta.Location = new System.Drawing.Point(4, 4);
+ this.flmeta.Location = new System.Drawing.Point(14, 14);
this.flmeta.Name = "flmeta";
- this.flmeta.Size = new System.Drawing.Size(126, 450);
+ this.flmeta.Size = new System.Drawing.Size(126, 458);
this.flmeta.TabIndex = 1;
//
// btnapply
//
this.btnapply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.btnapply.Location = new System.Drawing.Point(3, 460);
+ this.btnapply.Location = new System.Drawing.Point(13, 478);
this.btnapply.Name = "btnapply";
this.btnapply.Size = new System.Drawing.Size(127, 48);
this.btnapply.TabIndex = 0;
@@ -156,19 +378,407 @@ namespace ShiftOS.WinForms.Applications
this.btnapply.UseVisualStyleBackColor = true;
this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
//
+ // mspreview
+ //
+ this.mspreview.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.menuToolStripMenuItem});
+ this.mspreview.Location = new System.Drawing.Point(0, 0);
+ this.mspreview.Name = "mspreview";
+ this.mspreview.Size = new System.Drawing.Size(753, 24);
+ this.mspreview.TabIndex = 0;
+ this.mspreview.Text = "menuStrip1";
+ //
+ // menuToolStripMenuItem
+ //
+ this.menuToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.menuItem1ToolStripMenuItem,
+ this.menuItem2ToolStripMenuItem,
+ this.separatorToolStripMenuItem,
+ this.menuItem3ToolStripMenuItem});
+ this.menuToolStripMenuItem.Name = "menuToolStripMenuItem";
+ this.menuToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
+ this.menuToolStripMenuItem.Text = "Menu";
+ //
+ // menuItem1ToolStripMenuItem
+ //
+ this.menuItem1ToolStripMenuItem.Name = "menuItem1ToolStripMenuItem";
+ this.menuItem1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.menuItem1ToolStripMenuItem.Text = "Menu Item 1";
+ //
+ // menuItem2ToolStripMenuItem
+ //
+ this.menuItem2ToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.subitem1ToolStripMenuItem,
+ this.subitem2ToolStripMenuItem,
+ this.subitem3ToolStripMenuItem});
+ this.menuItem2ToolStripMenuItem.Name = "menuItem2ToolStripMenuItem";
+ this.menuItem2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.menuItem2ToolStripMenuItem.Text = "Menu Item 2";
+ //
+ // subitem1ToolStripMenuItem
+ //
+ this.subitem1ToolStripMenuItem.Name = "subitem1ToolStripMenuItem";
+ this.subitem1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.subitem1ToolStripMenuItem.Text = "Subitem 1";
+ //
+ // subitem2ToolStripMenuItem
+ //
+ this.subitem2ToolStripMenuItem.Name = "subitem2ToolStripMenuItem";
+ this.subitem2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.subitem2ToolStripMenuItem.Text = "Subitem 2";
+ //
+ // subitem3ToolStripMenuItem
+ //
+ this.subitem3ToolStripMenuItem.Name = "subitem3ToolStripMenuItem";
+ this.subitem3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.subitem3ToolStripMenuItem.Text = "Subitem 3";
+ //
+ // separatorToolStripMenuItem
+ //
+ this.separatorToolStripMenuItem.Name = "separatorToolStripMenuItem";
+ this.separatorToolStripMenuItem.Size = new System.Drawing.Size(149, 6);
+ //
+ // menuItem3ToolStripMenuItem
+ //
+ this.menuItem3ToolStripMenuItem.Name = "menuItem3ToolStripMenuItem";
+ this.menuItem3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.menuItem3ToolStripMenuItem.Text = "Menu Item 3";
+ //
+ // tspreview
+ //
+ this.tspreview.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.toolStripLabel1,
+ this.toolStripButton2,
+ this.toolStripButton3,
+ this.toolStripButton1,
+ this.toolStripSeparator1,
+ this.toolStripTextBox1});
+ this.tspreview.Location = new System.Drawing.Point(0, 24);
+ this.tspreview.Name = "tspreview";
+ this.tspreview.Size = new System.Drawing.Size(753, 25);
+ this.tspreview.TabIndex = 1;
+ this.tspreview.Text = "toolStrip1";
+ //
+ // toolStripLabel1
+ //
+ this.toolStripLabel1.Name = "toolStripLabel1";
+ this.toolStripLabel1.Size = new System.Drawing.Size(81, 22);
+ this.toolStripLabel1.Text = "Toolbar Label:";
+ //
+ // toolStripButton1
+ //
+ this.toolStripButton1.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.toolStripButton1.Enabled = false;
+ this.toolStripButton1.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton1.Image")));
+ this.toolStripButton1.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolStripButton1.Name = "toolStripButton1";
+ this.toolStripButton1.Size = new System.Drawing.Size(56, 22);
+ this.toolStripButton1.Text = "Disabled";
+ //
+ // toolStripButton2
+ //
+ this.toolStripButton2.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.toolStripButton2.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton2.Image")));
+ this.toolStripButton2.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolStripButton2.Name = "toolStripButton2";
+ this.toolStripButton2.Size = new System.Drawing.Size(51, 22);
+ this.toolStripButton2.Text = "Regular";
+ //
+ // toolStripButton3
+ //
+ this.toolStripButton3.Checked = true;
+ this.toolStripButton3.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.toolStripButton3.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.toolStripButton3.Image = ((System.Drawing.Image)(resources.GetObject("toolStripButton3.Image")));
+ this.toolStripButton3.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.toolStripButton3.Name = "toolStripButton3";
+ this.toolStripButton3.Size = new System.Drawing.Size(57, 22);
+ this.toolStripButton3.Text = "Checked";
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
+ //
+ // toolStripTextBox1
+ //
+ this.toolStripTextBox1.Name = "toolStripTextBox1";
+ this.toolStripTextBox1.Size = new System.Drawing.Size(100, 25);
+ //
+ // pnlintro
+ //
+ this.pnlintro.Controls.Add(this.label2);
+ this.pnlintro.Controls.Add(this.label1);
+ this.pnlintro.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlintro.Location = new System.Drawing.Point(0, 0);
+ this.pnlintro.Name = "pnlintro";
+ this.pnlintro.Size = new System.Drawing.Size(757, 286);
+ this.pnlintro.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label1.Location = new System.Drawing.Point(0, 0);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(757, 54);
+ this.label1.TabIndex = 0;
+ this.label1.Tag = "header2";
+ this.label1.Text = "Welcome to the Shifter!";
+ this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // label2
+ //
+ this.label2.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.label2.Location = new System.Drawing.Point(0, 54);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(757, 232);
+ this.label2.TabIndex = 1;
+ this.label2.Text = resources.GetString("label2.Text");
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // pnldesktoppreview
+ //
+ this.pnldesktoppreview.Controls.Add(this.pnlscreensaver);
+ this.pnldesktoppreview.Controls.Add(this.desktoppanel);
+ this.pnldesktoppreview.Controls.Add(this.pnladvancedal);
+ this.pnldesktoppreview.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnldesktoppreview.Location = new System.Drawing.Point(0, 0);
+ this.pnldesktoppreview.Name = "pnldesktoppreview";
+ this.pnldesktoppreview.Size = new System.Drawing.Size(757, 286);
+ this.pnldesktoppreview.TabIndex = 2;
+ //
+ // pnlscreensaver
+ //
+ this.pnlscreensaver.Controls.Add(this.pnlssicon);
+ this.pnlscreensaver.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlscreensaver.Location = new System.Drawing.Point(0, 24);
+ this.pnlscreensaver.Name = "pnlscreensaver";
+ this.pnlscreensaver.Size = new System.Drawing.Size(757, 262);
+ this.pnlscreensaver.TabIndex = 3;
+ 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;
+ //
+ // desktoppanel
+ //
+ this.desktoppanel.BackColor = System.Drawing.Color.Green;
+ this.desktoppanel.Controls.Add(this.lbtime);
+ this.desktoppanel.Controls.Add(this.panelbuttonholder);
+ this.desktoppanel.Controls.Add(this.sysmenuholder);
+ this.desktoppanel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.desktoppanel.Location = new System.Drawing.Point(0, 0);
+ this.desktoppanel.Name = "desktoppanel";
+ this.desktoppanel.Size = new System.Drawing.Size(757, 24);
+ this.desktoppanel.TabIndex = 2;
+ //
+ // 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(-536, 0);
+ this.lbtime.Name = "lbtime";
+ this.lbtime.Size = new System.Drawing.Size(35, 13);
+ this.lbtime.TabIndex = 0;
+ this.lbtime.Text = "label1";
+ this.lbtime.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // panelbuttonholder
+ //
+ this.panelbuttonholder.AutoSize = true;
+ this.panelbuttonholder.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.panelbuttonholder.Location = new System.Drawing.Point(107, -77);
+ this.panelbuttonholder.Name = "panelbuttonholder";
+ this.panelbuttonholder.Size = new System.Drawing.Size(0, 0);
+ this.panelbuttonholder.TabIndex = 2;
+ //
+ // sysmenuholder
+ //
+ this.sysmenuholder.Controls.Add(this.menuStrip1);
+ this.sysmenuholder.Location = new System.Drawing.Point(12, 5);
+ this.sysmenuholder.Name = "sysmenuholder";
+ this.sysmenuholder.Size = new System.Drawing.Size(68, 24);
+ this.sysmenuholder.TabIndex = 1;
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.apps});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Padding = new System.Windows.Forms.Padding(0);
+ this.menuStrip1.Size = new System.Drawing.Size(68, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // apps
+ //
+ this.apps.AutoSize = false;
+ this.apps.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.item1ToolStripMenuItem,
+ this.item2ToolStripMenuItem,
+ this.item3ToolStripMenuItem,
+ this.item4ToolStripMenuItem,
+ this.item5ToolStripMenuItem,
+ this.separatorToolStripMenuItem1,
+ this.shutdownToolStripMenuItem});
+ this.apps.Name = "apps";
+ this.apps.Padding = new System.Windows.Forms.Padding(0);
+ this.apps.Size = new System.Drawing.Size(58, 20);
+ this.apps.Tag = "applauncherbutton";
+ this.apps.Text = "ShiftOS";
+ //
+ // 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, -53);
+ this.pnladvancedal.Name = "pnladvancedal";
+ this.pnladvancedal.Size = new System.Drawing.Size(433, 417);
+ this.pnladvancedal.TabIndex = 4;
+ 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);
+ 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(363, 3);
+ this.btnshutdown.Name = "btnshutdown";
+ this.btnshutdown.Size = new System.Drawing.Size(67, 25);
+ this.btnshutdown.TabIndex = 0;
+ this.btnshutdown.Text = "Shutdown";
+ this.btnshutdown.UseVisualStyleBackColor = true;
+ //
+ // 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;
+ //
+ // item1ToolStripMenuItem
+ //
+ this.item1ToolStripMenuItem.Name = "item1ToolStripMenuItem";
+ this.item1ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.item1ToolStripMenuItem.Text = "Item 1";
+ //
+ // item2ToolStripMenuItem
+ //
+ this.item2ToolStripMenuItem.Name = "item2ToolStripMenuItem";
+ this.item2ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.item2ToolStripMenuItem.Text = "Item 2";
+ //
+ // item3ToolStripMenuItem
+ //
+ this.item3ToolStripMenuItem.Name = "item3ToolStripMenuItem";
+ this.item3ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.item3ToolStripMenuItem.Text = "Item 3";
+ //
+ // item4ToolStripMenuItem
+ //
+ this.item4ToolStripMenuItem.Name = "item4ToolStripMenuItem";
+ this.item4ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.item4ToolStripMenuItem.Text = "Item 4";
+ //
+ // item5ToolStripMenuItem
+ //
+ this.item5ToolStripMenuItem.Name = "item5ToolStripMenuItem";
+ this.item5ToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.item5ToolStripMenuItem.Text = "Item 5";
+ //
+ // shutdownToolStripMenuItem
+ //
+ this.shutdownToolStripMenuItem.Name = "shutdownToolStripMenuItem";
+ this.shutdownToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
+ this.shutdownToolStripMenuItem.Text = "Shutdown";
+ //
+ // separatorToolStripMenuItem1
+ //
+ this.separatorToolStripMenuItem1.Name = "separatorToolStripMenuItem1";
+ this.separatorToolStripMenuItem1.Size = new System.Drawing.Size(149, 6);
+ //
// Shifter
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.panel1);
this.Name = "Shifter";
- this.Text = "{SHIFTER_NAME}";
this.Size = new System.Drawing.Size(893, 539);
this.Load += new System.EventHandler(this.Shifter_Load);
this.panel1.ResumeLayout(false);
- this.panel4.ResumeLayout(false);
- this.panel3.ResumeLayout(false);
- this.panel2.ResumeLayout(false);
+ this.pnlpreview.ResumeLayout(false);
+ this.pnlwindow.ResumeLayout(false);
+ this.pnlcontents.ResumeLayout(false);
+ this.pnlcontents.PerformLayout();
+ this.pnltitle.ResumeLayout(false);
+ this.pnltitle.PerformLayout();
+ this.pnlbottom.ResumeLayout(false);
+ this.pnlsettingsholder.ResumeLayout(false);
+ this.pnlcategoryholder.ResumeLayout(false);
+ this.mspreview.ResumeLayout(false);
+ this.mspreview.PerformLayout();
+ this.tspreview.ResumeLayout(false);
+ this.tspreview.PerformLayout();
+ this.pnlintro.ResumeLayout(false);
+ this.pnldesktoppreview.ResumeLayout(false);
+ this.pnlscreensaver.ResumeLayout(false);
+ this.desktoppanel.ResumeLayout(false);
+ this.desktoppanel.PerformLayout();
+ this.sysmenuholder.ResumeLayout(false);
+ this.sysmenuholder.PerformLayout();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.pnladvancedal.ResumeLayout(false);
+ this.pnlalsystemactions.ResumeLayout(false);
+ this.pnlalsystemactions.PerformLayout();
+ this.pnlstatus.ResumeLayout(false);
this.ResumeLayout(false);
}
@@ -176,13 +786,69 @@ namespace ShiftOS.WinForms.Applications
#endregion
private System.Windows.Forms.Panel panel1;
- private System.Windows.Forms.Panel panel2;
+ private System.Windows.Forms.Panel pnlcategoryholder;
private System.Windows.Forms.FlowLayoutPanel flmeta;
private System.Windows.Forms.Button btnapply;
- private System.Windows.Forms.Panel panel4;
+ private System.Windows.Forms.Panel pnlsettingsholder;
private System.Windows.Forms.FlowLayoutPanel flbody;
private System.Windows.Forms.FlowLayoutPanel flcategory;
- private System.Windows.Forms.Panel panel3;
+ private System.Windows.Forms.Panel pnlpreview;
+ private System.Windows.Forms.Panel pnlwindow;
+ private System.Windows.Forms.Panel pnlcontents;
+ private System.Windows.Forms.Panel pnltitle;
+ private System.Windows.Forms.Panel pnlicon;
+ private System.Windows.Forms.Panel pnlminimize;
+ private System.Windows.Forms.Panel pnlmaximize;
+ private System.Windows.Forms.Panel pnlclose;
+ private System.Windows.Forms.Panel pnltitleleft;
+ private System.Windows.Forms.Panel pnltitleright;
+ private System.Windows.Forms.Label lbtitletext;
+ private System.Windows.Forms.Panel pnlbottom;
+ private System.Windows.Forms.Panel pnlbottomr;
+ private System.Windows.Forms.Panel pnlbottoml;
+ private System.Windows.Forms.Panel pnlright;
+ private System.Windows.Forms.Panel pnlleft;
+ private System.Windows.Forms.MenuStrip mspreview;
+ private System.Windows.Forms.ToolStripMenuItem menuToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem menuItem1ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem menuItem2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem subitem1ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem subitem2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem subitem3ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator separatorToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem menuItem3ToolStripMenuItem;
+ private System.Windows.Forms.ToolStrip tspreview;
+ private System.Windows.Forms.ToolStripLabel toolStripLabel1;
+ private System.Windows.Forms.ToolStripButton toolStripButton2;
+ private System.Windows.Forms.ToolStripButton toolStripButton3;
+ private System.Windows.Forms.ToolStripButton toolStripButton1;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripTextBox toolStripTextBox1;
+ private System.Windows.Forms.Panel pnlintro;
+ private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Panel pnldesktoppreview;
+ private System.Windows.Forms.Panel pnlscreensaver;
+ private System.Windows.Forms.Panel pnlssicon;
+ private System.Windows.Forms.Panel desktoppanel;
+ private System.Windows.Forms.Label lbtime;
+ private System.Windows.Forms.FlowLayoutPanel panelbuttonholder;
+ private System.Windows.Forms.Panel sysmenuholder;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem apps;
+ private System.Windows.Forms.Panel pnladvancedal;
+ private System.Windows.Forms.FlowLayoutPanel flapps;
+ private System.Windows.Forms.FlowLayoutPanel flcategories;
+ 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.ToolStripMenuItem item1ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem item2ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem item3ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem item4ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem item5ToolStripMenuItem;
+ private System.Windows.Forms.ToolStripSeparator separatorToolStripMenuItem1;
+ private System.Windows.Forms.ToolStripMenuItem shutdownToolStripMenuItem;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs
index 4d29cf8..1a59c80 100644
--- a/ShiftOS.WinForms/Applications/Shifter.cs
+++ b/ShiftOS.WinForms/Applications/Shifter.cs
@@ -26,20 +26,17 @@ using Newtonsoft.Json;
using ShiftOS.Objects.ShiftFS;
using System;
using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
using System.Drawing;
-using System.Linq;
using System.Reflection;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
using ShiftOS.WinForms.Tools;
+using System.Linq;
+using System.Threading;
namespace ShiftOS.WinForms.Applications
{
+ [MultiplayerOnly]
[Launcher("Shifter", true, "al_shifter", "Customization")]
[RequiresUpgrade("shifter")]
[WinOpen("shifter")]
@@ -52,6 +49,348 @@ namespace ShiftOS.WinForms.Applications
PopulateShifter();
}
+ [ShifterMeta("Desktop")]
+ public void ResetDesktop()
+ {
+ pnldesktoppreview.BringToFront();
+ pnldesktoppreview.Tag = "keepbg";
+ SetupDesktop();
+ }
+
+ /// <summary>
+ /// Populates the panel buttons.
+ /// </summary>
+ /// <returns>The panel buttons.</returns>
+ public void PopulatePanelButtons()
+ {
+ if (DesktopFunctions.ShowDefaultElements == true)
+ {
+ panelbuttonholder.Controls.Clear();
+ if (Shiftorium.IsInitiated == true)
+ {
+ if (Shiftorium.UpgradeInstalled("wm_panel_buttons"))
+ {
+
+ var pnlbtn = new Panel();
+ pnlbtn.Margin = new Padding(2, LoadedSkin.PanelButtonFromTop, 0, 0);
+ pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
+ pnlbtn.BackgroundImage = GetImage("panelbutton");
+ pnlbtn.BackgroundImageLayout = GetImageLayout("panelbutton");
+
+ var pnlbtntext = new Label();
+ pnlbtntext.Text = "Panel Button Text";
+ pnlbtntext.AutoSize = true;
+ pnlbtntext.Location = LoadedSkin.PanelButtonFromLeft;
+ pnlbtntext.ForeColor = LoadedSkin.PanelButtonTextColor;
+ pnlbtntext.BackColor = Color.Transparent;
+
+ pnlbtn.BackColor = LoadedSkin.PanelButtonColor;
+ if (pnlbtn.BackgroundImage != null)
+ {
+ pnlbtntext.BackColor = Color.Transparent;
+ }
+ pnlbtn.Size = LoadedSkin.PanelButtonSize;
+ pnlbtn.Tag = "keepbg";
+ pnlbtntext.Tag = "keepbg";
+ pnlbtn.Controls.Add(pnlbtntext);
+ this.panelbuttonholder.Controls.Add(pnlbtn);
+ pnlbtn.Show();
+ pnlbtntext.Show();
+
+ pnlbtntext.Font = LoadedSkin.PanelButtonFont;
+
+
+
+
+ }
+ }
+ }
+
+ }
+
+ /// <summary>
+ /// Setups the desktop.
+ /// </summary>
+ /// <returns>The desktop.</returns>
+ public void SetupDesktop()
+ {
+ if (DesktopFunctions.ShowDefaultElements == true)
+ {
+ desktoppanel.BackColor = Color.Green;
+
+ //upgrades
+
+ if (Shiftorium.IsInitiated == true)
+ {
+ desktoppanel.Visible = Shiftorium.UpgradeInstalled("desktop");
+ lbtime.Visible = Shiftorium.UpgradeInstalled("desktop_clock_widget");
+
+ //skinning
+ lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
+
+ panelbuttonholder.Top = 0;
+ panelbuttonholder.Left = LoadedSkin.PanelButtonHolderFromLeft;
+ panelbuttonholder.Height = desktoppanel.Height;
+ panelbuttonholder.BackColor = Color.Transparent;
+ panelbuttonholder.Margin = new Padding(0, 0, 0, 0);
+
+ sysmenuholder.Visible = Shiftorium.UpgradeInstalled("app_launcher");
+
+ //The Color Picker can give us transparent colors - which Windows Forms fucking despises when dealing with form backgrounds.
+ //To compensate, we must recreate the desktop color and make the alpha channel '255'.
+ pnldesktoppreview.BackColor = Color.FromArgb(LoadedSkin.DesktopColor.R, LoadedSkin.DesktopColor.G, LoadedSkin.DesktopColor.B);
+ //Not doing this will cause an ArgumentException.
+
+ pnldesktoppreview.BackgroundImage = SkinEngine.GetImage("desktopbackground");
+ pnldesktoppreview.BackgroundImageLayout = GetImageLayout("desktopbackground");
+ desktoppanel.BackColor = LoadedSkin.DesktopPanelColor;
+
+ var pnlimg = GetImage("desktoppanel");
+ if (pnlimg != null)
+ {
+ var bmp = new Bitmap(pnlimg);
+ bmp.MakeTransparent(Color.FromArgb(1, 0, 1));
+ pnlimg = bmp;
+ }
+
+ desktoppanel.BackgroundImage = pnlimg;
+ if (desktoppanel.BackgroundImage != null)
+ {
+ desktoppanel.BackColor = Color.Transparent;
+ }
+ var appimg = GetImage("applauncher");
+ if (appimg != null)
+ {
+ var bmp = new Bitmap(appimg);
+ bmp.MakeTransparent(Color.FromArgb(1, 0, 1));
+ appimg = bmp;
+ }
+ menuStrip1.BackgroundImage = appimg;
+ lbtime.ForeColor = LoadedSkin.DesktopPanelClockColor;
+ lbtime.Font = LoadedSkin.DesktopPanelClockFont;
+ if (desktoppanel.BackgroundImage == null)
+ {
+ lbtime.BackColor = LoadedSkin.DesktopPanelClockBackgroundColor;
+ }
+ else
+ {
+ lbtime.BackColor = Color.Transparent;
+ }
+ apps.Text = LoadedSkin.AppLauncherText;
+ sysmenuholder.Location = LoadedSkin.AppLauncherFromLeft;
+ sysmenuholder.Size = LoadedSkin.AppLauncherHolderSize;
+ apps.Size = sysmenuholder.Size;
+ menuStrip1.Renderer = new ShiftOSMenuRenderer(new AppLauncherColorTable(LoadedSkin));
+ desktoppanel.BackgroundImageLayout = GetImageLayout("desktoppanel");
+ desktoppanel.Height = LoadedSkin.DesktopPanelHeight;
+ if (LoadedSkin.DesktopPanelPosition == 1)
+ {
+ desktoppanel.Dock = DockStyle.Bottom;
+ }
+ else
+ {
+ desktoppanel.Dock = DockStyle.Top;
+ }
+ }
+ }
+ else
+ {
+ desktoppanel.Hide();
+ }
+
+ PopulatePanelButtons();
+ }
+
+
+
+
+ [ShifterMeta("Windows")]
+ public void SetupWindowPreview()
+ {
+ pnlwindow.BringToFront();
+ WBSetup();
+ }
+
+ [ShifterMeta("Menus")]
+ public void SetupMenusPreview()
+ {
+ SetupWindowPreview();
+ }
+
+ [ShifterMeta("System")]
+ public void SetupSystemPreview()
+ {
+ SetupWindowPreview();
+ }
+
+ /// <summary>
+ /// Setup this instance.
+ /// </summary>
+ public void WBSetup()
+ {
+ this.lbtitletext.Text = "Window Preview";
+
+ if (SaveSystem.CurrentSave != null)
+ {
+ this.pnltitle.Visible = Shiftorium.UpgradeInstalled("wm_titlebar");
+ this.pnlclose.Visible = Shiftorium.UpgradeInstalled("close_button");
+ this.pnlminimize.Visible = Shiftorium.UpgradeInstalled("minimize_button");
+ this.pnlmaximize.Visible =Shiftorium.UpgradeInstalled("maximize_button");
+ WBSetupSkin();
+ }
+ else
+ {
+ this.pnltitle.Visible = false;
+ this.pnlclose.Visible = false;
+ this.pnlminimize.Visible = false;
+ this.pnlmaximize.Visible = false;
+
+ }
+ }
+
+ public Image GetImage(string id)
+ {
+ var type = typeof(ShiftOS.Engine.Skin);
+ foreach(var field in type.GetFields(BindingFlags.Public | BindingFlags.Instance))
+ {
+ foreach(var attrib in field.GetCustomAttributes(false))
+ {
+ if(attrib is ImageAttribute)
+ {
+ var img = attrib as ImageAttribute;
+ if(img.Name == id)
+ {
+ return SkinEngine.ImageFromBinary((byte[])field.GetValue(LoadedSkin));
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public ImageLayout GetImageLayout(string img)
+ {
+ if (LoadedSkin.SkinImageLayouts.ContainsKey(img))
+ {
+ return LoadedSkin.SkinImageLayouts[img];
+ }
+ else
+ {
+ LoadedSkin.SkinImageLayouts.Add(img, ImageLayout.Tile);
+ return ImageLayout.Tile;
+ }
+
+ }
+
+ /// <summary>
+ /// Setups the skin.
+ /// </summary>
+ /// <returns>The skin.</returns>
+ public void WBSetupSkin()
+ {
+ this.DoubleBuffered = true;
+ var renderer = new ShiftOSMenuRenderer(LoadedSkin);
+ mspreview.Renderer = renderer;
+ tspreview.Renderer = renderer;
+ pnltitle.Height = LoadedSkin.TitlebarHeight;
+ pnltitle.BackColor = LoadedSkin.TitleBackgroundColor;
+ pnltitle.BackgroundImage = GetImage("titlebar");
+ pnltitleleft.Visible = LoadedSkin.ShowTitleCorners;
+ pnltitleright.Visible = LoadedSkin.ShowTitleCorners;
+ pnltitleleft.BackColor = LoadedSkin.TitleLeftCornerBackground;
+ pnltitleright.BackColor = LoadedSkin.TitleRightCornerBackground;
+ pnltitleleft.Width = LoadedSkin.TitleLeftCornerWidth;
+ pnltitleright.Width = LoadedSkin.TitleRightCornerWidth;
+ pnltitleleft.BackgroundImage = GetImage("titleleft");
+ pnltitleleft.BackgroundImageLayout = GetImageLayout("titleleft");
+ pnltitleright.BackgroundImage = GetImage("titleright");
+ pnltitleright.BackgroundImageLayout = GetImageLayout("titleright");
+ pnltitle.BackgroundImageLayout = GetImageLayout("titlebar"); //RETARD ALERT. WHY WASN'T THIS THERE WHEN IMAGELAYOUTS WERE FIRST IMPLEMENTED?
+
+ lbtitletext.BackColor = (pnltitle.BackgroundImage != null) ? Color.Transparent : LoadedSkin.TitleBackgroundColor;
+ lbtitletext.ForeColor = LoadedSkin.TitleTextColor;
+ lbtitletext.Font = LoadedSkin.TitleFont;
+
+ pnlleft.BackColor = LoadedSkin.BorderLeftBackground;
+ pnlleft.BackgroundImage = GetImage("leftborder");
+ pnlleft.BackgroundImageLayout = GetImageLayout("leftborder");
+ pnlleft.Width = LoadedSkin.LeftBorderWidth;
+ pnlright.BackColor = LoadedSkin.BorderRightBackground;
+ pnlright.BackgroundImage = GetImage("rightborder");
+ pnlright.BackgroundImageLayout = GetImageLayout("rightborder");
+ pnlright.Width = LoadedSkin.RightBorderWidth;
+
+ pnlbottom.BackColor = LoadedSkin.BorderBottomBackground;
+ pnlbottom.BackgroundImage = GetImage("bottomborder");
+ pnlbottom.BackgroundImageLayout = GetImageLayout("bottomborder");
+ pnlbottom.Height = LoadedSkin.BottomBorderWidth;
+
+ pnlbottomr.BackColor = LoadedSkin.BorderBottomRightBackground;
+ pnlbottomr.BackgroundImage = GetImage("bottomrborder");
+ pnlbottomr.BackgroundImageLayout = GetImageLayout("bottomrborder");
+ pnlbottoml.BackColor = LoadedSkin.BorderBottomLeftBackground;
+ pnlbottoml.BackgroundImage = GetImage("bottomlborder");
+ pnlbottoml.BackgroundImageLayout = GetImageLayout("bottomlborder");
+
+ lbtitletext.ForeColor = LoadedSkin.TitleTextColor;
+ lbtitletext.Font = LoadedSkin.TitleFont;
+ pnlclose.BackColor = LoadedSkin.CloseButtonColor;
+ pnlclose.BackgroundImage = GetImage("closebutton");
+ pnlclose.BackgroundImageLayout = GetImageLayout("closebutton");
+ pnlminimize.BackColor = LoadedSkin.MinimizeButtonColor;
+ pnlminimize.BackgroundImage = GetImage("minimizebutton");
+ pnlminimize.BackgroundImageLayout = GetImageLayout("minimizebutton");
+ pnlmaximize.BackColor = LoadedSkin.MaximizeButtonColor;
+ pnlmaximize.BackgroundImage = GetImage("maximizebutton");
+ pnlmaximize.BackgroundImageLayout = GetImageLayout("maximizebutton");
+
+ pnlclose.Size = LoadedSkin.CloseButtonSize;
+ pnlminimize.Size = LoadedSkin.MinimizeButtonSize;
+ pnlmaximize.Size = LoadedSkin.MaximizeButtonSize;
+ pnlclose.Location = FromRight(LoadedSkin.CloseButtonFromSide);
+ pnlminimize.Location = FromRight(LoadedSkin.MinimizeButtonFromSide);
+ pnlmaximize.Location = FromRight(LoadedSkin.MaximizeButtonFromSide);
+ pnlclose.Left -= pnlclose.Width;
+ pnlmaximize.Left -= pnlmaximize.Width;
+ pnlminimize.Left -= pnlminimize.Width;
+
+ switch (LoadedSkin.TitleTextCentered)
+ {
+ case false:
+ lbtitletext.Location = new Point(16 + LoadedSkin.TitlebarIconFromSide.X + LoadedSkin.TitleTextLeft.X,
+ LoadedSkin.TitleTextLeft.Y);
+ break;
+ default:
+ lbtitletext.Left = (pnltitle.Width - lbtitletext.Width) / 2;
+ lbtitletext.Top = LoadedSkin.TitleTextLeft.Y;
+ break;
+ }
+
+ if (Shiftorium.UpgradeInstalled("app_icons"))
+ {
+ pnlicon.Show();
+ pnlicon.Size = new Size(16, 16);
+ pnlicon.BackColor = Color.Transparent;
+ pnlicon.BackgroundImageLayout = ImageLayout.Stretch;
+ pnlicon.Location = LoadedSkin.TitlebarIconFromSide;
+ }
+ else
+ {
+ pnlicon.Hide();
+ }
+ }
+
+ /// <summary>
+ /// Froms the right.
+ /// </summary>
+ /// <returns>The right.</returns>
+ /// <param name="input">Input.</param>
+ public Point FromRight(Point input)
+ {
+ return new Point(pnltitle.Width - input.X, input.Y);
+ }
+
+
public int CodepointValue = 0;
public List<ShifterSetting> settings = new List<ShifterSetting>();
public Skin LoadedSkin = null;
@@ -128,6 +467,21 @@ namespace ShiftOS.WinForms.Applications
btn.FlatStyle = FlatStyle.Flat;
btn.Click += (o, a) =>
{
+ foreach(var mth in this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance))
+ {
+ foreach(var attrib in mth.GetCustomAttributes(false))
+ {
+ if(attrib is ShifterMetaAttribute)
+ {
+ var meta = attrib as ShifterMetaAttribute;
+ if(meta.Meta == btn.Text)
+ {
+ mth?.Invoke(this, null);
+ }
+ }
+ }
+ }
+
PopulateSubcategories(c);
};
@@ -169,357 +523,444 @@ namespace ShiftOS.WinForms.Applications
}
}
- public void PopulateBody(string cat, string subcat)
+ public void InvokeSetup(string cat)
{
- flbody.Controls.Clear();
-
- List<ShifterSetting> cats = new List<ShifterSetting>();
-
- foreach (var c in this.settings)
+ foreach(var mth in this.GetType().GetMethods(BindingFlags.Public | BindingFlags.Instance))
{
- if (c.SubCategory == subcat && c.Category == cat)
+ foreach(var attr in mth.GetCustomAttributes(false))
{
- if (c.Field.FlagFullfilled(LoadedSkin))
+ if(attr is ShifterMetaAttribute)
{
- if (!cats.Contains(c))
- {
- cats.Add(c);
- }
+ if ((attr as ShifterMetaAttribute).Meta == cat)
+ mth.Invoke(this, null);
}
}
}
+ }
- foreach(var c in cats)
+ public void PopulateBody(string cat, string subcat)
+ {
+ flbody.Controls.Clear();
+
+ IEnumerable<ShifterSetting> cats = this.settings.Where(x => x.SubCategory == subcat && x.Category == cat && x.Field.FlagFullfilled(LoadedSkin)).OrderBy(x=>x.Name);
+
+ new Thread(() =>
{
- var lbl = new Label();
- int labelHeight = 0;
- lbl.AutoSize = true;
- lbl.Text = c.Name + ":";
- flbody.Controls.Add(lbl);
- lbl.TextAlign = ContentAlignment.MiddleLeft;
- lbl.Show();
- //Cool - label's in.
- if(c.Field.FieldType == typeof(Point))
+ foreach (var c in cats)
{
- var width = new TextBox();
- var height = new TextBox();
- labelHeight = width.Height; //irony?
- width.Width = 30;
- height.Width = width.Width;
- width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
- height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
- flbody.SetFlowBreak(height, true);
- ControlManager.SetupControl(width);
- ControlManager.SetupControl(height);
-
- flbody.Controls.Add(width);
- width.Show();
- flbody.Controls.Add(height);
- height.Show();
-
- EventHandler tc = (o, a) =>
+ Label lbl = null;
+ int labelHeight = 0;
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbl = new Label();
+ lbl.AutoSize = true;
+ lbl.Text = c.Name + ":";
+ flbody.Controls.Add(lbl);
+ lbl.TextAlign = ContentAlignment.MiddleLeft;
+ lbl.Show();
+ });
+ //Cool - label's in.
+ if (c.Field.FieldType == typeof(Point))
{
- try
+ TextBox width = null;
+ TextBox height = null;
+ Desktop.InvokeOnWorkerThread(() =>
{
- int x = Convert.ToInt32(width.Text);
- int y = Convert.ToInt32(height.Text);
+ width = new TextBox();
+ height = new TextBox();
+ labelHeight = width.Height; //irony?
+ width.Width = 30;
+ height.Width = width.Width;
+ width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
+ height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
+ flbody.SetFlowBreak(height, true);
+ ControlManager.SetupControl(width);
+ ControlManager.SetupControl(height);
- int oldx = ((Point)c.Field.GetValue(this.LoadedSkin)).X;
- int oldy = ((Point)c.Field.GetValue(this.LoadedSkin)).Y;
+ flbody.Controls.Add(width);
+ width.Show();
+ flbody.Controls.Add(height);
+ height.Show();
- if(x != oldx || y != oldy)
+ EventHandler tc = (o, a) =>
{
- c.Field.SetValue(LoadedSkin, new Point(x, y));
- CodepointValue += 200;
- }
- }
- catch
- {
- width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
- height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
- }
- };
+ try
+ {
+ int x = Convert.ToInt32(width.Text);
+ int y = Convert.ToInt32(height.Text);
- width.TextChanged += tc;
- height.TextChanged += tc;
+ int oldx = ((Point)c.Field.GetValue(this.LoadedSkin)).X;
+ int oldy = ((Point)c.Field.GetValue(this.LoadedSkin)).Y;
- }
- else if(c.Field.FieldType == typeof(string))
- {
- var str = new TextBox();
- str.Width = 120;
- ControlManager.SetupControl(str);
- labelHeight = str.Height;
- str.Text = c.Field.GetValue(LoadedSkin).ToString();
- flbody.SetFlowBreak(str, true);
- str.TextChanged += (o, a) => { c.Field.SetValue(LoadedSkin, str.Text); CodepointValue += 100; };
- flbody.Controls.Add(str);
- str.Show();
- }
- else if(c.Field.FieldType == typeof(byte[]))
- {
- //We'll assume that this is an image file.
- var color = new Button();
- color.Width = 40;
- labelHeight = color.Height;
- //just so it's flat like the system.
- ControlManager.SetupControl(color);
- flbody.SetFlowBreak(color, true);
-
- color.BackgroundImage = SkinEngine.ImageFromBinary((byte[])c.Field.GetValue(this.LoadedSkin));
- color.Click += (o, a) =>
+ if (x != oldx || y != oldy)
+ {
+ c.Field.SetValue(LoadedSkin, new Point(x, y));
+ CodepointValue += 200;
+ }
+ }
+ catch
+ {
+ width.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).X.ToString();
+ height.Text = ((Point)c.Field.GetValue(this.LoadedSkin)).Y.ToString();
+ }
+ InvokeSetup(cat);
+ };
+
+ width.TextChanged += tc;
+ height.TextChanged += tc;
+ });
+ }
+ else if (c.Field.FieldType == typeof(string))
{
- AppearanceManager.SetupDialog(new GraphicPicker(color.BackgroundImage, c.Name, GetLayout(c.Field.GetImageName()), new Action<byte[], Image, ImageLayout>((col, gdiImg, layout) =>
+ Desktop.InvokeOnWorkerThread(() =>
{
- c.Field.SetValue(LoadedSkin, col);
- color.BackgroundImage = SkinEngine.ImageFromBinary(col);
- color.BackgroundImageLayout = layout;
- LoadedSkin.SkinImageLayouts[c.Field.GetImageName()] = layout;
- CodepointValue += 700;
- })));
- };
- flbody.Controls.Add(color);
- color.Show();
- }
- else if (c.Field.FieldType == typeof(Size))
- {
- var width = new TextBox();
- var height = new TextBox();
- width.Width = 30;
- height.Width = width.Width;
- labelHeight = width.Height;
- flbody.SetFlowBreak(height, true);
-
- width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString();
- height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString();
- ControlManager.SetupControl(width);
- ControlManager.SetupControl(height);
-
- flbody.Controls.Add(width);
- width.Show();
- flbody.Controls.Add(height);
- height.Show();
-
- EventHandler tc = (o, a) =>
+ var str = new TextBox();
+ str.Width = 120;
+ ControlManager.SetupControl(str);
+ labelHeight = str.Height;
+ str.Text = c.Field.GetValue(LoadedSkin).ToString();
+ flbody.SetFlowBreak(str, true);
+ str.TextChanged += (o, a) =>
+ {
+ c.Field.SetValue(LoadedSkin, str.Text); CodepointValue += 100;
+
+ InvokeSetup(cat);
+ };
+ flbody.Controls.Add(str);
+ str.Show();
+ });
+ }
+ else if (c.Field.FieldType == typeof(byte[]))
{
- try
+ Desktop.InvokeOnWorkerThread(() =>
{
- int x = Convert.ToInt32(width.Text);
- int y = Convert.ToInt32(height.Text);
-
- int oldx = ((Size)c.Field.GetValue(this.LoadedSkin)).Width;
- int oldy = ((Size)c.Field.GetValue(this.LoadedSkin)).Height;
-
- if (x != oldx || y != oldy)
+ //We'll assume that this is an image file.
+ var color = new Button();
+ color.Width = 40;
+ labelHeight = color.Height;
+ //just so it's flat like the system.
+ ControlManager.SetupControl(color);
+ flbody.SetFlowBreak(color, true);
+
+ color.BackgroundImage = SkinEngine.ImageFromBinary((byte[])c.Field.GetValue(this.LoadedSkin));
+ color.Click += (o, a) =>
{
- c.Field.SetValue(LoadedSkin, new Size(x, y));
- CodepointValue += 200;
- }
- }
- catch
+ AppearanceManager.SetupDialog(new GraphicPicker(color.BackgroundImage, c.Name, GetLayout(c.Field.GetImageName()), new Action<byte[], Image, ImageLayout>((col, gdiImg, layout) =>
+ {
+ c.Field.SetValue(LoadedSkin, col);
+ color.BackgroundImage = SkinEngine.ImageFromBinary(col);
+ color.BackgroundImageLayout = layout;
+ LoadedSkin.SkinImageLayouts[c.Field.GetImageName()] = layout;
+ CodepointValue += 700;
+ InvokeSetup(cat);
+
+ })));
+ };
+ flbody.Controls.Add(color);
+ color.Show();
+ });
+ }
+ else if (c.Field.FieldType == typeof(Size))
+ {
+ Desktop.InvokeOnWorkerThread(() =>
{
+ var width = new TextBox();
+ var height = new TextBox();
+ width.Width = 30;
+ height.Width = width.Width;
+ labelHeight = width.Height;
+ flbody.SetFlowBreak(height, true);
+
width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString();
height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString();
- }
- };
+ ControlManager.SetupControl(width);
+ ControlManager.SetupControl(height);
- width.TextChanged += tc;
- height.TextChanged += tc;
+ flbody.Controls.Add(width);
+ width.Show();
+ flbody.Controls.Add(height);
+ height.Show();
- }
- else if(c.Field.FieldType == typeof(bool))
- {
- var check = new CheckBox();
- check.Checked = ((bool)c.Field.GetValue(LoadedSkin));
- labelHeight = check.Height;
- check.CheckedChanged += (o, a) =>
- {
- c.Field.SetValue(LoadedSkin, check.Checked);
- CodepointValue += 50;
- };
- flbody.SetFlowBreak(check, true);
+ EventHandler tc = (o, a) =>
+ {
+ try
+ {
+ int x = Convert.ToInt32(width.Text);
+ int y = Convert.ToInt32(height.Text);
- flbody.Controls.Add(check);
- check.Show();
- }
- else if(c.Field.FieldType == typeof(Font))
- {
- var name = new ComboBox();
- var size = new TextBox();
- var style = new ComboBox();
-
- name.Width = 120;
- labelHeight = name.Height;
- size.Width = 40;
- style.Width = 80;
- flbody.SetFlowBreak(style, true);
-
- ControlManager.SetupControl(name);
- ControlManager.SetupControl(size);
- ControlManager.SetupControl(style);
-
- //populate the font name box
- foreach(var font in FontFamily.Families)
- {
- name.Items.Add(font.Name);
- }
- name.Text = ((Font)c.Field.GetValue(LoadedSkin)).Name;
+ int oldx = ((Size)c.Field.GetValue(this.LoadedSkin)).Width;
+ int oldy = ((Size)c.Field.GetValue(this.LoadedSkin)).Height;
+
+ if (x != oldx || y != oldy)
+ {
+ c.Field.SetValue(LoadedSkin, new Size(x, y));
+ CodepointValue += 200;
+ }
+ }
+ catch
+ {
+ width.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Width.ToString();
+ height.Text = ((Size)c.Field.GetValue(this.LoadedSkin)).Height.ToString();
+ }
+ InvokeSetup(cat);
- size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
+ };
- //populate the style box
- foreach(var s in (FontStyle[])Enum.GetValues(typeof(FontStyle)))
- {
- style.Items.Add(s.ToString());
+ width.TextChanged += tc;
+ height.TextChanged += tc;
+ });
}
- style.Text = ((Font)c.Field.GetValue(LoadedSkin)).Style.ToString();
+ else if (c.Field.FieldType == typeof(bool))
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ var check = new CheckBox();
+ check.Checked = ((bool)c.Field.GetValue(LoadedSkin));
+ labelHeight = check.Height;
+ check.CheckedChanged += (o, a) =>
+ {
+ c.Field.SetValue(LoadedSkin, check.Checked);
+ CodepointValue += 50;
+ InvokeSetup(cat);
+
+ };
+ flbody.SetFlowBreak(check, true);
- name.SelectedIndexChanged += (o, a) =>
+ flbody.Controls.Add(check);
+ check.Show();
+ });
+ }
+ else if (c.Field.FieldType == typeof(Font))
{
- var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ var name = new ComboBox();
+ var size = new TextBox();
+ var style = new ComboBox();
+
+ name.Width = 120;
+ labelHeight = name.Height;
+ size.Width = 40;
+ style.Width = 80;
+ flbody.SetFlowBreak(style, true);
+
+ ControlManager.SetupControl(name);
+ ControlManager.SetupControl(size);
+ ControlManager.SetupControl(style);
+
+ //populate the font name box
+ foreach (var font in FontFamily.Families)
+ {
+ name.Items.Add(font.Name);
+ }
+ name.Text = ((Font)c.Field.GetValue(LoadedSkin)).Name;
- var f = en[style.SelectedIndex];
+ size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
- c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
- CodepointValue += 100;
- };
+ //populate the style box
+ foreach (var s in (FontStyle[])Enum.GetValues(typeof(FontStyle)))
+ {
+ style.Items.Add(s.ToString());
+ }
+ style.Text = ((Font)c.Field.GetValue(LoadedSkin)).Style.ToString();
- style.SelectedIndexChanged += (o, a) =>
- {
- var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
+ name.SelectedIndexChanged += (o, a) =>
+ {
+ var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
- var f = en[style.SelectedIndex];
+ var f = en[style.SelectedIndex];
- c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
- CodepointValue += 50;
- };
+ c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
+ CodepointValue += 100;
+ InvokeSetup(cat);
- size.TextChanged += (o, a) =>
- {
- try
- {
- var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
+ };
- var f = en[style.SelectedIndex];
+ style.SelectedIndexChanged += (o, a) =>
+ {
+ var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
- c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
- }
- catch
- {
- size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
- }
- CodepointValue += 50;
- };
+ var f = en[style.SelectedIndex];
- flbody.Controls.Add(name);
- flbody.Controls.Add(size);
- flbody.Controls.Add(style);
+ c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
+ CodepointValue += 50;
+ InvokeSetup(cat);
- name.Show();
- size.Show();
- style.Show();
+ };
- }
- else if(c.Field.FieldType == typeof(Color))
- {
- var color = new Button();
- color.Width = 40;
- labelHeight = color.Height;
- //just so it's flat like the system.
- ControlManager.SetupControl(color);
-
- color.BackColor = ((Color)c.Field.GetValue(LoadedSkin));
- color.BackColorChanged += (o, a) =>
- {
- c.Field.SetValue(LoadedSkin, color.BackColor);
- };
- color.Click += (o, a) =>
+ size.TextChanged += (o, a) =>
+ {
+ try
+ {
+ var en = (FontStyle[])Enum.GetValues(typeof(FontStyle));
+
+ var f = en[style.SelectedIndex];
+
+ c.Field.SetValue(LoadedSkin, new Font(name.Text, (float)Convert.ToDouble(size.Text), f));
+ }
+ catch
+ {
+ size.Text = ((Font)c.Field.GetValue(LoadedSkin)).Size.ToString();
+ }
+ CodepointValue += 50;
+ InvokeSetup(cat);
+
+ };
+
+ flbody.Controls.Add(name);
+ flbody.Controls.Add(size);
+ flbody.Controls.Add(style);
+
+ name.Show();
+ size.Show();
+ style.Show();
+ });
+ }
+ else if (c.Field.FieldType == typeof(Color))
{
- AppearanceManager.SetupDialog(new ColorPicker(color.BackColor, c.Name, new Action<Color>((col) =>
+ Desktop.InvokeOnWorkerThread(() =>
{
- color.BackColor = col;
- CodepointValue += 300;
- })));
- };
- flbody.SetFlowBreak(color, true);
-
- flbody.Controls.Add(color);
- color.Show();
- }
- else if(c.Field.FieldType == typeof(int))
- {
- if (c.Field.HasShifterEnumMask())
+ var color = new Button();
+ color.Width = 40;
+ labelHeight = color.Height;
+ //just so it's flat like the system.
+ ControlManager.SetupControl(color);
+
+ color.BackColor = ((Color)c.Field.GetValue(LoadedSkin));
+ color.Click += (o, a) =>
+ {
+ AppearanceManager.SetupDialog(new ColorPicker((Color)c.Field.GetValue(LoadedSkin), c.Name, new Action<Color>((col) =>
+ {
+ color.BackColor = col;
+ c.Field.SetValue(LoadedSkin, col);
+ CodepointValue += 300;
+ InvokeSetup(cat);
+
+ })));
+ };
+ flbody.SetFlowBreak(color, true);
+ color.Tag = "keepbg";
+ flbody.Controls.Add(color);
+ color.Show();
+ });
+ }
+ else if (c.Field.FieldType.IsEnum == true)
{
- var name = new ComboBox();
- name.Width = 120;
- ControlManager.SetupControl(name);
- string[] items = c.Field.GetShifterEnumMask();
- foreach(var item in items)
+ Desktop.InvokeOnWorkerThread(() =>
{
- name.Items.Add(item);
- }
- name.SelectedIndex = (int)c.Field.GetValue(LoadedSkin);
- name.SelectedIndexChanged += (o, a) =>
- {
- c.Field.SetValue(LoadedSkin, name.SelectedIndex);
- CodepointValue += 75;
- };
- labelHeight = name.Height;
- flbody.Controls.Add(name);
- name.Show();
- flbody.SetFlowBreak(name, true);
+ var cBox = new ComboBox();
+ cBox.Width = 150;
+ ControlManager.SetupControl(cBox);
+
+ foreach (var itm in Enum.GetNames(c.Field.FieldType))
+ {
+ cBox.Items.Add(itm);
+ }
+
+ cBox.Text = c.Field.GetValue(LoadedSkin).ToString();
+
+ cBox.SelectedIndexChanged += (o, a) =>
+ {
+ c.Field.SetValue(LoadedSkin, Enum.Parse(c.Field.FieldType, cBox.Text));
+ InvokeSetup(cat);
+ };
+
+ labelHeight = cBox.Height;
+
+ flbody.Controls.Add(cBox);
+ cBox.Show();
+ flbody.SetFlowBreak(cBox, true);
+ });
}
- else
+ else if (c.Field.FieldType == typeof(int))
{
- var width = new TextBox();
- width.Width = 30;
- width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString();
- ControlManager.SetupControl(width);
- labelHeight = width.Height;
- flbody.Controls.Add(width);
- width.Show();
-
- EventHandler tc = (o, a) =>
+ Desktop.InvokeOnWorkerThread(() =>
{
- try
+ if (c.Field.HasShifterEnumMask())
{
- int x = Convert.ToInt32(width.Text);
-
- int oldx = ((int)c.Field.GetValue(this.LoadedSkin));
-
- if (x != oldx)
+ var name = new ComboBox();
+ name.Width = 120;
+ ControlManager.SetupControl(name);
+ string[] items = c.Field.GetShifterEnumMask();
+ foreach (var item in items)
{
- c.Field.SetValue(LoadedSkin, x);
- CodepointValue += 75;
+ name.Items.Add(item);
}
+ name.SelectedIndex = (int)c.Field.GetValue(LoadedSkin);
+ name.SelectedIndexChanged += (o, a) =>
+ {
+ c.Field.SetValue(LoadedSkin, name.SelectedIndex);
+ CodepointValue += 75;
+ InvokeSetup(cat);
+
+ };
+ labelHeight = name.Height;
+ flbody.Controls.Add(name);
+ name.Show();
+ flbody.SetFlowBreak(name, true);
+
}
- catch
+ else
{
+ var width = new TextBox();
+ width.Width = 30;
width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString();
- }
- };
+ ControlManager.SetupControl(width);
+ labelHeight = width.Height;
+ flbody.Controls.Add(width);
+ width.Show();
+
+ EventHandler tc = (o, a) =>
+ {
+ try
+ {
+ int x = Convert.ToInt32(width.Text);
+
+ int oldx = ((int)c.Field.GetValue(this.LoadedSkin));
+
+ if (x != oldx)
+ {
+ c.Field.SetValue(LoadedSkin, x);
+ CodepointValue += 75;
+ }
+ }
+ catch
+ {
+ width.Text = ((int)c.Field.GetValue(this.LoadedSkin)).ToString();
+ }
+ InvokeSetup(cat);
+
+ };
- width.TextChanged += tc;
- flbody.SetFlowBreak(width, true);
+ width.TextChanged += tc;
+ flbody.SetFlowBreak(width, true);
+ }
+ });
}
- }
- lbl.AutoSize = false;
- lbl.Width = (int)this.CreateGraphics().MeasureString(lbl.Text, SkinEngine.LoadedSkin.MainFont).Width + 15;
- lbl.Height = labelHeight;
- lbl.TextAlign = ContentAlignment.MiddleLeft;
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbl.AutoSize = false;
+ lbl.Width = (int)this.CreateGraphics().MeasureString(lbl.Text, SkinEngine.LoadedSkin.MainFont).Width + 15;
+ lbl.Height = labelHeight;
+ lbl.TextAlign = ContentAlignment.MiddleLeft;
+ });
- if (!string.IsNullOrWhiteSpace(c.Description))
- {
- var desc = new Label();
- flbody.SetFlowBreak(desc, true);
- desc.Text = c.Description;
- desc.AutoSize = true;
- flbody.Controls.Add(desc);
- desc.Show();
+ if (!string.IsNullOrWhiteSpace(c.Description))
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ var desc = new Label();
+ flbody.SetFlowBreak(desc, true);
+ desc.Text = c.Description;
+ desc.AutoSize = true;
+ flbody.Controls.Add(desc);
+ desc.Show();
+ });
+ }
}
- }
+ }).Start();
}
public ImageLayout GetLayout(string name)
@@ -555,6 +996,7 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
+ pnlintro.BringToFront();
}
public void OnSkinLoad()
diff --git a/ShiftOS.WinForms/Applications/Shifter.resx b/ShiftOS.WinForms/Applications/Shifter.resx
index 1af7de1..c18f92a 100644
--- a/ShiftOS.WinForms/Applications/Shifter.resx
+++ b/ShiftOS.WinForms/Applications/Shifter.resx
@@ -117,4 +117,74 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>230, 17</value>
+ </metadata>
+ <metadata name="tspreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>127, 17</value>
+ </metadata>
+ <metadata name="mspreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="mspreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <metadata name="tspreview.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>127, 17</value>
+ </metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="toolStripButton1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="toolStripButton2.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="toolStripButton3.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="label2.Text" xml:space="preserve">
+ <value>The Shifter is a brilliant application for ShiftOS that allows you to customize almost every aspect of the user interface.
+
+To use the Shifter, simply select a category from the left, then a list of sub-categories will show up. Choose a sub-category, then a list of settings will appear. You can modify any one of these settings. A live preview of what you are editing will show, and you can use it to see what your new user experience will look like.
+
+When you are done, hit Apply Changes to apply your changes!
+
+You can also earn Codepoints through the Shifter. The more you tweak and customize, the more Codepoints you'll earn! Go nuts! Shift it your way!</value>
+ </data>
</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
index eca44ae..a7fe700 100644
--- a/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
+++ b/ShiftOS.WinForms/Applications/Shiftnet.Designer.cs
@@ -57,13 +57,12 @@ namespace ShiftOS.WinForms.Applications
this.btnforward = new System.Windows.Forms.Button();
this.txturl = new System.Windows.Forms.TextBox();
this.btngo = new System.Windows.Forms.Button();
- this.wbcanvas = new System.Windows.Forms.WebBrowser();
+ this.pnlcanvas = new System.Windows.Forms.Panel();
this.flcontrols.SuspendLayout();
this.SuspendLayout();
//
// flcontrols
//
- this.flcontrols.AutoSize = true;
this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.flcontrols.Controls.Add(this.btnback);
this.flcontrols.Controls.Add(this.btnforward);
@@ -123,42 +122,35 @@ namespace ShiftOS.WinForms.Applications
this.btngo.UseVisualStyleBackColor = true;
this.btngo.Click += new System.EventHandler(this.btngo_Click);
//
- // wbcanvas
+ // pnlcanvas
//
- this.wbcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
- this.wbcanvas.IsWebBrowserContextMenuEnabled = false;
- this.wbcanvas.Location = new System.Drawing.Point(0, 29);
- this.wbcanvas.MinimumSize = new System.Drawing.Size(20, 20);
- this.wbcanvas.Name = "wbcanvas";
- this.wbcanvas.ScriptErrorsSuppressed = true;
- this.wbcanvas.Size = new System.Drawing.Size(805, 510);
- this.wbcanvas.TabIndex = 1;
- this.wbcanvas.WebBrowserShortcutsEnabled = false;
- this.wbcanvas.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbcanvas_Navigated);
- this.wbcanvas.Navigating += new System.Windows.Forms.WebBrowserNavigatingEventHandler(this.wbcanvas_Navigating);
+ this.pnlcanvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlcanvas.Location = new System.Drawing.Point(0, 29);
+ this.pnlcanvas.Name = "pnlcanvas";
+ this.pnlcanvas.Size = new System.Drawing.Size(805, 510);
+ this.pnlcanvas.TabIndex = 1;
//
// Shiftnet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.Controls.Add(this.wbcanvas);
+ this.Controls.Add(this.pnlcanvas);
this.Controls.Add(this.flcontrols);
this.Name = "Shiftnet";
this.Size = new System.Drawing.Size(805, 539);
this.flcontrols.ResumeLayout(false);
this.flcontrols.PerformLayout();
this.ResumeLayout(false);
- this.PerformLayout();
}
#endregion
-
- private System.Windows.Forms.FlowLayoutPanel flcontrols;
private System.Windows.Forms.Button btnback;
private System.Windows.Forms.Button btnforward;
private System.Windows.Forms.TextBox txturl;
private System.Windows.Forms.Button btngo;
- private System.Windows.Forms.WebBrowser wbcanvas;
+ private System.Windows.Forms.Panel pnlcanvas;
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
}
}
diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs
index 3da7d6a..7f5d3c1 100644
--- a/ShiftOS.WinForms/Applications/Shiftnet.cs
+++ b/ShiftOS.WinForms/Applications/Shiftnet.cs
@@ -34,164 +34,52 @@ using System.Windows.Forms;
using ShiftOS.Engine;
using Newtonsoft.Json;
using static ShiftOS.Engine.SkinEngine;
+using ShiftOS.WinForms.Tools;
+using System.IO;
+using System.Reflection;
namespace ShiftOS.WinForms.Applications
{
- [Launcher("Shiftnet", false, null, "Networking")]
+ //OH MY GOD. I HAD TO CORRECT HEAPS OF BADLY PLACED CURLY BRACES.
+ //
+ //I DO NOT CARE WHAT THE BLUE SMILEY FACE SAYS. CURLY BRACES BELONG ON THEIR OWN LINE.
+ //
+ //READ THE DAMN SHIFTOS CODING GUIDELINES.
+
+ [Launcher("Shiftnet", true, "al_shiftnet", "Networking")]
+ [MultiplayerOnly]
+ [DefaultTitle("Shiftnet")]
+ [WinOpen("shiftnet")]
+ [RequiresUpgrade("victortran_shiftnet")]
[DefaultIcon("iconShiftnet")]
- public partial class Shiftnet : UserControl, IShiftOSWindow
+ public partial class Shiftnet : UserControl, IShiftOSWindow, IShiftnetClient
{
public Shiftnet()
{
InitializeComponent();
- ServerManager.MessageReceived += (msg) =>
- {
- try
- {
- if (msg.Name == "shiftnet_file")
- {
- this.Invoke(new Action(() =>
- {
- wbcanvas.DocumentText = ConstructHtml(msg.Contents);
- }));
- }
- }
- catch
- {
-
- }
- };
- }
-
- public string ConstructHtml(string markdown)
- {
- string html = $@"<html>
- <head>
- <style>
- body {{
- background-color: rgb({LoadedSkin.ControlColor.R}, {LoadedSkin.ControlColor.G}, {LoadedSkin.ControlColor.B});
- color: rgb({LoadedSkin.ControlTextColor.R}, {LoadedSkin.ControlTextColor.G}, {LoadedSkin.ControlTextColor.B});
- font-family: ""{LoadedSkin.MainFont.Name}"";
- font-size: {LoadedSkin.MainFont.SizeInPoints}pt;
- }}
-
- h1 {{
- font-family: ""{LoadedSkin.HeaderFont.Name}"";
- font-size: {LoadedSkin.HeaderFont.SizeInPoints}pt;
- }}
-
- h2 {{
- font-family: ""{LoadedSkin.Header2Font.Name}"";
- font-size: {LoadedSkin.Header2Font.SizeInPoints}pt;
- }}
-
- h3 {{
- font-family: ""{LoadedSkin.Header3Font.Name}"";
- font-size: {LoadedSkin.Header3Font.SizeInPoints}pt;
- }}
-
- pre, code {{
- font-family: ""{LoadedSkin.TerminalFont.Name}"";
- font-size: {LoadedSkin.TerminalFont.SizeInPoints}pt;
- color: rgb({LoadedSkin.TerminalForeColor.R}, {LoadedSkin.TerminalForeColor.G}, {LoadedSkin.TerminalForeColor.B});
- background-color: rgb({LoadedSkin.TerminalBackColor.R}, {LoadedSkin.TerminalBackColor.G}, {LoadedSkin.TerminalBackColor.B});
- }}
- </style>
- </head>
- <body>
- <markdown/>
- </body>
-</html>";
-
- string body = CommonMark.CommonMarkConverter.Convert(markdown);
- for(int i = 0; i <= Encoding.UTF8.GetBytes(body).Length; i += DownloadManager.GetDownloadSpeed())
- {
- //halt the page load until 'download' finishes.
- }
- html = html.Replace("<markdown/>", body);
- return html;
}
public string CurrentUrl { get; set; }
- private void wbcanvas_Navigating(object sender, WebBrowserNavigatingEventArgs e)
- {
- string Url = e.Url.ToString().Replace("http://", "");
- if (CurrentUrl != Url.ToString() && !Url.ToString().StartsWith("about:"))
- {
- e.Cancel = true;
- Future.Clear();
- ShiftnetNavigate(Url.ToString());
- }
- }
-
public Stack<string> History = new Stack<string>();
public Stack<string> Future = new Stack<string>();
- public void ShiftnetNavigate(string Url, bool pushHistory = true)
- {
- if (Url.EndsWith(".rnp") || !Url.Contains("."))
- {
- if (!string.IsNullOrEmpty(CurrentUrl) && pushHistory)
- History.Push(CurrentUrl);
- CurrentUrl = Url;
- ServerManager.SendMessage("shiftnet_get", JsonConvert.SerializeObject(new
- {
- url = Url
- }));
- txturl.Text = Url;
-
- }
- else
- {
- ServerMessageReceived smr = null;
- smr = (msg) =>
- {
- if(msg.Name == "download_meta")
- {
- var bytes = JsonConvert.DeserializeObject<byte[]>(msg.Contents);
- string destPath = null;
- string ext = Url.Split('.')[Url.Split('.').Length - 1];
- this.Invoke(new Action(() =>
- {
- FileSkimmerBackend.GetFile(new[] { ext }, FileOpenerStyle.Save, new Action<string>((file) =>
- {
- destPath = file;
- }));
- }));
- while (string.IsNullOrEmpty(destPath))
- {
-
- }
- var d = new Download
- {
- ShiftnetUrl = Url,
- Destination = destPath,
- Bytes = bytes,
- Progress = 0,
- };
- DownloadManager.StartDownload(d);
- this.Invoke(new Action(() =>
- {
- AppearanceManager.SetupWindow(new Downloader());
- }));
- ServerManager.MessageReceived -= smr;
- }
- };
- ServerManager.MessageReceived += smr;
- ServerManager.SendMessage("download_start", Url);
- }
- }
+ public IShiftnetSite CurrentPage = null;
public void OnLoad()
{
- ShiftnetNavigate("shiftnet/main");
+ NavigateToUrl("shiftnet/main");
}
public void OnSkinLoad()
{
- ShiftnetNavigate(CurrentUrl);
+ CurrentPage?.OnSkinLoad();
+ btnback.Location = new Point(2, 2);
+ btnforward.Location = new Point(btnback.Left + btnback.Width + 2, 2);
+ txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2);
+ txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width*2) - 2;
+ btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2);
}
public bool OnUnload()
@@ -201,6 +89,7 @@ namespace ShiftOS.WinForms.Applications
public void OnUpgrade()
{
+ CurrentPage?.OnUpgrade();
}
private void btnback_Click(object sender, EventArgs e)
@@ -211,7 +100,7 @@ namespace ShiftOS.WinForms.Applications
if (!string.IsNullOrEmpty(hist))
{
Future.Push(hist);
- ShiftnetNavigate(hist, false);
+ NavigateToUrl(hist);
}
}
catch
@@ -227,7 +116,8 @@ namespace ShiftOS.WinForms.Applications
string fut = Future.Pop();
if (!string.IsNullOrEmpty(fut))
{
- ShiftnetNavigate(fut);
+ History.Push(CurrentUrl);
+ NavigateToUrl(fut);
}
}
catch
@@ -241,22 +131,109 @@ namespace ShiftOS.WinForms.Applications
if (!string.IsNullOrWhiteSpace(txturl.Text))
{
Future.Clear();
-
- ShiftnetNavigate(txturl.Text);
+ History.Push(CurrentUrl);
+ NavigateToUrl(txturl.Text);
}
}
private void txturl_KeyDown(object sender, KeyEventArgs e)
{
- if(e.KeyCode == Keys.Enter)
+ if (e.KeyCode == Keys.Enter)
{
btngo_Click(sender, EventArgs.Empty);
e.SuppressKeyPress = true;
}
}
- private void wbcanvas_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ public void NavigateToUrl(string url)
+ {
+ txturl.Text = url;
+ 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(IShiftnetSite)))
+ {
+ if (type.BaseType == typeof(UserControl))
+ {
+ var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute;
+ if (attribute != null)
+ {
+ if (attribute.Url == url)
+ {
+ if (Shiftorium.UpgradeAttributesUnlocked(type))
+ {
+ var obj = (IShiftnetSite)Activator.CreateInstance(type, null);
+ obj.GoToUrl += (u) =>
+ {
+ History.Push(u);
+ NavigateToUrl(u);
+ };
+ obj.GoBack += () =>
+ {
+ string u = History.Pop();
+ Future.Push(u);
+ NavigateToUrl(u);
+ };
+ CurrentPage = obj;
+ this.pnlcanvas.Controls.Clear();
+ this.pnlcanvas.Controls.Add((UserControl)obj);
+ ((UserControl)obj).Show();
+ ((UserControl)obj).Dock = DockStyle.Fill;
+ obj.OnUpgrade();
+ obj.OnSkinLoad();
+ obj.Setup();
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ pnlcanvas.Controls.Clear();
+ var tlbl = new Label();
+ tlbl.Text = "Server error in \"" + url + "\" application.";
+ tlbl.Tag = "header1";
+ tlbl.AutoSize = true;
+ tlbl.Location = new Point(10, 10);
+ tlbl.Dock = DockStyle.Top;
+ pnlcanvas.Controls.Add(tlbl);
+ tlbl.Show();
+
+ var crash = new Label();
+ crash.Dock = DockStyle.Fill;
+ crash.AutoSize = false;
+ crash.Text = ex.ToString();
+ pnlcanvas.Controls.Add(crash);
+ crash.Show();
+ crash.BringToFront();
+ ControlManager.SetupControls(pnlcanvas);
+ return;
+ }
+ }
+ }
+ pnlcanvas.Controls.Clear();
+ var lbl = new Label();
+ lbl.Text = "Page not found!";
+ lbl.Tag = "header1";
+ lbl.AutoSize = true;
+ lbl.Location = new Point(10, 10);
+ pnlcanvas.Controls.Add(lbl);
+ lbl.Show();
+
+ }
+
+ public void RefreshSite()
{
+ NavigateToUrl(CurrentUrl);
}
}
}
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
index e0e76fa..dc107c4 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs
@@ -56,20 +56,26 @@ namespace ShiftOS.WinForms.Applications
{
this.panel1 = new System.Windows.Forms.Panel();
this.panel2 = new System.Windows.Forms.Panel();
- this.label2 = new System.Windows.Forms.Label();
- this.label3 = new System.Windows.Forms.Label();
this.lbupgradedesc = new System.Windows.Forms.Label();
this.pnlupgradeactions = new System.Windows.Forms.Panel();
this.btnbuy = new System.Windows.Forms.Button();
this.lbupgradetitle = new System.Windows.Forms.Label();
this.pnllist = new System.Windows.Forms.Panel();
+ this.lbnoupgrades = new System.Windows.Forms.Label();
+ this.panel3 = new System.Windows.Forms.Panel();
+ this.lblcategorytext = new System.Windows.Forms.Label();
+ this.btncat_forward = new System.Windows.Forms.Button();
+ this.btncat_back = new System.Windows.Forms.Button();
+ this.lbcodepoints = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.pgupgradeprogress = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
this.lbupgrades = new System.Windows.Forms.ListBox();
+ this.label3 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.pnlupgradeactions.SuspendLayout();
this.pnllist.SuspendLayout();
+ this.panel3.SuspendLayout();
this.SuspendLayout();
//
// panel1
@@ -93,30 +99,6 @@ namespace ShiftOS.WinForms.Applications
this.panel2.Size = new System.Drawing.Size(376, 427);
this.panel2.TabIndex = 1;
//
- // label2
- //
- if (ShiftoriumFrontend.UpgradeInstalled("shiftorium_gui_codepoints_display"))
- {
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(128, 357);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(135, 13);
- this.label2.TabIndex = 3;
- this.label2.Text = "You have: %cp Codepoints";
- this.label2.Click += new System.EventHandler(this.label2_Click);
- } else
- {
- this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label2.AutoSize = true;
- this.label2.Location = new System.Drawing.Point(128, 357);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(1, 1);
- this.label2.TabIndex = 3;
- this.label2.Text = "";
- this.label2.Click += new System.EventHandler(this.label2_Click);
- }
- //
// lbupgradedesc
//
this.lbupgradedesc.Dock = System.Windows.Forms.DockStyle.Fill;
@@ -165,7 +147,9 @@ namespace ShiftOS.WinForms.Applications
//
// pnllist
//
- this.pnllist.Controls.Add(this.label2);
+ this.pnllist.Controls.Add(this.lbnoupgrades);
+ this.pnllist.Controls.Add(this.panel3);
+ this.pnllist.Controls.Add(this.lbcodepoints);
this.pnllist.Controls.Add(this.label1);
this.pnllist.Controls.Add(this.pgupgradeprogress);
this.pnllist.Controls.Add(this.lbupgrades);
@@ -175,6 +159,75 @@ namespace ShiftOS.WinForms.Applications
this.pnllist.Size = new System.Drawing.Size(406, 427);
this.pnllist.TabIndex = 0;
//
+ // lbnoupgrades
+ //
+ this.lbnoupgrades.AutoSize = true;
+ this.lbnoupgrades.Location = new System.Drawing.Point(69, 183);
+ this.lbnoupgrades.Name = "lbnoupgrades";
+ this.lbnoupgrades.Size = new System.Drawing.Size(71, 13);
+ this.lbnoupgrades.TabIndex = 6;
+ this.lbnoupgrades.Tag = "header2";
+ this.lbnoupgrades.Text = "No upgrades!";
+ this.lbnoupgrades.Visible = false;
+ //
+ // panel3
+ //
+ this.panel3.Controls.Add(this.lblcategorytext);
+ this.panel3.Controls.Add(this.btncat_forward);
+ this.panel3.Controls.Add(this.btncat_back);
+ this.panel3.Location = new System.Drawing.Point(6, 76);
+ this.panel3.Name = "panel3";
+ this.panel3.Size = new System.Drawing.Size(394, 23);
+ this.panel3.TabIndex = 5;
+ //
+ // lblcategorytext
+ //
+ this.lblcategorytext.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lblcategorytext.Location = new System.Drawing.Point(29, 0);
+ this.lblcategorytext.Name = "lblcategorytext";
+ this.lblcategorytext.Size = new System.Drawing.Size(336, 23);
+ this.lblcategorytext.TabIndex = 2;
+ this.lblcategorytext.Text = "No Upgrades";
+ this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_Click);
+ //
+ // btncat_forward
+ //
+ this.btncat_forward.AutoSize = true;
+ this.btncat_forward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btncat_forward.Dock = System.Windows.Forms.DockStyle.Right;
+ this.btncat_forward.Location = new System.Drawing.Point(365, 0);
+ this.btncat_forward.Name = "btncat_forward";
+ this.btncat_forward.Size = new System.Drawing.Size(29, 23);
+ this.btncat_forward.TabIndex = 1;
+ this.btncat_forward.Text = "-->";
+ this.btncat_forward.UseVisualStyleBackColor = true;
+ this.btncat_forward.Click += new System.EventHandler(this.btncat_forward_Click);
+ //
+ // btncat_back
+ //
+ this.btncat_back.AutoSize = true;
+ this.btncat_back.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btncat_back.Dock = System.Windows.Forms.DockStyle.Left;
+ this.btncat_back.Location = new System.Drawing.Point(0, 0);
+ this.btncat_back.Name = "btncat_back";
+ this.btncat_back.Size = new System.Drawing.Size(29, 23);
+ this.btncat_back.TabIndex = 0;
+ this.btncat_back.Text = "<--";
+ this.btncat_back.UseVisualStyleBackColor = true;
+ this.btncat_back.Click += new System.EventHandler(this.btncat_back_Click);
+ //
+ // lbcodepoints
+ //
+ this.lbcodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.lbcodepoints.AutoSize = true;
+ this.lbcodepoints.Location = new System.Drawing.Point(128, 357);
+ this.lbcodepoints.Name = "lbcodepoints";
+ this.lbcodepoints.Size = new System.Drawing.Size(135, 13);
+ this.lbcodepoints.TabIndex = 3;
+ this.lbcodepoints.Text = "You have: %cp Codepoints";
+ this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click);
+ //
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
@@ -185,27 +238,14 @@ namespace ShiftOS.WinForms.Applications
this.label1.TabIndex = 2;
this.label1.Text = "{UPGRADE_PROGRESS}:";
//
- // label3
- //
- this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
- this.label3.AutoSize = true;
- this.label3.Location = new System.Drawing.Point(3, 399);
- this.label3.Name = "label3";
- this.label3.Size = new System.Drawing.Size(137, 13);
- this.label3.TabIndex = 2;
- int upgradepercent = (pgupgradeprogress.Value / 100) * 100;
- this.label3.Text = upgradepercent.ToString();
- //
// pgupgradeprogress
//
this.pgupgradeprogress.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.pgupgradeprogress.BlockSize = 5;
this.pgupgradeprogress.Location = new System.Drawing.Point(146, 390);
this.pgupgradeprogress.Maximum = 100;
this.pgupgradeprogress.Name = "pgupgradeprogress";
this.pgupgradeprogress.Size = new System.Drawing.Size(254, 23);
- this.pgupgradeprogress.Style = System.Windows.Forms.ProgressBarStyle.Continuous;
this.pgupgradeprogress.TabIndex = 1;
this.pgupgradeprogress.Value = 25;
//
@@ -216,12 +256,21 @@ namespace ShiftOS.WinForms.Applications
| System.Windows.Forms.AnchorStyles.Right)));
this.lbupgrades.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed;
this.lbupgrades.FormattingEnabled = true;
- this.lbupgrades.Location = new System.Drawing.Point(3, 66);
+ this.lbupgrades.Location = new System.Drawing.Point(3, 105);
this.lbupgrades.Name = "lbupgrades";
- this.lbupgrades.Size = new System.Drawing.Size(397, 277);
+ this.lbupgrades.Size = new System.Drawing.Size(397, 238);
this.lbupgrades.TabIndex = 0;
this.lbupgrades.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lbupgrades_DrawItem);
//
+ // label3
+ //
+ this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(3, 399);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(137, 13);
+ this.label3.TabIndex = 2;
+ //
// ShiftoriumFrontend
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -230,7 +279,6 @@ namespace ShiftOS.WinForms.Applications
this.Controls.Add(this.panel1);
this.ForeColor = System.Drawing.Color.LightGreen;
this.Name = "ShiftoriumFrontend";
- this.Text = "{SHIFTORIUM_NAME}";
this.Size = new System.Drawing.Size(782, 427);
this.Load += new System.EventHandler(this.Shiftorium_Load);
this.panel1.ResumeLayout(false);
@@ -239,6 +287,8 @@ namespace ShiftOS.WinForms.Applications
this.pnlupgradeactions.PerformLayout();
this.pnllist.ResumeLayout(false);
this.pnllist.PerformLayout();
+ this.panel3.ResumeLayout(false);
+ this.panel3.PerformLayout();
this.ResumeLayout(false);
}
@@ -255,7 +305,12 @@ namespace ShiftOS.WinForms.Applications
private System.Windows.Forms.Button btnbuy;
private ShiftedProgressBar pgupgradeprogress;
private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label lbcodepoints;
private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Panel panel3;
+ private System.Windows.Forms.Label lblcategorytext;
+ private System.Windows.Forms.Button btncat_forward;
+ private System.Windows.Forms.Button btncat_back;
+ private System.Windows.Forms.Label lbnoupgrades;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
index b3724ae..08e6c8f 100644
--- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
+++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs
@@ -30,6 +30,7 @@ using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
+using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using ShiftOS.Engine;
@@ -39,18 +40,24 @@ namespace ShiftOS.WinForms.Applications
{
[Launcher("Shiftorium", true, "al_shiftorium", "Utilities")]
[RequiresUpgrade("shiftorium_gui")]
+ [MultiplayerOnly]
[WinOpen("shiftorium")]
[DefaultTitle("Shiftorium")]
[DefaultIcon("iconShiftorium")]
public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow
{
-
+ public int CategoryId = 0;
public static System.Timers.Timer timer100;
public ShiftoriumFrontend()
{
-
+ cp_update = new System.Windows.Forms.Timer();
+ cp_update.Tick += (o, a) =>
+ {
+ lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints.";
+ };
+ cp_update.Interval = 100;
InitializeComponent();
PopulateShiftorium();
lbupgrades.SelectedIndexChanged += (o, a) =>
@@ -84,17 +91,75 @@ namespace ShiftOS.WinForms.Applications
public void PopulateShiftorium()
{
- lbupgrades.Items.Clear();
- upgrades.Clear();
- Timer();
- label2.Text = "You have: " + SaveSystem.CurrentSave.Codepoints.ToString() + " Codepoints";
-
- foreach (var upg in backend.GetAvailable())
+ var t = new Thread(() =>
{
- String name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
- upgrades.Add(name, upg);
- lbupgrades.Items.Add(name);
- }
+ try
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbnoupgrades.Hide();
+ lbupgrades.Items.Clear();
+ upgrades.Clear();
+ Timer();
+ });
+
+ foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId]))
+ {
+ string name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP";
+ upgrades.Add(name, upg);
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbupgrades.Items.Add(name);
+ });
+ }
+
+ if (lbupgrades.Items.Count == 0)
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbnoupgrades.Show();
+ lbnoupgrades.Location = new Point(
+ (lbupgrades.Width - lbnoupgrades.Width) / 2,
+ lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2
+ );
+ });
+ }
+ else
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbnoupgrades.Hide();
+ });
+ }
+
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ try
+ {
+ lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId];
+ btncat_back.Visible = (CategoryId > 0);
+ btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1);
+ }
+ catch
+ {
+
+ }
+ });
+ }
+ catch
+ {
+ Desktop.InvokeOnWorkerThread(() =>
+ {
+ lbnoupgrades.Show();
+ lbnoupgrades.Location = new Point(
+ (lbupgrades.Width - lbnoupgrades.Width) / 2,
+ lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2
+ );
+ });
+ }
+ });
+ t.IsBackground = true;
+ t.Start();
}
public static bool UpgradeInstalled(string upg)
@@ -148,9 +213,38 @@ namespace ShiftOS.WinForms.Applications
private void btnbuy_Click(object sender, EventArgs e)
{
+ long cpCost = 0;
backend.Silent = true;
- backend.Buy(upgrades[lbupgrades.SelectedItem.ToString()].ID, upgrades[lbupgrades.SelectedItem.ToString()].Cost);
- backend.Silent = false;
+ Dictionary<string, long> UpgradesToBuy = new Dictionary<string, long>();
+ foreach (var itm in lbupgrades.SelectedItems)
+ {
+ cpCost += upgrades[itm.ToString()].Cost;
+ UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost);
+ }
+ if (SaveSystem.CurrentSave.Codepoints < cpCost)
+ {
+ Infobox.Show("Insufficient Codepoints", $"You do not have enough Codepoints to perform this action. You need {cpCost - SaveSystem.CurrentSave.Codepoints} more.");
+
+ }
+ else
+ {
+ foreach(var upg in UpgradesToBuy)
+ {
+ SaveSystem.CurrentSave.Codepoints -= upg.Value;
+ if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key))
+ {
+ SaveSystem.CurrentSave.Upgrades[upg.Key] = true;
+ }
+ else
+ {
+ SaveSystem.CurrentSave.Upgrades.Add(upg.Key, true);
+ }
+ SaveSystem.SaveGame();
+ backend.InvokeUpgradeInstalled();
+ }
+ }
+
+ backend.Silent = false;
PopulateShiftorium();
btnbuy.Hide();
}
@@ -161,6 +255,8 @@ namespace ShiftOS.WinForms.Applications
public void OnLoad()
{
+ cp_update.Start();
+ lbnoupgrades.Hide();
}
public void OnSkinLoad()
@@ -168,17 +264,22 @@ namespace ShiftOS.WinForms.Applications
}
+ System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer();
+
public bool OnUnload()
{
+ cp_update.Stop();
+ cp_update = null;
return true;
}
public void OnUpgrade()
{
-
+ lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One;
+ lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display");
}
- private void label2_Click(object sender, EventArgs e)
+ private void lbcodepoints_Click(object sender, EventArgs e)
{
}
@@ -187,9 +288,33 @@ namespace ShiftOS.WinForms.Applications
{
timer100 = new System.Timers.Timer();
timer100.Interval = 2000;
+ //CLARIFICATION: What is this supposed to do? - Michael
//timer100.Elapsed += ???;
timer100.AutoReset = true;
timer100.Enabled = true;
}
+
+ private void btncat_back_Click(object sender, EventArgs e)
+ {
+ if(CategoryId > 0)
+ {
+ CategoryId--;
+ PopulateShiftorium();
+ }
+ }
+
+ private void btncat_forward_Click(object sender, EventArgs e)
+ {
+ if(CategoryId < backend.GetCategories().Length - 1)
+ {
+ CategoryId++;
+ PopulateShiftorium();
+ }
+ }
+
+ private void lblcategorytext_Click(object sender, EventArgs e)
+ {
+
+ }
}
}
diff --git a/ShiftOS.WinForms/Applications/Skin Loader.cs b/ShiftOS.WinForms/Applications/Skin Loader.cs
index 58b444c..e4f0597 100644
--- a/ShiftOS.WinForms/Applications/Skin Loader.cs
+++ b/ShiftOS.WinForms/Applications/Skin Loader.cs
@@ -47,18 +47,29 @@ namespace ShiftOS.WinForms.Applications
public Skin_Loader()
{
InitializeComponent();
-
+ SetupControls(pnlborder);
+ SetupControls(pnldesktop);
LoadedSkin = JsonConvert.DeserializeObject<Skin>(JsonConvert.SerializeObject(SkinEngine.LoadedSkin));
this.Load += (o, a) => { SetupUI(); };
}
+ public void SetupControls(Control ctrl)
+ {
+ ctrl.Tag = "keepbg keepfg keepfont";
+ foreach (Control c in ctrl.Controls)
+ SetupControls(c);
+ }
+
public Skin LoadedSkin { get; set; }
public void SetupUI()
{
- SetupDesktop();
- Setup();
+ if (LoadedSkin != null)
+ {
+ SetupDesktop();
+ Setup();
+ }
}
public void SetupDesktop()
@@ -70,7 +81,7 @@ namespace ShiftOS.WinForms.Applications
//upgrades
- if (SaveSystem.CurrentSave != null)
+ if (SaveSystem.CurrentSave != null && LoadedSkin != null)
{
desktoppanel.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop");
lbtime.Visible = ShiftoriumFrontend.UpgradeInstalled("desktop_clock_widget");
@@ -295,7 +306,7 @@ namespace ShiftOS.WinForms.Applications
System.IO.Directory.CreateDirectory(Paths.SharedFolder + "\\skins");
}
- string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentSave.Username + "-" + fname;
+ string path = Paths.SharedFolder + "\\skins\\" + SaveSystem.CurrentUser.Username + "-" + fname;
System.IO.File.WriteAllText(path, JsonConvert.SerializeObject(LoadedSkin));
})));
@@ -305,7 +316,15 @@ namespace ShiftOS.WinForms.Applications
{
AppearanceManager.SetupDialog(new FileDialog(new[] { ".skn" }, FileOpenerStyle.Open, new Action<string>((filename) =>
{
- LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
+ try
+ {
+ LoadedSkin = JsonConvert.DeserializeObject<Skin>(ShiftOS.Objects.ShiftFS.Utils.ReadAllText(filename));
+ }
+ catch
+ {
+ Infobox.Show("Invalid Skin", "This skin is not compatible with this version of ShiftOS.");
+ }
+
SetupUI();
})));
}
@@ -318,6 +337,7 @@ namespace ShiftOS.WinForms.Applications
public void OnSkinLoad()
{
+ SetupUI();
}
public bool OnUnload()
@@ -327,6 +347,7 @@ namespace ShiftOS.WinForms.Applications
public void OnUpgrade()
{
+ SetupUI();
}
}
}
diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs
index 7bab213..de4888b 100644
--- a/ShiftOS.WinForms/Applications/Terminal.cs
+++ b/ShiftOS.WinForms/Applications/Terminal.cs
@@ -43,6 +43,7 @@ using System.Collections;
using static ShiftOS.Engine.SkinEngine;
using ShiftOS.Engine;
using ShiftOS.Objects;
+using ShiftOS.WinForms.Tools;
namespace ShiftOS.WinForms.Applications
{
@@ -57,7 +58,6 @@ namespace ShiftOS.WinForms.Applications
public static string latestCommmand = "";
-
public static bool IsInRemoteSystem = false;
public static string RemoteGuid = "";
@@ -116,7 +116,7 @@ namespace ShiftOS.WinForms.Applications
[Obsolete("This is used for compatibility with old parts of the backend. Please use TerminalBackend instead.")]
public static void InvokeCommand(string text)
{
-
+
TerminalBackend.InvokeCommand(text);
}
@@ -130,17 +130,30 @@ namespace ShiftOS.WinForms.Applications
{
this.Invoke(new Action(() =>
{
- ResetAllKeywords();
- rtbterm.Text = "";
- TerminalBackend.PrefixEnabled = true;
- TerminalBackend.InStory = false;
- Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
- if (Shiftorium.UpgradeInstalled("wm_free_placement"))
+ if (Shiftorium.UpgradeInstalled("first_steps"))
+ {
+ if (!Shiftorium.UpgradeInstalled("desktop"))
+ {
+ 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);
+ }
+ }
+ else
{
- 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;
+ Story.Start("first_steps");
}
}));
@@ -188,52 +201,6 @@ namespace ShiftOS.WinForms.Applications
public static event TextSentEventHandler TextSent;
- public void ResetAllKeywords()
- {
- string primary = SaveSystem.CurrentSave.Username + " ";
- string secondary = "shiftos ";
-
-
- var asm = Assembly.GetExecutingAssembly();
-
- var types = asm.GetTypes();
-
- 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))
- {
- 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)
- {
- var cmd = ma as Command;
- if (!secondary.Contains(cmd.name))
- secondary += cmd.name + " ";
- }
- }
- }
- }
- }
- }
- }
- }
-
-
- }
-
public static void MakeWidget(Controls.TerminalBox txt)
{
AppearanceManager.StartConsoleOut();
@@ -243,15 +210,29 @@ namespace ShiftOS.WinForms.Applications
};
txt.KeyDown += (o, a) =>
{
+ if (a.Control == true || a.Alt == true)
+ {
+ a.SuppressKeyPress = true;
+ return;
+ }
+
if (a.KeyCode == Keys.Enter)
{
try
{
- a.SuppressKeyPress = true;
- Console.WriteLine("");
+ if (!TerminalBackend.InStory)
+ a.SuppressKeyPress = false;
+ if (!TerminalBackend.PrefixEnabled)
+ {
+ string textraw = txt.Lines[txt.Lines.Length - 1];
+ TextSent?.Invoke(textraw);
+ TerminalBackend.SendText(textraw);
+ return;
+ }
var text = txt.Lines.ToArray();
- var text2 = text[text.Length - 2];
+ var text2 = text[text.Length - 1];
var text3 = "";
+ Console.WriteLine();
var text4 = Regex.Replace(text2, @"\t|\n|\r", "");
if (IsInRemoteSystem == true)
@@ -266,17 +247,41 @@ 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);
+ TerminalBackend.SendText(text4);
if (TerminalBackend.InStory == false)
{
- TerminalBackend.InvokeCommand(text3);
+ if (text3 == "stop theme")
+ {
+ CurrentCommandParser.parser = null;
+ }
+ else
+ {
+ if (CurrentCommandParser.parser == null)
+ {
+ TerminalBackend.InvokeCommand(text3);
+ }
+ else
+ {
+ var result = CurrentCommandParser.parser.ParseCommand(text3);
+
+ if (result.Equals(default(KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>)))
+ {
+ Console.WriteLine("Syntax Error: Syntax Error");
+ }
+ else
+ {
+ TerminalBackend.InvokeCommand(result.Key.Key, result.Key.Value, result.Value);
+ }
+ }
+ }
}
if (TerminalBackend.PrefixEnabled)
{
- Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
+ TerminalBackend.PrintPrompt();
}
}
}
@@ -290,7 +295,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)
{
@@ -310,7 +315,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;
@@ -325,11 +330,10 @@ namespace ShiftOS.WinForms.Applications
a.SuppressKeyPress = true;
}
}
- //( ͡° ͜ʖ ͡° ) You found the lennyface without looking at the commit message. Message Michael in the #shiftos channel on Discord saying "ladouceur" somewhere in your message if you see this.
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;
@@ -350,8 +354,8 @@ namespace ShiftOS.WinForms.Applications
txt.Focus();
txt.Font = LoadedSkin.TerminalFont;
- txt.ForeColor = LoadedSkin.TerminalForeColor;
- txt.BackColor = LoadedSkin.TerminalBackColor;
+ txt.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
+ txt.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
}
@@ -359,18 +363,17 @@ namespace ShiftOS.WinForms.Applications
{
ServerManager.MessageReceived += (msg) =>
{
- if(msg.Name == "trm_handshake_guid")
+ 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 = "";
}
};
-
}
private void Terminal_FormClosing(object sender, FormClosingEventArgs e)
@@ -386,16 +389,136 @@ namespace ShiftOS.WinForms.Applications
if (SaveSystem.CurrentSave != null)
{
+ TerminalBackend.PrintPrompt();
if (!ShiftoriumFrontend.UpgradeInstalled("window_manager"))
{
- rtbterm.Text = AppearanceManager.LastTerminalText;
rtbterm.Select(rtbterm.TextLength, 0);
}
- Console.Write($"{SaveSystem.CurrentSave.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ");
-
}
+ }
+ public static string RemoteSystemName { get; set; }
+ public static string RemoteUser { get; set; }
+ public static string RemotePass { get; set; }
+
+ [Story("first_steps")]
+ public static void FirstSteps()
+ {
+ TerminalBackend.PrefixEnabled = false;
+ new Thread(() =>
+ {
+ TerminalBackend.InStory = true;
+ Console.WriteLine("Hey there, and welcome to ShiftOS.");
+ Thread.Sleep(2000);
+ Console.WriteLine("My name is DevX. I am the developer of this operating system.");
+ Thread.Sleep(2000);
+ Console.WriteLine("Right now, I am using the Terminal application as a means of talking to you.");
+ Thread.Sleep(2000);
+ Console.WriteLine("ShiftOS is a very early operating system, but I have big plans for it.");
+ Thread.Sleep(2000);
+ Console.WriteLine("I can't reveal all my plans to you at this moment, but you play a big role.");
+ Thread.Sleep(2000);
+ Console.WriteLine("Your role in all of this is to help me develop ShiftOS more.");
+ Thread.Sleep(2000);
+ Console.WriteLine("You may not know how to program, but that's perfectly fine. You don't need to.");
+ Thread.Sleep(2000);
+ Console.WriteLine("What you do need to do, is simply use the operating system - like you would a regular computer.");
+ Thread.Sleep(2000);
+ Console.WriteLine("As you use ShiftOS, you will earn a special currency called Codepoints.");
+ Thread.Sleep(2000);
+ Console.WriteLine("The more things you do, the more Codepoints you get! Simple, right?");
+ Thread.Sleep(2000);
+ Console.WriteLine("Once you rack up enough Codepoints, you can use them inside the Shiftorium to buy new features for ShiftOS.");
+ Thread.Sleep(2000);
+ Console.WriteLine("These features include new programs, system enhancements, Terminal commands, and so much more!");
+ Thread.Sleep(2000);
+ Console.WriteLine("Ahh, that reminds me. I suppose you don't know how to use the Terminal yet, do you...");
+ Thread.Sleep(2000);
+ Console.WriteLine("Well, the ShiftOS terminal is similar to a regular Linux terminal, however things are a bit... how you say.... primitive.");
+ Thread.Sleep(2000);
+ Console.WriteLine("Let's just say.... I've been focusing more on function than form with this one.... Anyways, here's how the terminal works.");
+ Thread.Sleep(2000);
+ Console.WriteLine("Each command is categorized into a \"Namespace\". All a namespace is, is a nice way of distinguishing between commands.");
+ Thread.Sleep(2000);
+ Console.WriteLine("...For example you may have a bunch of commands for managing files, and others for opening/closing programs.");
+ Thread.Sleep(2000);
+ Console.WriteLine("The three main namespaces you'll be using for the next while are the \"sos\", \"shiftorium\", and \"win\" namespaces.");
+ Thread.Sleep(2000);
+ Console.WriteLine("To run a command, simply type its namespace, followed by a period/full-stop, followed by the command name.");
+ Thread.Sleep(2000);
+ Console.WriteLine("Give it a try! Type \"sos.help\" in the following prompt to view a list of all ShiftOS commands.");
+ Thread.Sleep(2000);
+ TerminalBackend.InStory = false;
+ TerminalBackend.PrefixEnabled = true;
+ TerminalBackend.PrintPrompt();
+ bool help_entered = false;
+ TerminalBackend.CommandProcessed += (text, args) =>
+ {
+ if (text.EndsWith("sos.help") && help_entered == false)
+ help_entered = true;
+ };
+ while (help_entered == false)
+ Thread.Sleep(10);
+ TerminalBackend.InStory = true;
+ TerminalBackend.PrefixEnabled = false;
+ Thread.Sleep(2000);
+ Console.WriteLine("Good job! Next, we will look at how to pass data to a command, such as win.open.");
+ Thread.Sleep(2000);
+ Console.WriteLine("In ShiftOS, passing data to a command is quite simple! After the command name, place an opening and closing curly brace, like so: \"win.open{}\".");
+ Thread.Sleep(2000);
+ Console.WriteLine("Everything between those two curly braces is treated as command data.");
+ Thread.Sleep(2000);
+ Console.WriteLine("However, you can't just spam a bunch of 1s and 0s and call it a day, nonono!");
+ Thread.Sleep(2000);
+ Console.WriteLine("Command data is split into a list of keys and values.");
+ Thread.Sleep(2000);
+ Console.WriteLine("The key tells the command the name of the data, and the value is what the command will see when it looks at the key.");
+ Thread.Sleep(2000);
+ Console.WriteLine("There are three main types of values. Booleans, which can be either \"true\" or \"false\", Numbers, which can be any integer number, positive or negative, and Strings - any piece of text as long as it is surrounded by double-quotes.");
+ Thread.Sleep(2000);
+ Console.WriteLine("For example, we could write every programmer's first program - by typing \"trm.echo{msg:\"Hello, world!\"}\". Running this will cause the Terminal to print, well, \"Hello, world!\"");
+ Thread.Sleep(2000);
+ Console.WriteLine("To open an application in ShiftOS, you can use this principle with the \"win.open\" command.");
+ Thread.Sleep(2000);
+ Console.WriteLine("First, type \"win.open\" with no data to see a list of all installed programs.");
+ Thread.Sleep(2000);
+ TerminalBackend.InStory = false;
+ bool winopenEntered = false;
+ TerminalBackend.PrefixEnabled = true;
+ TerminalBackend.PrintPrompt();
+ TerminalBackend.CommandProcessed += (text, args) =>
+ {
+ if (help_entered == true)
+ if (text.EndsWith("win.open") && winopenEntered == false)
+ winopenEntered = true;
+ };
+ while (winopenEntered == false)
+ Thread.Sleep(10);
+ TerminalBackend.InStory = true;
+ TerminalBackend.PrefixEnabled = false;
+
+ Thread.Sleep(2000);
+ Console.WriteLine("Pretty cool, it gave you a nice list of other win.open commands that will let you open each program.");
+ Thread.Sleep(2000);
+ Console.WriteLine("You've got the just of using ShiftOS. Now, for your goal.");
+ 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 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 even more Codepoints.");
+ Thread.Sleep(2000);
+ 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);
+ TerminalBackend.PrefixEnabled = true;
+ TerminalBackend.InStory = false;
+ SaveSystem.SaveGame();
+ Thread.Sleep(1000);
+ TerminalBackend.PrintPrompt();
+ }).Start();
}
public void OnSkinLoad()
@@ -403,8 +526,8 @@ namespace ShiftOS.WinForms.Applications
try
{
rtbterm.Font = LoadedSkin.TerminalFont;
- rtbterm.ForeColor = LoadedSkin.TerminalForeColor;
- rtbterm.BackColor = LoadedSkin.TerminalBackColor;
+ rtbterm.ForeColor = ControlManager.ConvertColor(LoadedSkin.TerminalForeColorCC);
+ rtbterm.BackColor = ControlManager.ConvertColor(LoadedSkin.TerminalBackColorCC);
}
catch
{
@@ -429,7 +552,7 @@ namespace ShiftOS.WinForms.Applications
if (TerminalBackend.PrefixEnabled)
{
- Console.Write($"{SaveSystem.CurrentSave.Username}@shiftos:~$ ");
+ Console.Write($"{SaveSystem.CurrentUser.Username}@shiftos:~$ ");
}
}
catch (Exception ex)
@@ -451,7 +574,10 @@ namespace ShiftOS.WinForms.Applications
{
}
-
+
+ internal void ClearText()
+ {
+ rtbterm.Text = "";
+ }
}
-}
-//lol you found this comment i made so i chould push a change to make a point. \ No newline at end of file
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/TriPresent.Designer.cs b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs
new file mode 100644
index 0000000..d0e704f
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriPresent.Designer.cs
@@ -0,0 +1,312 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class TriPresent
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.addLabelToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.addLabel = new System.Windows.Forms.Panel();
+ this.checkBox2 = new System.Windows.Forms.CheckBox();
+ this.checkBox1 = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.yLabel = new System.Windows.Forms.Label();
+ this.xLabel = new System.Windows.Forms.Label();
+ this.yPosition = new System.Windows.Forms.NumericUpDown();
+ this.xPosition = new System.Windows.Forms.NumericUpDown();
+ this.labelContents = new System.Windows.Forms.TextBox();
+ this.addItemLabel = new System.Windows.Forms.Label();
+ this.splitContainer1 = new System.Windows.Forms.SplitContainer();
+ this.designerPanel = new System.Windows.Forms.Panel();
+ this.menuStrip1.SuspendLayout();
+ this.addLabel.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.yPosition)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.xPosition)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
+ this.splitContainer1.Panel1.SuspendLayout();
+ this.splitContainer1.Panel2.SuspendLayout();
+ this.splitContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.fileToolStripMenuItem,
+ this.editToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(758, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // fileToolStripMenuItem
+ //
+ this.fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.openToolStripMenuItem,
+ this.saveToolStripMenuItem});
+ this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
+ this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
+ this.fileToolStripMenuItem.Text = "&File";
+ //
+ // openToolStripMenuItem
+ //
+ this.openToolStripMenuItem.Name = "openToolStripMenuItem";
+ this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
+ this.openToolStripMenuItem.Text = "&Open";
+ //
+ // saveToolStripMenuItem
+ //
+ this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
+ this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
+ this.saveToolStripMenuItem.Text = "&Save";
+ //
+ // editToolStripMenuItem
+ //
+ this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addToolStripMenuItem});
+ this.editToolStripMenuItem.Name = "editToolStripMenuItem";
+ this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
+ this.editToolStripMenuItem.Text = "&Edit";
+ //
+ // addToolStripMenuItem
+ //
+ this.addToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addLabelToolStripMenuItem});
+ this.addToolStripMenuItem.Name = "addToolStripMenuItem";
+ this.addToolStripMenuItem.Size = new System.Drawing.Size(96, 22);
+ this.addToolStripMenuItem.Text = "Add";
+ //
+ // addLabelToolStripMenuItem
+ //
+ this.addLabelToolStripMenuItem.Name = "addLabelToolStripMenuItem";
+ this.addLabelToolStripMenuItem.Size = new System.Drawing.Size(127, 22);
+ this.addLabelToolStripMenuItem.Text = "Add Label";
+ this.addLabelToolStripMenuItem.Click += new System.EventHandler(this.addLabelToolStripMenuItem_Click);
+ //
+ // addLabel
+ //
+ this.addLabel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.addLabel.Controls.Add(this.checkBox2);
+ this.addLabel.Controls.Add(this.checkBox1);
+ this.addLabel.Controls.Add(this.label1);
+ this.addLabel.Controls.Add(this.panel1);
+ this.addLabel.Controls.Add(this.yLabel);
+ this.addLabel.Controls.Add(this.xLabel);
+ this.addLabel.Controls.Add(this.yPosition);
+ this.addLabel.Controls.Add(this.xPosition);
+ this.addLabel.Controls.Add(this.labelContents);
+ this.addLabel.Controls.Add(this.addItemLabel);
+ this.addLabel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.addLabel.Location = new System.Drawing.Point(0, 0);
+ this.addLabel.Name = "addLabel";
+ this.addLabel.Size = new System.Drawing.Size(252, 456);
+ this.addLabel.TabIndex = 1;
+ this.addLabel.Visible = false;
+ //
+ // checkBox2
+ //
+ this.checkBox2.AutoSize = true;
+ this.checkBox2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.checkBox2.Location = new System.Drawing.Point(6, 163);
+ this.checkBox2.Name = "checkBox2";
+ this.checkBox2.Size = new System.Drawing.Size(48, 17);
+ this.checkBox2.TabIndex = 11;
+ this.checkBox2.Text = "Italic";
+ this.checkBox2.UseVisualStyleBackColor = true;
+ //
+ // checkBox1
+ //
+ this.checkBox1.AutoSize = true;
+ this.checkBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.checkBox1.Location = new System.Drawing.Point(6, 140);
+ this.checkBox1.Name = "checkBox1";
+ this.checkBox1.Size = new System.Drawing.Size(51, 17);
+ this.checkBox1.TabIndex = 10;
+ this.checkBox1.Text = "Bold";
+ this.checkBox1.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(115, 144);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(58, 13);
+ this.label1.TabIndex = 9;
+ this.label1.Text = "Text Color:";
+ //
+ // panel1
+ //
+ this.panel1.BackColor = System.Drawing.Color.Black;
+ this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.panel1.ForeColor = System.Drawing.Color.Black;
+ this.panel1.Location = new System.Drawing.Point(179, 141);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(35, 20);
+ this.panel1.TabIndex = 8;
+ this.panel1.Click += new System.EventHandler(this.panel1_Click);
+ //
+ // yLabel
+ //
+ this.yLabel.AutoSize = true;
+ this.yLabel.Location = new System.Drawing.Point(200, 96);
+ this.yLabel.Name = "yLabel";
+ this.yLabel.Size = new System.Drawing.Size(14, 13);
+ this.yLabel.TabIndex = 5;
+ this.yLabel.Text = "Y";
+ //
+ // xLabel
+ //
+ this.xLabel.AutoSize = true;
+ this.xLabel.Location = new System.Drawing.Point(3, 95);
+ this.xLabel.Name = "xLabel";
+ this.xLabel.Size = new System.Drawing.Size(14, 13);
+ this.xLabel.TabIndex = 4;
+ this.xLabel.Text = "X";
+ //
+ // yPosition
+ //
+ this.yPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.yPosition.Location = new System.Drawing.Point(127, 114);
+ this.yPosition.Maximum = new decimal(new int[] {
+ 999999999,
+ 0,
+ 0,
+ 0});
+ this.yPosition.Name = "yPosition";
+ this.yPosition.Size = new System.Drawing.Size(87, 20);
+ this.yPosition.TabIndex = 3;
+ //
+ // xPosition
+ //
+ this.xPosition.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.xPosition.Location = new System.Drawing.Point(3, 114);
+ this.xPosition.Maximum = new decimal(new int[] {
+ 999999999,
+ 0,
+ 0,
+ 0});
+ this.xPosition.Name = "xPosition";
+ this.xPosition.Size = new System.Drawing.Size(87, 20);
+ this.xPosition.TabIndex = 2;
+ //
+ // labelContents
+ //
+ this.labelContents.Location = new System.Drawing.Point(3, 26);
+ this.labelContents.Multiline = true;
+ this.labelContents.Name = "labelContents";
+ this.labelContents.Size = new System.Drawing.Size(211, 67);
+ this.labelContents.TabIndex = 1;
+ this.labelContents.Text = "Text";
+ //
+ // addItemLabel
+ //
+ this.addItemLabel.Location = new System.Drawing.Point(0, 0);
+ this.addItemLabel.Name = "addItemLabel";
+ this.addItemLabel.Size = new System.Drawing.Size(214, 23);
+ this.addItemLabel.TabIndex = 0;
+ this.addItemLabel.Text = "{ADD_ITEM_LABEL}";
+ this.addItemLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // splitContainer1
+ //
+ this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.splitContainer1.Location = new System.Drawing.Point(0, 24);
+ this.splitContainer1.Name = "splitContainer1";
+ //
+ // splitContainer1.Panel1
+ //
+ this.splitContainer1.Panel1.Controls.Add(this.addLabel);
+ //
+ // splitContainer1.Panel2
+ //
+ this.splitContainer1.Panel2.Controls.Add(this.designerPanel);
+ this.splitContainer1.Size = new System.Drawing.Size(758, 456);
+ this.splitContainer1.SplitterDistance = 252;
+ this.splitContainer1.TabIndex = 2;
+ //
+ // designerPanel
+ //
+ this.designerPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.designerPanel.Location = new System.Drawing.Point(0, 0);
+ this.designerPanel.Name = "designerPanel";
+ this.designerPanel.Size = new System.Drawing.Size(502, 456);
+ this.designerPanel.TabIndex = 0;
+ this.designerPanel.Click += new System.EventHandler(this.designerPanel_Click);
+ //
+ // TriPresent
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.splitContainer1);
+ this.Controls.Add(this.menuStrip1);
+ this.Name = "TriPresent";
+ this.Size = new System.Drawing.Size(758, 480);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.addLabel.ResumeLayout(false);
+ this.addLabel.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.yPosition)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.xPosition)).EndInit();
+ this.splitContainer1.Panel1.ResumeLayout(false);
+ this.splitContainer1.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
+ this.splitContainer1.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem addLabelToolStripMenuItem;
+ private System.Windows.Forms.Panel addLabel;
+ private System.Windows.Forms.Label addItemLabel;
+ private System.Windows.Forms.Label yLabel;
+ private System.Windows.Forms.Label xLabel;
+ private System.Windows.Forms.NumericUpDown yPosition;
+ private System.Windows.Forms.NumericUpDown xPosition;
+ private System.Windows.Forms.TextBox labelContents;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.CheckBox checkBox2;
+ private System.Windows.Forms.CheckBox checkBox1;
+ private System.Windows.Forms.SplitContainer splitContainer1;
+ private System.Windows.Forms.Panel designerPanel;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TriPresent.cs b/ShiftOS.WinForms/Applications/TriPresent.cs
new file mode 100644
index 0000000..fc1d982
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriPresent.cs
@@ -0,0 +1,91 @@
+#define BETA_2_5
+
+using ShiftOS.Objects.ShiftFS;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using System.Threading;
+
+namespace ShiftOS.WinForms.Applications
+{
+#if !BETA_2_5
+ [WinOpen("tripresent")]
+ [AppscapeEntry("TriPresent", "Part of the trilogy of office applications for enhancement of your system. TriPresent is easliy the best presentation creator out there for ShiftOS.", 2048, 1500, "file_skimmer", "Office")]
+ [DefaultTitle("TriPresent")]
+ [Launcher("TriPresent", false, null, "Office")]
+#endif
+ public partial class TriPresent : UserControl, IShiftOSWindow
+ {
+ public TriPresent()
+ {
+ InitializeComponent();
+ }
+
+ private void addLabelToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ addItemLabel.Text = "Add Label";
+ addLabel.Show();
+ }
+
+ private void button2_Click(object sender, EventArgs e)
+ {
+ addLabel.Hide();
+ }
+
+ public void OnLoad()
+ {
+ panel1.ForeColor = Color.Black;
+ panel1.BackColor = Color.Black;
+ }
+
+ public void OnSkinLoad()
+ {
+
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+
+ }
+
+ private void placeAdd_Click(object sender, EventArgs e)
+ {
+
+ }
+
+ private void panel1_Click(object sender, EventArgs e)
+ {
+ AppearanceManager.SetupDialog(new ColorPicker(panel1.BackColor, "Text Color", new Action<Color>((col) =>
+ {
+ panel1.ForeColor = col;
+ panel1.BackColor = col;
+ })));
+ }
+
+ private void designerPanel_Click(object sender, EventArgs e)
+ {
+ if (addLabel.Visible == true)
+ {
+ Label label = new Label();
+ label.Parent = designerPanel;
+ label.BackColor = Color.Transparent;
+ label.ForeColor = panel1.BackColor;
+ label.Text = labelContents.Text;
+ label.Location = new Point(Cursor.Position.X / 3, Cursor.Position.Y);
+ label.Text = labelContents.Text;
+ }
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TriPresent.resx b/ShiftOS.WinForms/Applications/TriPresent.resx
new file mode 100644
index 0000000..d5494e3
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriPresent.resx
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/TriSheet.Designer.cs b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs
new file mode 100644
index 0000000..b4aa1c4
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriSheet.Designer.cs
@@ -0,0 +1,65 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class TriSheet
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.toolStripContainer1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(710, 464);
+ this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
+ this.toolStripContainer1.Name = "toolStripContainer1";
+ this.toolStripContainer1.Size = new System.Drawing.Size(710, 489);
+ this.toolStripContainer1.TabIndex = 0;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // TriSheet
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.toolStripContainer1);
+ this.Name = "TriSheet";
+ this.Size = new System.Drawing.Size(710, 489);
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TriSheet.cs b/ShiftOS.WinForms/Applications/TriSheet.cs
new file mode 100644
index 0000000..18b09b3
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriSheet.cs
@@ -0,0 +1,22 @@
+#define BETA_2_5
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace ShiftOS.WinForms.Applications
+{
+ public partial class TriSheet : UserControl
+ {
+ public TriSheet()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TriSheet.resx b/ShiftOS.WinForms/Applications/TriSheet.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriSheet.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/TriWrite.Designer.cs b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs
new file mode 100644
index 0000000..a1432d8
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriWrite.Designer.cs
@@ -0,0 +1,339 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class TriWrite
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(TriWrite));
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.addContactToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.tvcontacts = new System.Windows.Forms.TreeView();
+ this.panel1 = new System.Windows.Forms.Panel();
+ this.txtbody = new System.Windows.Forms.Label();
+ this.lbtitle = new System.Windows.Forms.Label();
+ this.menuStrip2 = new System.Windows.Forms.MenuStrip();
+ this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.txtcontents = new System.Windows.Forms.RichTextBox();
+ this.toolStrip1 = new System.Windows.Forms.ToolStrip();
+ this.bold = new System.Windows.Forms.ToolStripButton();
+ this.italic = new System.Windows.Forms.ToolStripButton();
+ this.underline = new System.Windows.Forms.ToolStripButton();
+ this.strikethrough = new System.Windows.Forms.ToolStripButton();
+ this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
+ this.fonts = new System.Windows.Forms.ToolStripComboBox();
+ this.size = new System.Windows.Forms.ToolStripTextBox();
+ this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
+ this.left = new System.Windows.Forms.ToolStripButton();
+ this.center = new System.Windows.Forms.ToolStripButton();
+ this.right = new System.Windows.Forms.ToolStripButton();
+ this.menuStrip1.SuspendLayout();
+ this.panel1.SuspendLayout();
+ this.menuStrip2.SuspendLayout();
+ this.toolStrip1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addContactToolStripMenuItem,
+ this.removeToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(872, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // addContactToolStripMenuItem
+ //
+ this.addContactToolStripMenuItem.Name = "addContactToolStripMenuItem";
+ this.addContactToolStripMenuItem.Size = new System.Drawing.Size(12, 20);
+ //
+ // removeToolStripMenuItem
+ //
+ this.removeToolStripMenuItem.Name = "removeToolStripMenuItem";
+ this.removeToolStripMenuItem.Size = new System.Drawing.Size(12, 20);
+ //
+ // tvcontacts
+ //
+ this.tvcontacts.Dock = System.Windows.Forms.DockStyle.Left;
+ this.tvcontacts.LineColor = System.Drawing.Color.Empty;
+ this.tvcontacts.Location = new System.Drawing.Point(0, 24);
+ this.tvcontacts.Name = "tvcontacts";
+ this.tvcontacts.Size = new System.Drawing.Size(224, 551);
+ this.tvcontacts.TabIndex = 1;
+ //
+ // panel1
+ //
+ this.panel1.Controls.Add(this.txtbody);
+ this.panel1.Controls.Add(this.lbtitle);
+ this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.panel1.Location = new System.Drawing.Point(224, 24);
+ this.panel1.Name = "panel1";
+ this.panel1.Size = new System.Drawing.Size(648, 551);
+ this.panel1.TabIndex = 2;
+ //
+ // txtbody
+ //
+ this.txtbody.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.txtbody.Location = new System.Drawing.Point(7, 54);
+ this.txtbody.Name = "txtbody";
+ this.txtbody.Size = new System.Drawing.Size(626, 481);
+ this.txtbody.TabIndex = 1;
+ this.txtbody.Text = resources.GetString("txtbody.Text");
+ //
+ // lbtitle
+ //
+ this.lbtitle.AutoSize = true;
+ this.lbtitle.Location = new System.Drawing.Point(7, 4);
+ this.lbtitle.Name = "lbtitle";
+ this.lbtitle.Size = new System.Drawing.Size(44, 13);
+ this.lbtitle.TabIndex = 0;
+ this.lbtitle.Tag = "header1";
+ this.lbtitle.Text = "TriWrite";
+ //
+ // menuStrip2
+ //
+ this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.newToolStripMenuItem,
+ this.openToolStripMenuItem,
+ this.saveToolStripMenuItem});
+ this.menuStrip2.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip2.Name = "menuStrip2";
+ this.menuStrip2.Size = new System.Drawing.Size(652, 24);
+ this.menuStrip2.TabIndex = 2;
+ this.menuStrip2.Text = "menuStrip2";
+ //
+ // newToolStripMenuItem
+ //
+ this.newToolStripMenuItem.Name = "newToolStripMenuItem";
+ this.newToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
+ this.newToolStripMenuItem.Text = "New";
+ this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
+ //
+ // openToolStripMenuItem
+ //
+ this.openToolStripMenuItem.Name = "openToolStripMenuItem";
+ this.openToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
+ this.openToolStripMenuItem.Text = "Open";
+ this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
+ //
+ // saveToolStripMenuItem
+ //
+ this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
+ this.saveToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
+ this.saveToolStripMenuItem.Text = "Save";
+ this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
+ //
+ // txtcontents
+ //
+ this.txtcontents.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtcontents.Location = new System.Drawing.Point(0, 49);
+ this.txtcontents.Name = "txtcontents";
+ this.txtcontents.Size = new System.Drawing.Size(652, 365);
+ this.txtcontents.TabIndex = 4;
+ this.txtcontents.Text = "";
+ this.txtcontents.SelectionChanged += new System.EventHandler(this.txtcontents_SelectionChanged);
+ //
+ // toolStrip1
+ //
+ this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.bold,
+ this.italic,
+ this.underline,
+ this.strikethrough,
+ this.toolStripSeparator1,
+ this.fonts,
+ this.size,
+ this.toolStripSeparator2,
+ this.left,
+ this.center,
+ this.right});
+ this.toolStrip1.Location = new System.Drawing.Point(0, 24);
+ this.toolStrip1.Name = "toolStrip1";
+ this.toolStrip1.Size = new System.Drawing.Size(652, 25);
+ this.toolStrip1.TabIndex = 5;
+ this.toolStrip1.Text = "toolStrip1";
+ //
+ // bold
+ //
+ this.bold.CheckOnClick = true;
+ this.bold.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.bold.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Bold);
+ this.bold.Image = ((System.Drawing.Image)(resources.GetObject("bold.Image")));
+ this.bold.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.bold.Name = "bold";
+ this.bold.Size = new System.Drawing.Size(23, 22);
+ this.bold.Text = "B";
+ this.bold.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
+ //
+ // italic
+ //
+ this.italic.CheckOnClick = true;
+ this.italic.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.italic.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Italic);
+ this.italic.Image = ((System.Drawing.Image)(resources.GetObject("italic.Image")));
+ this.italic.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.italic.Name = "italic";
+ this.italic.Size = new System.Drawing.Size(23, 22);
+ this.italic.Text = "I";
+ this.italic.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
+ //
+ // underline
+ //
+ this.underline.CheckOnClick = true;
+ this.underline.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.underline.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Underline);
+ this.underline.Image = ((System.Drawing.Image)(resources.GetObject("underline.Image")));
+ this.underline.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.underline.Name = "underline";
+ this.underline.Size = new System.Drawing.Size(23, 22);
+ this.underline.Text = "U";
+ this.underline.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
+ //
+ // strikethrough
+ //
+ this.strikethrough.CheckOnClick = true;
+ this.strikethrough.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.strikethrough.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Strikeout, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+ this.strikethrough.Image = ((System.Drawing.Image)(resources.GetObject("strikethrough.Image")));
+ this.strikethrough.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.strikethrough.Name = "strikethrough";
+ this.strikethrough.Size = new System.Drawing.Size(23, 22);
+ this.strikethrough.Text = "S";
+ this.strikethrough.CheckedChanged += new System.EventHandler(this.bold_CheckedChanged);
+ //
+ // toolStripSeparator1
+ //
+ this.toolStripSeparator1.Name = "toolStripSeparator1";
+ this.toolStripSeparator1.Size = new System.Drawing.Size(6, 25);
+ //
+ // fonts
+ //
+ this.fonts.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.fonts.Name = "fonts";
+ this.fonts.Size = new System.Drawing.Size(121, 25);
+ this.fonts.SelectedIndexChanged += new System.EventHandler(this.fonts_SelectedIndexChanged);
+ //
+ // size
+ //
+ this.size.AutoSize = false;
+ this.size.MaxLength = 3;
+ this.size.Name = "size";
+ this.size.Size = new System.Drawing.Size(40, 25);
+ this.size.TextChanged += new System.EventHandler(this.size_Click);
+ //
+ // toolStripSeparator2
+ //
+ this.toolStripSeparator2.Name = "toolStripSeparator2";
+ this.toolStripSeparator2.Size = new System.Drawing.Size(6, 25);
+ //
+ // left
+ //
+ this.left.CheckOnClick = true;
+ this.left.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.left.Image = ((System.Drawing.Image)(resources.GetObject("left.Image")));
+ this.left.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.left.Name = "left";
+ this.left.Size = new System.Drawing.Size(31, 22);
+ this.left.Text = "Left";
+ this.left.Click += new System.EventHandler(this.left_Click);
+ //
+ // center
+ //
+ this.center.CheckOnClick = true;
+ this.center.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.center.Image = ((System.Drawing.Image)(resources.GetObject("center.Image")));
+ this.center.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.center.Name = "center";
+ this.center.Size = new System.Drawing.Size(46, 22);
+ this.center.Text = "Center";
+ this.center.Click += new System.EventHandler(this.center_Click);
+ //
+ // right
+ //
+ this.right.CheckOnClick = true;
+ this.right.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text;
+ this.right.Image = ((System.Drawing.Image)(resources.GetObject("right.Image")));
+ this.right.ImageTransparentColor = System.Drawing.Color.Magenta;
+ this.right.Name = "right";
+ this.right.Size = new System.Drawing.Size(39, 22);
+ this.right.Text = "Right";
+ this.right.Click += new System.EventHandler(this.right_Click);
+ //
+ // TriWrite
+ //
+ this.Controls.Add(this.txtcontents);
+ this.Controls.Add(this.toolStrip1);
+ this.Controls.Add(this.menuStrip2);
+ this.Name = "TriWrite";
+ this.Size = new System.Drawing.Size(652, 414);
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ this.panel1.ResumeLayout(false);
+ this.panel1.PerformLayout();
+ this.menuStrip2.ResumeLayout(false);
+ this.menuStrip2.PerformLayout();
+ this.toolStrip1.ResumeLayout(false);
+ this.toolStrip1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem addContactToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
+ private System.Windows.Forms.TreeView tvcontacts;
+ private System.Windows.Forms.Panel panel1;
+ private System.Windows.Forms.Label txtbody;
+ private System.Windows.Forms.Label lbtitle;
+ private System.Windows.Forms.MenuStrip menuStrip2;
+ private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
+ private System.Windows.Forms.RichTextBox txtcontents;
+ private System.Windows.Forms.ToolStrip toolStrip1;
+ private System.Windows.Forms.ToolStripButton bold;
+ private System.Windows.Forms.ToolStripButton italic;
+ private System.Windows.Forms.ToolStripButton underline;
+ private System.Windows.Forms.ToolStripButton strikethrough;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
+ private System.Windows.Forms.ToolStripComboBox fonts;
+ private System.Windows.Forms.ToolStripTextBox size;
+ private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
+ private System.Windows.Forms.ToolStripButton left;
+ private System.Windows.Forms.ToolStripButton center;
+ private System.Windows.Forms.ToolStripButton right;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TriWrite.cs b/ShiftOS.WinForms/Applications/TriWrite.cs
new file mode 100644
index 0000000..291aa30
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriWrite.cs
@@ -0,0 +1,182 @@
+using ShiftOS.Objects.ShiftFS;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [WinOpen("triwrite")]
+ [AppscapeEntry("TriWrite", "Part of the trilogy of office applications for enhancement of your system. TriWrite is easliy the best text editor out there for ShiftOS.", 1024, 750, "file_skimmer;textpad", "Office")]
+ [DefaultTitle("TriWrite")]
+ [Launcher("TriWrite", false, null, "Office")]
+ public partial class TriWrite : UserControl, IShiftOSWindow
+ {
+
+ public TriWrite()
+ {
+ InitializeComponent(); //From the library of babel: "FIRST COMMIT FROM A MAC WOOOO TURIANS ARE COOL"
+ }
+
+ private void newToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ txtcontents.Text = "";
+ }
+
+ private void openToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var txt = new List<string>();
+ txt.Add(".rtf");
+
+ FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Open, (path) => LoadFile(path));
+ }
+
+ public void LoadFile(string file)
+ {
+ txtcontents.Rtf = Utils.ReadAllText(file);
+ }
+
+ public void SaveFile(string file)
+ {
+ if (file.ToLower().EndsWith(".rtf"))
+ {
+ Utils.WriteAllText(file, txtcontents.Rtf);
+ }
+ else
+ {
+ Utils.WriteAllText(file, txtcontents.Text);
+ }
+ }
+
+ private void saveToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ var txt = new List<string>();
+ txt.Add(".rtf");
+ txt.Add(".txt");
+ FileSkimmerBackend.GetFile(txt.ToArray(), FileOpenerStyle.Save, (path) => SaveFile(path));
+ }
+
+ public void OnLoad()
+ {
+ UpdateUI();
+ }
+
+ public void OnSkinLoad()
+ {
+ ResetFonts();
+ }
+
+ public void ResetFonts()
+ {
+ fonts.Items.Clear();
+ foreach(var font in FontFamily.Families)
+ {
+ fonts.Items.Add(font.Name);
+ }
+ UpdateUI();
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ public void UpdateUI()
+ {
+ bold.Checked = txtcontents.SelectionFont.Bold;
+ italic.Checked = txtcontents.SelectionFont.Italic;
+ underline.Checked = txtcontents.SelectionFont.Underline;
+ strikethrough.Checked = txtcontents.SelectionFont.Strikeout;
+ fonts.Text = txtcontents.SelectionFont.Name;
+ size.Text = txtcontents.SelectionFont.Size.ToString();
+ left.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Left;
+ center.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Center;
+ right.Checked = txtcontents.SelectionAlignment == HorizontalAlignment.Right;
+
+ }
+
+ private void txtcontents_SelectionChanged(object sender, EventArgs e)
+ {
+ UpdateUI();
+ }
+
+ public void SetFontStyle(bool bold, bool italic, bool underline, bool strikethrough)
+ {
+ FontStyle fs = FontStyle.Regular;
+ if (bold)
+ fs |= FontStyle.Bold;
+ if (italic)
+ fs |= FontStyle.Italic;
+ if (underline)
+ fs |= FontStyle.Underline;
+ if (strikethrough)
+ fs |= FontStyle.Strikeout;
+ txtcontents.SelectionFont = new Font(txtcontents.SelectionFont, fs);
+ UpdateUI();
+ }
+
+ private void bold_CheckedChanged(object sender, EventArgs e)
+ {
+ SetFontStyle(bold.Checked, italic.Checked, underline.Checked, strikethrough.Checked);
+ }
+
+ public void SetFontFamily(string family, float emSize)
+ {
+ var style = txtcontents.SelectionFont.Style;
+ var size = emSize;
+ txtcontents.SelectionFont = new Font(family, size, style);
+ UpdateUI();
+ }
+
+ private void fonts_SelectedIndexChanged(object sender, EventArgs e)
+ {
+ SetFontFamily(fonts.Text, Convert.ToSingle(size.Text));
+ }
+
+ private void left_Click(object sender, EventArgs e)
+ {
+ txtcontents.SelectionAlignment = HorizontalAlignment.Left;
+ UpdateUI();
+ }
+
+ private void center_Click(object sender, EventArgs e)
+ {
+ txtcontents.SelectionAlignment = HorizontalAlignment.Center;
+ UpdateUI();
+
+ }
+
+ private void right_Click(object sender, EventArgs e)
+ {
+ txtcontents.SelectionAlignment = HorizontalAlignment.Right;
+ UpdateUI();
+
+ }
+
+ private void size_Click(object sender, EventArgs e)
+ {
+ try
+ {
+ float s = Convert.ToSingle(size.Text);
+ if(s != txtcontents.SelectionFont.Size)
+ {
+ SetFontFamily(fonts.Text, s);
+ }
+ }
+ catch
+ {
+ UpdateUI();
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/TriWrite.resx b/ShiftOS.WinForms/Applications/TriWrite.resx
new file mode 100644
index 0000000..a06716c
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TriWrite.resx
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+ <data name="txtbody.Text" xml:space="preserve">
+ <value>The Address Book helps you keep track of all your contacts within the digital society, whether they be friends, enemies, or whatnot.
+
+On the left, we have made a list of all your contacts. You can click on one to view full details on the contact.
+
+To add a contact, simply click "Add Contact", and to remove one, click "Remove". Some contacts may not be removed as they are integral to the progression of your adventures within the digital society.</value>
+ </data>
+ <metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>132, 17</value>
+ </metadata>
+ <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>247, 17</value>
+ </metadata>
+ <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <data name="bold.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="italic.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="underline.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="strikethrough.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="left.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="center.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+ <data name="right.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
+ YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIDSURBVDhPpZLrS5NhGMb3j4SWh0oRQVExD4gonkDpg4hG
+ YKxG6WBogkMZKgPNCEVJFBGdGETEvgwyO9DJE5syZw3PIlPEE9pgBCLZ5XvdMB8Ew8gXbl54nuf63dd9
+ 0OGSnwCahxbPRNPAPMw9Xpg6ZmF46kZZ0xSKzJPIrhpDWsVnpBhGkKx3nAX8Pv7z1zg8OoY/cITdn4fw
+ bf/C0kYAN3Ma/w3gWfZL5kzTKBxjWyK2DftwI9tyMYCZKXbNHaD91bLYJrDXsYbrWfUKwJrPE9M2M1Oc
+ VzOOpHI7Jr376Hi9ogHqFIANO0/MmmmbmSmm9a8ze+I4MrNWAdjtoJgWcx+PSzg166yZZ8xM8XvXDix9
+ c4jIqFYAjoriBV9AhEPv1mH/sonogha0afbZMMZz+yreTGyhpusHwtNNCsA5U1zS4BLxzJIfg299qO32
+ Ir7UJtZfftyATqeT+8o2D8JSjQrAJblrncYL7ZJ2+bfaFnC/1S1NjL3diRat7qrO7wLRP3HjWsojBeCo
+ mDEo5mNjuweFGvjWg2EBhCbpkW78htSHHwRyNdmgAFzPEee2iFkzayy2OLXzT4gr6UdUnlXrullsxxQ+
+ kx0g8BTA3aZlButjSTyjODq/WcQcW/B/Je4OQhLvKQDnzN1mp0nnkvAhR8VuMzNrpm1mpjgkoVwB/v8D
+ TgDQASA1MVpwzwAAAABJRU5ErkJggg==
+</value>
+ </data>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/TutorialBox.Designer.cs b/ShiftOS.WinForms/Applications/TutorialBox.Designer.cs
new file mode 100644
index 0000000..6e74023
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TutorialBox.Designer.cs
@@ -0,0 +1,57 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class TutorialBox
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.lbltuttext = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // lbltuttext
+ //
+ this.lbltuttext.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.lbltuttext.Location = new System.Drawing.Point(0, 0);
+ this.lbltuttext.Name = "lbltuttext";
+ this.lbltuttext.Size = new System.Drawing.Size(401, 134);
+ this.lbltuttext.TabIndex = 0;
+ //
+ // TutorialBox
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lbltuttext);
+ this.Name = "TutorialBox";
+ this.Size = new System.Drawing.Size(401, 134);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbltuttext;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TutorialBox.cs b/ShiftOS.WinForms/Applications/TutorialBox.cs
new file mode 100644
index 0000000..3c74443
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TutorialBox.cs
@@ -0,0 +1,76 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using System.Threading;
+
+namespace ShiftOS.WinForms.Applications
+{
+
+ [DefaultTitle("Tutorial objective")]
+ public partial class TutorialBox : UserControl, IShiftOSWindow
+ {
+ public TutorialBox()
+ {
+ InitializeComponent();
+ IsComplete = false;
+ lbltuttext.Text = "";
+ lbltuttext.Padding = new Padding(15);
+ lbltuttext.Margin = lbltuttext.Padding;
+ }
+
+ bool stillTyping = false;
+
+ public void SetObjective(string text)
+ {
+ while (stillTyping == true)
+ {
+
+ }
+
+ new Thread(() =>
+ {
+ stillTyping = true;
+ this.Invoke(new Action(() =>
+ {
+ lbltuttext.Text = "";
+ }));
+ foreach(var c in text.ToCharArray())
+ {
+ this.Invoke(new Action(() =>
+ {
+ lbltuttext.Text += c;
+ }));
+ Thread.Sleep(75);
+ }
+ Thread.Sleep(5000);
+ stillTyping = false;
+ }).Start();
+ }
+
+ public void OnLoad()
+ {
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool IsComplete { get; set; }
+
+ public bool OnUnload()
+ {
+ return IsComplete;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/TutorialBox.resx b/ShiftOS.WinForms/Applications/TutorialBox.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/TutorialBox.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs
new file mode 100644
index 0000000..d30e2df
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/UpdateManager.Designer.cs
@@ -0,0 +1,128 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class UpdateManager
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.lbupdatetitle = new System.Windows.Forms.Label();
+ this.pnlupdatebar = new System.Windows.Forms.Panel();
+ 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();
+ //
+ // lbupdatetitle
+ //
+ this.lbupdatetitle.AutoSize = true;
+ this.lbupdatetitle.Dock = System.Windows.Forms.DockStyle.Top;
+ this.lbupdatetitle.Location = new System.Drawing.Point(0, 0);
+ this.lbupdatetitle.Margin = new System.Windows.Forms.Padding(10);
+ this.lbupdatetitle.Name = "lbupdatetitle";
+ this.lbupdatetitle.Size = new System.Drawing.Size(117, 13);
+ this.lbupdatetitle.TabIndex = 0;
+ this.lbupdatetitle.Tag = "header1";
+ this.lbupdatetitle.Text = "Checking for updates...";
+ //
+ // pnlupdatebar
+ //
+ this.pnlupdatebar.Controls.Add(this.pgdownload);
+ this.pnlupdatebar.Controls.Add(this.btnaction);
+ this.pnlupdatebar.Controls.Add(this.btnclose);
+ this.pnlupdatebar.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.pnlupdatebar.Location = new System.Drawing.Point(0, 426);
+ this.pnlupdatebar.Name = "pnlupdatebar";
+ this.pnlupdatebar.Size = new System.Drawing.Size(597, 33);
+ this.pnlupdatebar.TabIndex = 1;
+ //
+ // pgdownload
+ //
+ this.pgdownload.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.pgdownload.Location = new System.Drawing.Point(86, 4);
+ this.pgdownload.Maximum = 100;
+ this.pgdownload.Name = "pgdownload";
+ this.pgdownload.Size = new System.Drawing.Size(427, 23);
+ this.pgdownload.TabIndex = 2;
+ 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;
+ this.wbstatus.Location = new System.Drawing.Point(0, 13);
+ this.wbstatus.MinimumSize = new System.Drawing.Size(20, 20);
+ this.wbstatus.Name = "wbstatus";
+ this.wbstatus.Size = new System.Drawing.Size(597, 413);
+ this.wbstatus.TabIndex = 2;
+ //
+ // UpdateManager
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.wbstatus);
+ this.Controls.Add(this.pnlupdatebar);
+ this.Controls.Add(this.lbupdatetitle);
+ this.Name = "UpdateManager";
+ this.Size = new System.Drawing.Size(597, 459);
+ this.pnlupdatebar.ResumeLayout(false);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label lbupdatetitle;
+ private System.Windows.Forms.Panel pnlupdatebar;
+ private Controls.ShiftedProgressBar pgdownload;
+ private System.Windows.Forms.Button btnaction;
+ private System.Windows.Forms.Button btnclose;
+ private System.Windows.Forms.WebBrowser wbstatus;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/UpdateManager.cs b/ShiftOS.WinForms/Applications/UpdateManager.cs
new file mode 100644
index 0000000..05ae9d0
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/UpdateManager.cs
@@ -0,0 +1,279 @@
+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 static ShiftOS.Engine.SkinEngine;
+using System.Net;
+using Newtonsoft.Json;
+using System.Reflection;
+using System.IO;
+using System.IO.Compression;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [Launcher("Update Manager", true, "al_update_manager", "Networking")]
+ [DefaultTitle("Update Manager")]
+ [WinOpen("update_manager")]
+ public partial class UpdateManager : UserControl, IShiftOSWindow
+ {
+ public UpdateManager()
+ {
+ InitializeComponent();
+ btnaction.Click += (o, a) => OnActionButtonClick?.Invoke();
+ }
+
+ public void OnLoad()
+ {
+ CheckForUpdate();
+ }
+
+ public void CheckForUpdate()
+ {
+ ConstructHtml(@"ShiftOS is grabbing information on the latest version. Please be patient.");
+ pgdownload.Show();
+ btnaction.Show();
+ lbupdatetitle.Text = "Checking for updates...";
+ pgdownload.Value = 0;
+ pgdownload.Maximum = 100;
+
+ var wc = new WebClient();
+
+ wc.DownloadProgressChanged += (o, a) =>
+ {
+ this.Invoke(new Action(() =>
+ {
+ pgdownload.Text = "Grabbing update data from multi-user-domain...";
+ pgdownload.Value = a.ProgressPercentage;
+ }));
+ };
+
+ wc.DownloadStringCompleted += (o, a) =>
+ {
+ var releases = JsonConvert.DeserializeObject<ShiftOS.Objects.Unite.Download[]>(a.Result);
+
+ var download = releases.OrderByDescending(x => x.PostDate).First();
+
+ var thisBuildDate = Assembly.GetExecutingAssembly().GetBuildDate(TimeZoneInfo.Utc);
+
+ if(download.PostDate > thisBuildDate)
+ {
+ this.Invoke(new Action(() =>
+ {
+ //This build is more recent than the currently running ShiftOS client.
+ SetupBuildUpdate(download);
+ }));
+ }
+ else
+ {
+ if (thisBuildDate > download.PostDate)
+ {
+ this.Invoke(new Action(() => ConstructHtml($@"### Unreleased build.
+
+You are currently running an unreleased build of ShiftOS, compiled on {thisBuildDate}, after the latest released version, {download.Name}, compiled on {download.PostDate}.")));
+ }
+ else
+ {
+ this.Invoke(new Action(() => ConstructHtml($@"### Up to date.
+
+You are currently running {download.Name}, compiled on {download.PostDate}.")));
+
+ }
+ this.Invoke(new Action(() =>
+ {
+ lbupdatetitle.Text = "No update available";
+ pgdownload.Hide();
+ btnaction.Hide();
+ }));
+ }
+ };
+
+ wc.DownloadStringAsync(new Uri("http://getshiftos.ml/API/Releases?showUnstable=true&showObsolete=false"));
+ }
+
+ public void OnSkinLoad()
+ {
+ ConstructHtml(CurrentMD);
+ }
+
+ public bool OnUnload()
+ {
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ ConstructHtml(CurrentMD);
+ }
+
+ public void SetupBuildUpdate(ShiftOS.Objects.Unite.Download download)
+ {
+ string devUpdate = "";
+ if (!string.IsNullOrEmpty(download.DevUpdateId))
+ {
+ devUpdate = $@"## Development update
+
+<iframe src=""http://youtube.com/embed/{download.DevUpdateId}"" allowfullscreen width=""720"" height=""480""></iframe>
+";
+ }
+
+ string screenshot = "";
+
+ if(!string.IsNullOrEmpty(download.ScreenshotUrl))
+ {
+ screenshot = $"<img src=\"http://getshiftos.ml{download.ScreenshotUrl}\" style=\"max-width:720px;width:auto;height:auto;\"/>";
+ }
+
+ lbupdatetitle.Text = download.Name;
+ string markdown = $@"**Built on {download.PostDate}**
+
+{devUpdate}
+
+{screenshot}
+
+## Changelog
+
+{download.Changelog}";
+
+ ConstructHtml(markdown);
+
+ pgdownload.Value = 0;
+ pgdownload.Text = "Waiting.";
+ btnaction.Text = "Update";
+ btnaction.Show();
+ OnActionButtonClick = () =>
+ {
+ pgdownload.Show();
+ var wc = new WebClient();
+ wc.DownloadProgressChanged += (o, a) =>
+ {
+ this.Invoke(new Action(() =>
+ {
+ pgdownload.Text = "Downloading " + download.Name + "...";
+ pgdownload.Value = a.ProgressPercentage;
+ }));
+ };
+
+ wc.DownloadDataCompleted += (o, a) =>
+ {
+ if (Directory.Exists("updater-work"))
+ Directory.Delete("updater-work", true);
+ Directory.CreateDirectory("updater-work");
+
+ string temp_guid = Guid.NewGuid().ToString();
+
+ File.WriteAllBytes($"{temp_guid}.zip", a.Result);
+
+ ZipFile.ExtractToDirectory($"{temp_guid}.zip", "updater-work");
+
+ File.Delete($"{temp_guid}.zip");
+
+ //Start the updater helper.
+ System.Diagnostics.Process.Start("ShiftOS.Updater.exe");
+
+ //Now we stop the engine.
+ TerminalBackend.InvokeCommand("sos.shutdown");
+
+ };
+
+ wc.DownloadDataAsync(new Uri($"http://getshiftos.ml{download.DownloadUrl}"));
+ };
+ }
+
+ public Action OnActionButtonClick = () => { };
+
+ public void ConstructHtml(string markdown)
+ {
+ CurrentMD = markdown;
+ var TerminalForeColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalForeColorCC);
+ var TerminalBackColor = ControlManager.ConvertColor(SkinEngine.LoadedSkin.TerminalBackColorCC);
+ string html = $@"<html>
+ <head>
+ <style>
+ body {{
+ background-color: rgb({LoadedSkin.ControlColor.R}, {LoadedSkin.ControlColor.G}, {LoadedSkin.ControlColor.B});
+ color: rgb({LoadedSkin.ControlTextColor.R}, {LoadedSkin.ControlTextColor.G}, {LoadedSkin.ControlTextColor.B});
+ font-family: ""{LoadedSkin.MainFont.Name}"";
+ font-size: {LoadedSkin.MainFont.SizeInPoints}pt;
+ }}
+
+ h1 {{
+ font-family: ""{LoadedSkin.HeaderFont.Name}"";
+ font-size: {LoadedSkin.HeaderFont.SizeInPoints}pt;
+ }}
+
+ h2 {{
+ font-family: ""{LoadedSkin.Header2Font.Name}"";
+ font-size: {LoadedSkin.Header2Font.SizeInPoints}pt;
+ }}
+
+ h3 {{
+ font-family: ""{LoadedSkin.Header3Font.Name}"";
+ font-size: {LoadedSkin.Header3Font.SizeInPoints}pt;
+ }}
+
+ pre, code {{
+ font-family: ""{LoadedSkin.TerminalFont.Name}"";
+ font-size: {LoadedSkin.TerminalFont.SizeInPoints}pt;
+ color: rgb({TerminalForeColor.R}, {TerminalForeColor.G}, {TerminalForeColor.B});
+ background-color: rgb({TerminalBackColor.R}, {TerminalBackColor.G}, {TerminalBackColor.B});
+ }}
+ </style>
+ </head>
+ <body>
+ <markdown/>
+ </body>
+</html>";
+
+ string body = CommonMark.CommonMarkConverter.Convert(markdown);
+
+ html = html.Replace("<markdown/>", body);
+ wbstatus.DocumentText = html;
+ }
+
+ public string CurrentMD = "";
+
+ private void btnclose_Click(object sender, EventArgs e)
+ {
+ AppearanceManager.Close(this);
+ }
+ }
+
+ public static class UpdateHelpers
+ {
+ /// <summary>
+ /// Grabs the build date from the assembly's PE header.
+ /// </summary>
+ /// <param name="assembly">The assembly to probe.</param>
+ /// <param name="target">The target timezone.</param>
+ /// <returns>The assembly's build date.</returns>
+ public static DateTime GetBuildDate(this Assembly assembly, TimeZoneInfo target = null)
+ {
+ var filePath = assembly.Location;
+ const int c_PeHeaderOffset = 60;
+ const int c_LinkerTimestampOffset = 8;
+
+ var buffer = new byte[2048];
+
+ using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read))
+ stream.Read(buffer, 0, 2048);
+
+ var offset = BitConverter.ToInt32(buffer, c_PeHeaderOffset);
+ var secondsSince1970 = BitConverter.ToInt32(buffer, offset + c_LinkerTimestampOffset);
+ var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
+
+ var linkTimeUtc = epoch.AddSeconds(secondsSince1970);
+
+ var tz = target ?? TimeZoneInfo.Local;
+ var localTime = TimeZoneInfo.ConvertTimeFromUtc(linkTimeUtc, tz);
+
+ return localTime;
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/UpdateManager.resx b/ShiftOS.WinForms/Applications/UpdateManager.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/UpdateManager.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs
new file mode 100644
index 0000000..1d93047
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.Designer.cs
@@ -0,0 +1,166 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class VideoPlayer
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(VideoPlayer));
+ this.toolStripContainer1 = new System.Windows.Forms.ToolStripContainer();
+ this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnplay = new System.Windows.Forms.Button();
+ this.pgplaytime = new ShiftOS.WinForms.Controls.ShiftedProgressBar();
+ this.menuStrip1 = new System.Windows.Forms.MenuStrip();
+ this.addSongToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.wpaudio = new AxWMPLib.AxWindowsMediaPlayer();
+ this.toolStripContainer1.ContentPanel.SuspendLayout();
+ this.toolStripContainer1.TopToolStripPanel.SuspendLayout();
+ this.toolStripContainer1.SuspendLayout();
+ this.flcontrols.SuspendLayout();
+ this.menuStrip1.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).BeginInit();
+ this.SuspendLayout();
+ //
+ // toolStripContainer1
+ //
+ //
+ // toolStripContainer1.ContentPanel
+ //
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.wpaudio);
+ this.toolStripContainer1.ContentPanel.Controls.Add(this.flcontrols);
+ this.toolStripContainer1.ContentPanel.Size = new System.Drawing.Size(805, 402);
+ this.toolStripContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.toolStripContainer1.LeftToolStripPanelVisible = false;
+ this.toolStripContainer1.Location = new System.Drawing.Point(0, 0);
+ this.toolStripContainer1.Name = "toolStripContainer1";
+ this.toolStripContainer1.RightToolStripPanelVisible = false;
+ this.toolStripContainer1.Size = new System.Drawing.Size(805, 426);
+ this.toolStripContainer1.TabIndex = 3;
+ this.toolStripContainer1.Text = "toolStripContainer1";
+ //
+ // toolStripContainer1.TopToolStripPanel
+ //
+ this.toolStripContainer1.TopToolStripPanel.Controls.Add(this.menuStrip1);
+ //
+ // flcontrols
+ //
+ this.flcontrols.AutoSize = true;
+ this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcontrols.Controls.Add(this.btnplay);
+ this.flcontrols.Controls.Add(this.pgplaytime);
+ this.flcontrols.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.flcontrols.Location = new System.Drawing.Point(0, 373);
+ this.flcontrols.Name = "flcontrols";
+ this.flcontrols.Size = new System.Drawing.Size(805, 29);
+ this.flcontrols.TabIndex = 0;
+ //
+ // btnplay
+ //
+ this.btnplay.AutoSize = true;
+ this.btnplay.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnplay.Location = new System.Drawing.Point(3, 3);
+ this.btnplay.Name = "btnplay";
+ this.btnplay.Size = new System.Drawing.Size(37, 23);
+ this.btnplay.TabIndex = 0;
+ this.btnplay.Text = "Play";
+ this.btnplay.UseVisualStyleBackColor = true;
+ this.btnplay.Click += new System.EventHandler(this.btnplay_Click);
+ //
+ // pgplaytime
+ //
+ this.pgplaytime.Location = new System.Drawing.Point(46, 3);
+ this.pgplaytime.Maximum = 100;
+ this.pgplaytime.Name = "pgplaytime";
+ this.pgplaytime.Size = new System.Drawing.Size(749, 23);
+ this.pgplaytime.TabIndex = 1;
+ this.pgplaytime.Tag = "keepbg";
+ this.pgplaytime.Text = "shiftedProgressBar1";
+ this.pgplaytime.Value = 0;
+ this.pgplaytime.MouseDown += new System.Windows.Forms.MouseEventHandler(this.startScrub);
+ this.pgplaytime.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseMove);
+ this.pgplaytime.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pgplaytime_MouseUp);
+ //
+ // menuStrip1
+ //
+ this.menuStrip1.Dock = System.Windows.Forms.DockStyle.None;
+ this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+ this.addSongToolStripMenuItem});
+ this.menuStrip1.Location = new System.Drawing.Point(0, 0);
+ this.menuStrip1.Name = "menuStrip1";
+ this.menuStrip1.Size = new System.Drawing.Size(805, 24);
+ this.menuStrip1.TabIndex = 0;
+ this.menuStrip1.Text = "menuStrip1";
+ //
+ // addSongToolStripMenuItem
+ //
+ this.addSongToolStripMenuItem.Name = "addSongToolStripMenuItem";
+ this.addSongToolStripMenuItem.Size = new System.Drawing.Size(81, 20);
+ this.addSongToolStripMenuItem.Text = "Open Video";
+ this.addSongToolStripMenuItem.Click += new System.EventHandler(this.addSongToolStripMenuItem_Click);
+ //
+ // wpaudio
+ //
+ this.wpaudio.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wpaudio.Enabled = true;
+ this.wpaudio.Location = new System.Drawing.Point(0, 0);
+ this.wpaudio.Name = "wpaudio";
+ this.wpaudio.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("wpaudio.OcxState")));
+ this.wpaudio.Size = new System.Drawing.Size(805, 373);
+ this.wpaudio.TabIndex = 2;
+ this.wpaudio.Visible = false;
+ //
+ // VideoPlayer
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.toolStripContainer1);
+ this.Name = "VideoPlayer";
+ this.Size = new System.Drawing.Size(805, 426);
+ this.toolStripContainer1.ContentPanel.ResumeLayout(false);
+ this.toolStripContainer1.ContentPanel.PerformLayout();
+ this.toolStripContainer1.TopToolStripPanel.ResumeLayout(false);
+ this.toolStripContainer1.TopToolStripPanel.PerformLayout();
+ this.toolStripContainer1.ResumeLayout(false);
+ this.toolStripContainer1.PerformLayout();
+ this.flcontrols.ResumeLayout(false);
+ this.flcontrols.PerformLayout();
+ this.menuStrip1.ResumeLayout(false);
+ this.menuStrip1.PerformLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.wpaudio)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ private System.Windows.Forms.ToolStripContainer toolStripContainer1;
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
+ private System.Windows.Forms.Button btnplay;
+ private Controls.ShiftedProgressBar pgplaytime;
+ private System.Windows.Forms.MenuStrip menuStrip1;
+ private System.Windows.Forms.ToolStripMenuItem addSongToolStripMenuItem;
+ private AxWMPLib.AxWindowsMediaPlayer wpaudio;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.cs b/ShiftOS.WinForms/Applications/VideoPlayer.cs
new file mode 100644
index 0000000..29c318f
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.cs
@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using System.IO;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [AppscapeEntry("Video Player", "Play .mp4 files or .wmv files as videos inside ShiftOS! Perfect for a shifted movie night.", 1524, 1000, "file_skimmer", "Entertainment")]
+ [DefaultTitle("Video Player")]
+ [Launcher("Video Player", false, null, "Entertainment")]
+ [WinOpen("video_player")]
+ public partial class VideoPlayer : UserControl, IShiftOSWindow
+ {
+ public VideoPlayer()
+ {
+ InitializeComponent();
+ }
+
+ public void OnLoad()
+ {
+ tmr.Interval = 50;
+ tmr.Tick += (o, a) =>
+ {
+ try
+ {
+ double end = wpaudio.currentMedia.duration;
+ double pos = wpaudio.Ctlcontrols.currentPosition;
+ pgplaytime.Maximum = (int)end;
+ pgplaytime.Value = (int)pos;
+ }
+ catch { }
+ };
+ tmr.Start();
+ }
+
+ public void OnSkinLoad()
+ {
+ wpaudio.uiMode = "none";
+ wpaudio.Show();
+ pgplaytime.Width = flcontrols.Width - btnplay.Width - 25;
+ wpaudio.enableContextMenu = false;
+ }
+
+ public bool OnUnload()
+ {
+ if(!string.IsNullOrWhiteSpace(filePath))
+ if (File.Exists(filePath))
+ File.Delete(filePath);
+ tmr.Stop();
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ Timer tmr = new Timer();
+
+ string filePath = null;
+
+ private void addSongToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".mp4", ".wmv" }, FileOpenerStyle.Open, (result) =>
+ {
+ var finf = ShiftOS.Objects.ShiftFS.Utils.GetFileInfo(result);
+ File.WriteAllBytes(finf.Name, ShiftOS.Objects.ShiftFS.Utils.ReadAllBytes(result));
+ filePath = finf.Name;
+ wpaudio.URL = filePath;
+ wpaudio.Ctlcontrols.play();
+ btnplay.Text = "Pause";
+ });
+ }
+
+ private void btnplay_Click(object sender, EventArgs e)
+ {
+ if(wpaudio.playState == WMPLib.WMPPlayState.wmppsPlaying)
+ {
+ wpaudio.Ctlcontrols.pause();
+ btnplay.Text = "Play";
+ }
+ else if(wpaudio.playState == WMPLib.WMPPlayState.wmppsPaused)
+ {
+ wpaudio.Ctlcontrols.play();
+ btnplay.Text = "Pause";
+ }
+ }
+
+ bool scrubbing = false;
+
+ private void startScrub(object sender, MouseEventArgs e)
+ {
+ scrubbing = true;
+ }
+
+ static public double linear(double x, double x0, double x1, double y0, double y1)
+ {
+ if ((x1 - x0) == 0)
+ {
+ return (y0 + y1) / 2;
+ }
+ return y0 + (x - x0) * (y1 - y0) / (x1 - x0);
+ }
+
+ private void pgplaytime_MouseMove(object sender, MouseEventArgs e)
+ {
+ if (wpaudio.playState == WMPLib.WMPPlayState.wmppsPlaying || wpaudio.playState == WMPLib.WMPPlayState.wmppsPaused)
+ try
+ {
+ if (scrubbing)
+ {
+ double end = wpaudio.currentMedia.duration;
+ double result = linear(e.X, 0, pgplaytime.Width, 0, end);
+ wpaudio.Ctlcontrols.currentPosition = result;
+ }
+ }
+ catch { }
+ }
+
+ private void pgplaytime_MouseUp(object sender, MouseEventArgs e)
+ {
+ scrubbing = false;
+ }
+
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/VideoPlayer.resx b/ShiftOS.WinForms/Applications/VideoPlayer.resx
new file mode 100644
index 0000000..d484b91
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/VideoPlayer.resx
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <data name="wpaudio.OcxState" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>
+ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
+ LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACFTeXN0
+ ZW0uV2luZG93cy5Gb3Jtcy5BeEhvc3QrU3RhdGUBAAAABERhdGEHAgIAAAAJAwAAAA8DAAAAtwAAAAIB
+ AAAAAQAAAAAAAAAAAAAAAKIAAAAAAwAACAAAAAAABQAAAAAAAADwPwMAAAAAAAUAAAAAAAAAAAAIAAIA
+ AAAAAAMAAQAAAAsA//8DAAAAAAALAP//CAACAAAAAAADADIAAAALAAAACAAKAAAAbgBvAG4AZQAAAAsA
+ AAALAAAACwD//wsA//8LAAAACAACAAAAAAAIAAIAAAAAAAgAAgAAAAAACAACAAAAAAALAAAAelIAAK4w
+ AAAL
+</value>
+ </data>
+ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs b/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs
new file mode 100644
index 0000000..6b7ae83
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WebBrowser.Designer.cs
@@ -0,0 +1,153 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class WebBrowser
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.flcontrols = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnback = new System.Windows.Forms.Button();
+ this.btnforward = new System.Windows.Forms.Button();
+ this.txturl = new System.Windows.Forms.TextBox();
+ this.btngo = new System.Windows.Forms.Button();
+ this.pnlcanvas = new System.Windows.Forms.Panel();
+ this.wbmain = new System.Windows.Forms.WebBrowser();
+ this.flcontrols.SuspendLayout();
+ this.pnlcanvas.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flcontrols
+ //
+ this.flcontrols.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcontrols.Controls.Add(this.btnback);
+ this.flcontrols.Controls.Add(this.btnforward);
+ this.flcontrols.Controls.Add(this.txturl);
+ this.flcontrols.Controls.Add(this.btngo);
+ this.flcontrols.Dock = System.Windows.Forms.DockStyle.Top;
+ this.flcontrols.Location = new System.Drawing.Point(0, 0);
+ this.flcontrols.Name = "flcontrols";
+ this.flcontrols.Size = new System.Drawing.Size(539, 29);
+ this.flcontrols.TabIndex = 2;
+ //
+ // btnback
+ //
+ this.btnback.AutoSize = true;
+ this.btnback.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnback.Location = new System.Drawing.Point(3, 3);
+ this.btnback.Name = "btnback";
+ this.btnback.Size = new System.Drawing.Size(23, 23);
+ this.btnback.TabIndex = 0;
+ this.btnback.Text = "<";
+ this.btnback.UseVisualStyleBackColor = true;
+ this.btnback.Click += new System.EventHandler(this.btnback_Click);
+ //
+ // btnforward
+ //
+ this.btnforward.AutoSize = true;
+ this.btnforward.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnforward.Location = new System.Drawing.Point(32, 3);
+ this.btnforward.Name = "btnforward";
+ this.btnforward.Size = new System.Drawing.Size(23, 23);
+ this.btnforward.TabIndex = 1;
+ this.btnforward.Text = ">";
+ this.btnforward.UseVisualStyleBackColor = true;
+ this.btnforward.Click += new System.EventHandler(this.btnforward_Click);
+ //
+ // txturl
+ //
+ this.txturl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txturl.Location = new System.Drawing.Point(61, 3);
+ this.txturl.Name = "txturl";
+ this.txturl.Size = new System.Drawing.Size(435, 20);
+ this.txturl.TabIndex = 2;
+ this.txturl.WordWrap = false;
+ this.txturl.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txturl_KeyDown);
+ //
+ // btngo
+ //
+ this.btngo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btngo.AutoSize = true;
+ this.btngo.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btngo.Location = new System.Drawing.Point(502, 3);
+ this.btngo.Name = "btngo";
+ this.btngo.Size = new System.Drawing.Size(31, 23);
+ this.btngo.TabIndex = 3;
+ this.btngo.Text = "Go";
+ this.btngo.UseVisualStyleBackColor = true;
+ this.btngo.Click += new System.EventHandler(this.btngo_Click);
+ //
+ // pnlcanvas
+ //
+ this.pnlcanvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+ this.pnlcanvas.Controls.Add(this.wbmain);
+ this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pnlcanvas.Location = new System.Drawing.Point(0, 29);
+ this.pnlcanvas.Name = "pnlcanvas";
+ this.pnlcanvas.Size = new System.Drawing.Size(539, 374);
+ this.pnlcanvas.TabIndex = 3;
+ //
+ // wbmain
+ //
+ this.wbmain.AllowWebBrowserDrop = false;
+ this.wbmain.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.wbmain.IsWebBrowserContextMenuEnabled = false;
+ this.wbmain.Location = new System.Drawing.Point(0, 0);
+ this.wbmain.MinimumSize = new System.Drawing.Size(20, 20);
+ this.wbmain.Name = "wbmain";
+ this.wbmain.ScriptErrorsSuppressed = true;
+ this.wbmain.Size = new System.Drawing.Size(537, 372);
+ this.wbmain.TabIndex = 0;
+ this.wbmain.WebBrowserShortcutsEnabled = false;
+ this.wbmain.Navigated += new System.Windows.Forms.WebBrowserNavigatedEventHandler(this.wbmain_Navigated);
+ this.wbmain.NewWindow += new System.ComponentModel.CancelEventHandler(this.wbmain_NewWindow);
+ //
+ // WebBrowser
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.pnlcanvas);
+ this.Controls.Add(this.flcontrols);
+ this.Name = "WebBrowser";
+ this.Size = new System.Drawing.Size(539, 403);
+ this.flcontrols.ResumeLayout(false);
+ this.flcontrols.PerformLayout();
+ this.pnlcanvas.ResumeLayout(false);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flcontrols;
+ private System.Windows.Forms.Button btnback;
+ private System.Windows.Forms.Button btnforward;
+ private System.Windows.Forms.TextBox txturl;
+ private System.Windows.Forms.Button btngo;
+ private System.Windows.Forms.Panel pnlcanvas;
+ private System.Windows.Forms.WebBrowser wbmain;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/WebBrowser.cs b/ShiftOS.WinForms/Applications/WebBrowser.cs
new file mode 100644
index 0000000..751e7e2
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WebBrowser.cs
@@ -0,0 +1,97 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [WinOpen("web_browser")]
+ [AppscapeEntry("Web Browser", "We're going surfing on the Internet! This application allows you to break the bounds of the Digital Society and connect to the outer Internet inside ShiftOS.",
+ 4096, 10000, "color_depth_24_bits", "Networking")]
+ [Launcher("Web Browser", false, null, "Networking")]
+ [DefaultTitle("Web Browser")]
+ [DefaultIcon("iconShiftnet")]
+ public partial class WebBrowser : UserControl, IShiftOSWindow
+ {
+ public WebBrowser()
+ {
+ InitializeComponent();
+ uiupdate = new Timer();
+ uiupdate.Tick += (o, a) =>
+ {
+ btnback.Location = new Point(2, 2);
+ btnforward.Location = new Point(btnback.Left + btnback.Width + 2, 2);
+ txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2);
+ txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width * 2) - 2;
+ btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2);
+ btnback.Enabled = wbmain.CanGoBack;
+ btnforward.Enabled = wbmain.CanGoForward;
+ };
+ uiupdate.Interval = 100;
+ }
+
+ Timer uiupdate = null;
+
+ public void OnLoad()
+ {
+ uiupdate.Start();
+ wbmain.Url = new Uri("http://getshiftos.ml/");
+ }
+
+ public void OnSkinLoad()
+ {
+ }
+
+ public bool OnUnload()
+ {
+ uiupdate.Stop();
+ return true;
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ private void btnback_Click(object sender, EventArgs e)
+ {
+ wbmain.GoBack();
+ }
+
+ private void btnforward_Click(object sender, EventArgs e)
+ {
+ wbmain.GoForward();
+ }
+
+ private void btngo_Click(object sender, EventArgs e)
+ {
+ wbmain.Navigate(txturl.Text);
+ }
+
+ private void wbmain_NewWindow(object sender, CancelEventArgs e)
+ {
+ e.Cancel = true;
+ if (Shiftorium.UpgradeInstalled("web_browser_new_window"))
+ {
+ AppearanceManager.SetupWindow(new WebBrowser());
+ }
+ }
+
+ private void txturl_KeyDown(object sender, KeyEventArgs e)
+ {
+ if (e.KeyCode == Keys.Enter)
+ btngo_Click(sender, EventArgs.Empty);
+ }
+
+ private void wbmain_Navigated(object sender, WebBrowserNavigatedEventArgs e)
+ {
+ txturl.Text = wbmain.Url.ToString();
+ AppearanceManager.SetWindowTitle(this, wbmain.DocumentTitle + " - " + NameChangerBackend.GetNameRaw(this.GetType()));
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/WebBrowser.resx b/ShiftOS.WinForms/Applications/WebBrowser.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WebBrowser.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
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
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ 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..b22d4c2
--- /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")]
+ [StpContents("Desktop Widgets", "SuperDesk Inc.", "desktop;wm_free_placement;shifter")]
+ public partial class WidgetManagerFrontend : UserControl, IShiftOSWindow
+ {
+ public WidgetManagerFrontend()
+ {
+ InitializeComponent();
+ }
+
+ Dictionary<string, WidgetDetails> temp_details = null;
+
+ public void SetupUI()
+ {
+ flbody.Controls.Clear();
+ if(temp_details == null)
+ temp_details = new Dictionary<string, WinForms.WidgetDetails>();
+ 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<Dictionary<string, WidgetDetails>>(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 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file