diff options
Diffstat (limited to 'source/WindowsFormsApplication1/Controls')
42 files changed, 5183 insertions, 0 deletions
diff --git a/source/WindowsFormsApplication1/Controls/Computer.Designer.cs b/source/WindowsFormsApplication1/Controls/Computer.Designer.cs new file mode 100644 index 0000000..4157592 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Computer.Designer.cs @@ -0,0 +1,66 @@ +namespace ShiftOS +{ + partial class Computer + { + /// <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(this.HealthTimer != null) + { + this.HealthTimer.Stop(); + } + 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.lbstats = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbstats + // + this.lbstats.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbstats.ForeColor = System.Drawing.Color.Black; + this.lbstats.Location = new System.Drawing.Point(0, 0); + this.lbstats.Name = "lbstats"; + this.lbstats.Size = new System.Drawing.Size(64, 64); + this.lbstats.TabIndex = 0; + this.lbstats.Text = "HP: 100"; + this.lbstats.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lbstats.Click += new System.EventHandler(this.lbstats_Click); + // + // Computer + // + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; + this.BackColor = System.Drawing.Color.White; + this.Controls.Add(this.lbstats); + this.Name = "Computer"; + this.Size = new System.Drawing.Size(64, 64); + this.Load += new System.EventHandler(this.Computer_Load); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label lbstats; + } +} diff --git a/source/WindowsFormsApplication1/Controls/Computer.cs b/source/WindowsFormsApplication1/Controls/Computer.cs new file mode 100644 index 0000000..8f849d3 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Computer.cs @@ -0,0 +1,492 @@ +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 +{ + public partial class Computer : UserControl + { + public int TotalHP = 100; + + public Computer() + { + InitializeComponent(); + } + + int _HP = 100; + + public void Repair(int hp) + { + this._HP += hp; + var h = OnRepair; + if(h != null) + { + h(this, new EventArgs()); + } + } + + public event EventHandler OnRepair; + + public int HP + { + get + { + return _HP; + } + set + { + _HP = value; + } + } + + + public SystemType Type + { + get; set; + } + + + List<Connection> _Connections = null; + + + public Connection[] Connections { + get + { + return + _Connections.ToArray(); + + } + } + + public bool Enemy { get; set; } + public Computer EnemyComputer { get; set; } + + public int GetDamageRate() + { + switch(Grade) + { + case 1: + return 1; + case 2: + return 2; + case 3: + return 4; + case 4: + return 8; + default: + return 1; + } + } + + public int GetChance() + { + switch (Grade) + { + case 1: + return 200; + case 2: + return 150; + case 3: + return 100; + case 4: + return 50; + default: + return 200; + } + } + + public AttackType GetProperType() + { + switch(Type) + { + case SystemType.DedicatedDDoS: + return AttackType.DDoS; + case SystemType.Core: + return AttackType.Core; + case SystemType.Turret: + return AttackType.Virus; + default: + return AttackType.None; + } + } + + public List<Computer> Enemies = null; + + public void LaunchAttack(AttackType type) + { + var rnd = new Random(); + switch (type) + { + case AttackType.Virus: + int chance = rnd.Next(1, 10); + if(chance == 5) + { + int rate = 1; + Deteriorate(rate); + } + break; + case AttackType.DDoS: + int cmax = GetChance(); + int c = rnd.Next(0, cmax); + if(c == 50) + { + this.Disable(); + } + break; + } + } + + public void LaunchAttack(AttackType type, int rate) + { + switch (type) + { + case AttackType.Virus: + var rnd = new Random(); + int chance = rnd.Next(1, 10); + if (chance == 5) + { + Deteriorate(rate); + } + break; + case AttackType.Core: + LaunchAttack(AttackType.Virus); //Small virus attack as last resort. + break; + default: + LaunchAttack(type); + break; + } + } + + public string Hostname { get; set; } + + public event EventHandler HP_Decreased; + + public void Deteriorate(int amount) + { + if (amount == 1 && DamageDefector > 1) + { + + } + else { + this._HP -= amount / DamageDefector; + EventHandler handler = HP_Decreased; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + } + + public bool Disabled = false; + + public void Disable() + { + var t = new Timer(); + t.Interval = 1000; + int i = 0; + t.Tick += (object s, EventArgs a) => + { + if(i == 5) + { + Disabled = false; + this.BackColor = Color.White; + t.Stop(); + } + else + { + Disabled = true; + this.BackColor = Color.Gray; + } + i += 1; + }; + t.Start(); + } + + public void Flash(Label l) + { + int i = 100; + var t = new Timer(); + int p = 0; + t.Interval = i; + t.Tick += (object s, EventArgs a) => + { + if (p == 10) + { + t.Stop(); + this.BackColor = Color.White; + l.Hide(); + } + else { + if (this.BackColor == Color.White) + { + this.BackColor = Color.Black; + } + else + { + this.BackColor = Color.White; + } + } + p += 1; + }; + t.Start(); + } + public event EventHandler AntivirusRepair; + + public event EventHandler OnAIAttack; + + public void ThrowEnemyAttack() + { + var h = OnAIAttack; + if(h != null) + { + h(this, new EventArgs()); + } + } + + public int Grade { get; set; } + + public Rectangle GetAreaOfEffect() + { + int r = 50; + switch(Grade) + { + case 1: + r = 50; + break; + case 2: + r = 100; + break; + case 3: + r = 150; + break; + case 4: + r = 200; + break; + } + return new Rectangle(this.Left - r, this.Top - r, this.Width + (r * 2), this.Height + (r * 2)); + + } + + public int DamageDefector = 1; + + public int GetTotal() + { + switch (Type) + { + case SystemType.Core: + return 100; + default: + switch (Grade) + { + case 1: + return 10; + case 2: + return 20; + case 3: + return 40; + case 4: + return 80; + default: + return 10; + } + } + } + + public Timer HealthTimer = null; + + public bool AlreadyEnslaved = false; + public bool Enslaved = false; + + public event EventHandler EnslavedModule; + + + public event EventHandler MassDDoS; + + private void Computer_Load(object sender, EventArgs e) + { + Enemies = new List<Computer>(); + var t = new Timer(); + t.Interval = 100; + t.Tick += (object s, EventArgs a) => + { + if (this.HP > 0) + { + lbstats.Text = $"HP: {_HP}"; + if(!Enemy) + { + foreach(var m in Hacking.MyNetwork) + { + if(m.Hostname == Hostname) + { + m.HP = _HP; + } + } + } + switch (Type) + { + case SystemType.Core: + this.Size = new Size(64, 64); + try + { + this.Location = new Point( + (this.Parent.Width - this.Width) / 2, + (this.Parent.Height - this.Height) / 2 + ); + } + catch + { + + } + break; + case SystemType.RepairModule: + case SystemType.Antivirus: + var r = new Random(); + int i = r.Next(0, 20); + if (i == 10) + { + EventHandler handler = AntivirusRepair; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + this.Size = new Size(32, 32); + break; + case SystemType.ModuleStealer: + var rnd = new Random(); + int num = rnd.Next(0, 2500 / Grade); + if(num == 25) + { + StolenModule?.Invoke(this, new EventArgs()); + } + break; + case SystemType.Enslaver: + if (AlreadyEnslaved == false) + { + var ernd = new Random(); + int num2 = ernd.Next(0, 2500 / Grade); + if (num2 == 25) + { + AlreadyEnslaved = true; + EnslavedModule?.Invoke(this, new EventArgs()); + } + } + break; + case SystemType.ServerStack: + var r2 = new Random(); + int i2 = r2.Next(0, GetChance()); + if (i2 == GetChance() / 2) + { + EventHandler handler = this.MassDDoS; + if (handler != null) + { + handler(this, new EventArgs()); + } + } + this.Size = new Size(48, 48); + break; + default: + this.Size = new Size(32, 32); + break; + } + if (Disabled == false) + { + if (API.Upgrades["limitlesscustomshades"] == true) + { + if(_HP > TotalHP / 2) + { + this.BackColor = Color.Green; + lbstats.ForeColor = Color.Black; + } + else + { + if(_HP > TotalHP / 3) + { + this.BackColor = Color.Orange; + lbstats.ForeColor = Color.Black; + } + else + { + this.BackColor = Color.Red; + lbstats.ForeColor = Color.White; + } + } + } + if (Enemy == true) + { + var rnd = new Random(); + int chance = rnd.Next(0, 100); + if (chance == 50) + { + ThrowEnemyAttack(); + } + } + } + } + else + { + t.Stop(); + this.Visible = false; + ThrowDestroyed(); + } + }; + t.Start(); + HealthTimer = t; + } + + public event EventHandler StolenModule; + + public event EventHandler OnDestruction; + + public void ThrowDestroyed() + { + var h = OnDestruction; + if(h != null) + { + h(this, new EventArgs()); + } + } + + public event EventHandler Select; + + private void lbstats_Click(object sender, EventArgs e) + { + var h = this.Select; + if(h != null) + { + h(this, e); + } + } + } + + public enum SystemType + { + Core = 0, + Antivirus = 1, + DedicatedDDoS = 2, + Turret = 3, + FTPServer = 4, + Firewall = 5, + ServerStack = 6, + Enslaver = 7, + RepairModule = 9, + ModuleStealer = 8, + } + + public enum AttackType { + Virus, + DDoS, + Worm, + Spazzer, + Backdoor, + None, + Core, + } + +} diff --git a/source/WindowsFormsApplication1/Controls/Computer.resx b/source/WindowsFormsApplication1/Controls/Computer.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Computer.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/source/WindowsFormsApplication1/Controls/Connection.Designer.cs b/source/WindowsFormsApplication1/Controls/Connection.Designer.cs new file mode 100644 index 0000000..071ff4a --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Connection.Designer.cs @@ -0,0 +1,45 @@ +namespace ShiftOS +{ + partial class Connection + { + /// <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.SuspendLayout(); + // + // Connection + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "Connection"; + this.Size = new System.Drawing.Size(150, 10); + this.ResumeLayout(false); + + } + + #endregion + } +} diff --git a/source/WindowsFormsApplication1/Controls/Connection.cs b/source/WindowsFormsApplication1/Controls/Connection.cs new file mode 100644 index 0000000..b322581 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Connection.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS +{ + public partial class Connection : UserControl + { + public Connection() + { + InitializeComponent(); + } + + Computer conleft; + Computer conright; + + public Computer ConnectionLeft + { + get + { + return conleft; + } + } + + public Computer ConnectionRight + { + get + { + return conright; + } + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/Connection.resx b/source/WindowsFormsApplication1/Controls/Connection.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Connection.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/source/WindowsFormsApplication1/Controls/DesktopIcon.Designer.cs b/source/WindowsFormsApplication1/Controls/DesktopIcon.Designer.cs new file mode 100644 index 0000000..98369ab --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/DesktopIcon.Designer.cs @@ -0,0 +1,78 @@ +namespace ShiftOS +{ + partial class DesktopIcon + { + /// <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.pbicon = new System.Windows.Forms.PictureBox(); + this.lbiconname = new System.Windows.Forms.Label(); + ((System.ComponentModel.ISupportInitialize)(this.pbicon)).BeginInit(); + this.SuspendLayout(); + // + // pbicon + // + this.pbicon.Location = new System.Drawing.Point(4, 4); + this.pbicon.Name = "pbicon"; + this.pbicon.Size = new System.Drawing.Size(78, 50); + this.pbicon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pbicon.TabIndex = 0; + this.pbicon.TabStop = false; + this.pbicon.DoubleClick += new System.EventHandler(this.Icon_Click); + // + // lbiconname + // + this.lbiconname.AutoEllipsis = true; + this.lbiconname.ForeColor = System.Drawing.Color.White; + this.lbiconname.Location = new System.Drawing.Point(4, 61); + this.lbiconname.Name = "lbiconname"; + this.lbiconname.Size = new System.Drawing.Size(78, 23); + this.lbiconname.TabIndex = 1; + this.lbiconname.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.lbiconname.DoubleClick += new System.EventHandler(this.Icon_Click); + // + // DesktopIcon + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Transparent; + this.Controls.Add(this.lbiconname); + this.Controls.Add(this.pbicon); + this.Name = "DesktopIcon"; + this.Size = new System.Drawing.Size(85, 85); + this.Load += new System.EventHandler(this.DesktopIcon_Load); + this.DoubleClick += new System.EventHandler(this.Icon_Click); + ((System.ComponentModel.ISupportInitialize)(this.pbicon)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.PictureBox pbicon; + private System.Windows.Forms.Label lbiconname; + } +} diff --git a/source/WindowsFormsApplication1/Controls/DesktopIcon.cs b/source/WindowsFormsApplication1/Controls/DesktopIcon.cs new file mode 100644 index 0000000..bfb0940 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/DesktopIcon.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; + +namespace ShiftOS +{ + public partial class DesktopIcon : UserControl + { + /// <summary> + /// User control for a desktop icon. + /// </summary> + public DesktopIcon() + { + InitializeComponent(); + } + + public string IconName + { + set + { + lbiconname.Text = value; + } + get + { + return lbiconname.Text; + } + } + + public Image Icon + { + set + { + pbicon.Image = value; + } + get + { + return pbicon.Image; + } + } + + //public string LuaAction { get; set; } + public string LuaAction = "open_program(\"shiftorium\")"; + private void Icon_Click(object sender, EventArgs e) + { + if (File.Exists(Paths.Desktop + IconName)) + { + var fs = new File_Skimmer(); + fs.OpenFile(Paths.Desktop + IconName); + } + else + { + var li = new LuaInterpreter(); + li.mod(LuaAction); + lbiconname.BackColor = Color.White; + t.Start(); + } + } + + public Timer t = new Timer(); + + + private void DesktopIcon_Load(object sender, EventArgs e) + { + t.Interval = 5000; + t.Tick += (object s, EventArgs a) => + { + lbiconname.BackColor = Color.Transparent; + }; + var st = new Timer(); + st.Interval = 200; + st.Tick += (object s, EventArgs a) => { + lbiconname.ForeColor = API.CurrentSkin.IconTextColor; + }; + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/DesktopIcon.resx b/source/WindowsFormsApplication1/Controls/DesktopIcon.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/DesktopIcon.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/source/WindowsFormsApplication1/Controls/IconControl.Designer.cs b/source/WindowsFormsApplication1/Controls/IconControl.Designer.cs new file mode 100644 index 0000000..b86f908 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/IconControl.Designer.cs @@ -0,0 +1,92 @@ +namespace ShiftOS +{ + partial class IconControl + { + /// <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.panel1 = new System.Windows.Forms.Panel(); + this.pblarge = new System.Windows.Forms.PictureBox(); + this.lbname = new System.Windows.Forms.Label(); + this.panel1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pblarge)).BeginInit(); + this.SuspendLayout(); + // + // panel1 + // + this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.panel1.Controls.Add(this.pblarge); + this.panel1.Controls.Add(this.lbname); + 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(171, 56); + this.panel1.TabIndex = 0; + // + // pblarge + // + this.pblarge.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pblarge.Location = new System.Drawing.Point(135, 3); + this.pblarge.Name = "pblarge"; + this.pblarge.Size = new System.Drawing.Size(32, 32); + this.pblarge.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage; + this.pblarge.TabIndex = 2; + this.pblarge.TabStop = false; + this.pblarge.Click += new System.EventHandler(this.pblarge_Click); + // + // lbname + // + this.lbname.Cursor = System.Windows.Forms.Cursors.IBeam; + this.lbname.Dock = System.Windows.Forms.DockStyle.Left; + this.lbname.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.lbname.Location = new System.Drawing.Point(0, 0); + this.lbname.Name = "lbname"; + this.lbname.Size = new System.Drawing.Size(154, 54); + this.lbname.TabIndex = 0; + this.lbname.Text = "Icon Name"; + this.lbname.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // IconControl + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.panel1); + this.Name = "IconControl"; + this.Size = new System.Drawing.Size(171, 56); + this.Load += new System.EventHandler(this.IconControl_Load); + this.panel1.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.pblarge)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Label lbname; + private System.Windows.Forms.PictureBox pblarge; + } +} diff --git a/source/WindowsFormsApplication1/Controls/IconControl.cs b/source/WindowsFormsApplication1/Controls/IconControl.cs new file mode 100644 index 0000000..e103ced --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/IconControl.cs @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.Drawing.Imaging; +using Newtonsoft.Json; +using System.IO; + +namespace ShiftOS +{ + public partial class IconControl : UserControl + { + public IconControl() + { + InitializeComponent(); + } + + private void IconControl_Load(object sender, EventArgs e) + { + pblarge.Top = (this.Height - pblarge.Height) / 2; + } + + + + public Image LargeImage + { + get + { + return pblarge.Image; + } + set + { + pblarge.Image = value; + } + } + + public string IconName + { + get + { + return lbname.Text; + + } + set + { + lbname.Text = value; + } + } + + private void pblarge_Click(object sender, EventArgs e) + { + API.CreateGraphicPickerSession($"Icon - {IconName}", false); + API.GraphicPickerSession.FormClosing += (object s, FormClosingEventArgs a) => + { + if(API.GraphicPickerSession.IdleImage != null) + { + LargeImage = API.GraphicPickerSession.IdleImage; + } + }; + } + } + + +} diff --git a/source/WindowsFormsApplication1/Controls/IconControl.resx b/source/WindowsFormsApplication1/Controls/IconControl.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/IconControl.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/source/WindowsFormsApplication1/Controls/ImageSelector.Designer.cs b/source/WindowsFormsApplication1/Controls/ImageSelector.Designer.cs new file mode 100644 index 0000000..7340ceb --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ImageSelector.Designer.cs @@ -0,0 +1,76 @@ +namespace ShiftOS +{ + partial class ImageSelector + { + /// <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.label1 = new System.Windows.Forms.Label(); + this.btnselect = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.BackColor = System.Drawing.Color.White; + this.label1.Dock = System.Windows.Forms.DockStyle.Left; + this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); + this.label1.ForeColor = System.Drawing.Color.Black; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(186, 33); + this.label1.TabIndex = 0; + this.label1.Text = "Image:"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // btnselect + // + this.btnselect.Dock = System.Windows.Forms.DockStyle.Fill; + this.btnselect.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnselect.Location = new System.Drawing.Point(186, 0); + this.btnselect.Name = "btnselect"; + this.btnselect.Size = new System.Drawing.Size(40, 33); + this.btnselect.TabIndex = 1; + this.btnselect.UseVisualStyleBackColor = true; + this.btnselect.Click += new System.EventHandler(this.btnselect_Click); + // + // ImageSelector + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.btnselect); + this.Controls.Add(this.label1); + this.Name = "ImageSelector"; + this.Size = new System.Drawing.Size(226, 33); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Button btnselect; + } +} diff --git a/source/WindowsFormsApplication1/Controls/ImageSelector.cs b/source/WindowsFormsApplication1/Controls/ImageSelector.cs new file mode 100644 index 0000000..b1aa4d2 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ImageSelector.cs @@ -0,0 +1,55 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using System.IO; + +namespace ShiftOS +{ + public partial class ImageSelector : UserControl + { + public ImageSelector() + { + InitializeComponent(); + } + + public Image Image + { + get + { + return btnselect.BackgroundImage; + } + } + + private string _ImagePath = null; + + public string ImagePath + { + get + { + return _ImagePath; + } + } + + private void btnselect_Click(object sender, EventArgs e) + { + API.CreateFileSkimmerSession(".pic;.png;.jpg;.bmp", File_Skimmer.FileSkimmerMode.Open); + API.FileSkimmerSession.FormClosing += (object s, FormClosingEventArgs a) => + { + var res = API.GetFSResult(); + if(res != "fail") + { + var finf = new FileInfo(res); + _ImagePath = finf.Name; + btnselect.BackgroundImage = Image.FromFile(res); + btnselect.BackgroundImageLayout = ImageLayout.Center; + } + }; + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/ImageSelector.resx b/source/WindowsFormsApplication1/Controls/ImageSelector.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ImageSelector.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/source/WindowsFormsApplication1/Controls/NetModuleStatus.Designer.cs b/source/WindowsFormsApplication1/Controls/NetModuleStatus.Designer.cs new file mode 100644 index 0000000..31608d4 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/NetModuleStatus.Designer.cs @@ -0,0 +1,84 @@ +namespace ShiftOS +{ + partial class NetModuleStatus + { + /// <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.lbinfo = new System.Windows.Forms.Label(); + this.pghealth = new ShiftOS.ProgressBarEX(); + this.SuspendLayout(); + // + // lbinfo + // + this.lbinfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left))); + this.lbinfo.Location = new System.Drawing.Point(4, 4); + this.lbinfo.Name = "lbinfo"; + this.lbinfo.Size = new System.Drawing.Size(102, 22); + this.lbinfo.TabIndex = 1; + this.lbinfo.Text = "label1"; + // + // pghealth + // + this.pghealth.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.pghealth.BackColor = System.Drawing.Color.Black; + this.pghealth.BlockSeparation = 3; + this.pghealth.BlockWidth = 5; + this.pghealth.Color = System.Drawing.Color.Gray; + this.pghealth.ForeColor = System.Drawing.Color.White; + this.pghealth.Location = new System.Drawing.Point(112, 4); + this.pghealth.MaxValue = 100; + this.pghealth.MinValue = 0; + this.pghealth.Name = "pghealth"; + this.pghealth.Orientation = ShiftOS.ProgressBarEX.ProgressBarOrientation.Horizontal; + this.pghealth.ShowValue = true; + this.pghealth.Size = new System.Drawing.Size(227, 22); + this.pghealth.Step = 10; + this.pghealth.Style = ShiftOS.ProgressBarEX.ProgressBarExStyle.Continuous; + this.pghealth.TabIndex = 0; + this.pghealth.Value = 0; + // + // NetModuleStatus + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lbinfo); + this.Controls.Add(this.pghealth); + this.Name = "NetModuleStatus"; + this.Size = new System.Drawing.Size(352, 26); + this.ResumeLayout(false); + + } + + #endregion + + private ProgressBarEX pghealth; + private System.Windows.Forms.Label lbinfo; + } +} diff --git a/source/WindowsFormsApplication1/Controls/NetModuleStatus.cs b/source/WindowsFormsApplication1/Controls/NetModuleStatus.cs new file mode 100644 index 0000000..037f73a --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/NetModuleStatus.cs @@ -0,0 +1,46 @@ +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 +{ + public partial class NetModuleStatus : UserControl + { + private Module _module = null; + + public NetModuleStatus(Module m) + { + _module = m; + InitializeComponent(); + var t = new Timer(); + t.Tick += (object s, EventArgs a) => + { + lbinfo.Text = _module.Hostname; + pghealth.MaxValue = _module.GetTotalHP(); + pghealth.Value = _module.HP; + if(_module.HP == _module.GetTotalHP()) + { + if(this.Visible == true) + { + this.Hide(); + } + } + else + { + if(this.Visible == false) + { + this.Show(); + } + } + }; + t.Interval = 100; + t.Start(); + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/NetModuleStatus.resx b/source/WindowsFormsApplication1/Controls/NetModuleStatus.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/NetModuleStatus.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/source/WindowsFormsApplication1/Controls/Notification.Designer.cs b/source/WindowsFormsApplication1/Controls/Notification.Designer.cs new file mode 100644 index 0000000..57b6416 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Notification.Designer.cs @@ -0,0 +1,78 @@ +namespace ShiftOS +{ + partial class Notification + { + /// <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.lbmessage = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // lbtitle + // + this.lbtitle.AutoSize = true; + this.lbtitle.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F); + this.lbtitle.Location = new System.Drawing.Point(3, 9); + this.lbtitle.Name = "lbtitle"; + this.lbtitle.Size = new System.Drawing.Size(135, 20); + this.lbtitle.TabIndex = 0; + this.lbtitle.Text = "Package Installed"; + // + // lbmessage + // + this.lbmessage.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.lbmessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F); + this.lbmessage.Location = new System.Drawing.Point(7, 33); + this.lbmessage.Name = "lbmessage"; + this.lbmessage.Size = new System.Drawing.Size(345, 67); + this.lbmessage.TabIndex = 1; + this.lbmessage.Text = "The package \"shiftnet\" has been successfully installed."; + // + // Notification + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.BackColor = System.Drawing.Color.Gray; + this.Controls.Add(this.lbmessage); + this.Controls.Add(this.lbtitle); + this.ForeColor = System.Drawing.Color.White; + this.Name = "Notification"; + this.Size = new System.Drawing.Size(355, 100); + this.Load += new System.EventHandler(this.Notification_Load); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label lbtitle; + private System.Windows.Forms.Label lbmessage; + } +} diff --git a/source/WindowsFormsApplication1/Controls/Notification.cs b/source/WindowsFormsApplication1/Controls/Notification.cs new file mode 100644 index 0000000..b5e1693 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Notification.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace ShiftOS +{ + public partial class Notification : UserControl + { + public Notification(string title, string text) + { + InitializeComponent(); + Title = title; + Message = text; + var t = new Timer(); + t.Interval = 5000; + t.Tick += (object s, EventArgs a) => + { + this.Dispose(); + }; + t.Start(); + } + + public string Title { get; set; } + public string Message { get; set; } + + private void Notification_Load(object sender, EventArgs e) + { + API.PlaySound(Properties.Resources.rolldown); + lbtitle.Text = Title; + lbmessage.Text = Message; + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/Notification.resx b/source/WindowsFormsApplication1/Controls/Notification.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/Notification.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/source/WindowsFormsApplication1/Controls/ProgressBarEX.Designer.cs b/source/WindowsFormsApplication1/Controls/ProgressBarEX.Designer.cs new file mode 100644 index 0000000..219fb73 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.Designer.cs @@ -0,0 +1,37 @@ +namespace ShiftOS +{ + partial class ProgressBarEX + { + /// <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); + } + + private void InitializeComponent() + { + this.SuspendLayout(); + // + // ProgressBarEX + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Name = "ProgressBarEX"; + this.Size = new System.Drawing.Size(340, 32); + this.ResumeLayout(false); + + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs new file mode 100644 index 0000000..0e64aad --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.cs @@ -0,0 +1,340 @@ +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 +{ + public partial class ProgressBarEX : UserControl + { + public ProgressBarEX() + { + InitializeComponent(); + } + + #region " Properties " + + private string _label = "Progress:"; + private bool show_label = false; + + public string Label + { + get + { + return _label; + } + set + { + _label = value; + this.Invalidate(); + } + } + + public bool ShowLabel + { + get + { + return show_label; + } + set + { + show_label = value; + this.Invalidate(); + } + } + + + private int _Value = 0; + public int Value + { + get { return _Value; } + set + { + if (value >= this.MinValue & value <= this.MaxValue) + { + _Value = value; + this.Invalidate(); + } + else { + throw new ArgumentOutOfRangeException("The value must be between the minimum and maximum values."); + } + } + } + + private int _Step = 10; + public int Step + { + get { return _Step; } + set { _Step = value; } + } + + private ProgressBarOrientation _Orientation; + public ProgressBarOrientation Orientation + { + get { return _Orientation; } + set { _Orientation = value; } + } + + private int _MinValue = 0; + public int MinValue + { + get { return _MinValue; } + set + { + if (value < this.MaxValue) + { + _MinValue = value; + } + else { + throw new ArgumentOutOfRangeException("The minimum value must be less than the maximum value."); + } + } + } + + private int _MaxValue = 100; + public int MaxValue + { + get { return _MaxValue; } + set + { + if (value > this.MinValue) + { + _MaxValue = value; + } + else { + throw new ArgumentOutOfRangeException("The maximum value must be more than the minimum value."); + } + } + } + + private Color _Color = Color.Lime; + public Color Color + { + get { return _Color; } + set { _Color = value; } + } + + private bool _ShowValue = true; + public bool ShowValue + { + get { return _ShowValue; } + set { _ShowValue = value; } + } + + private ProgressBarExStyle _Style; + public ProgressBarExStyle Style + { + get { return _Style; } + set { _Style = value; } + } + + private int _BlockWidth = 5; + public int BlockWidth + { + get { return _BlockWidth; } + set { _BlockWidth = value; } + } + + private int _BlockSeparation = 3; + public int BlockSeparation + { + get { return _BlockSeparation; } + set { _BlockSeparation = value; } + } + +#endregion + +#region " Enums, Variables " + + public enum ProgressBarOrientation + { + Horizontal = 0, + Vertical = 1 + } + + public enum ProgressBarExStyle + { + Blocks = 0, + Continuous = 1, + Marquee = 2 + } + +#endregion + +#region " Events " + + public event PaintBackgroundEventHandler PaintBackground; + public delegate void PaintBackgroundEventHandler(object sender, PaintEventArgs e); + public event PaintProcessEventHandler PaintProcess; + public delegate void PaintProcessEventHandler(object sender, ProgressBarProcessPaintEventArgs e); + + public class ProgressBarProcessPaintEventArgs : EventArgs + { + + public ProgressBarProcessPaintEventArgs(Rectangle bounds, Graphics g, Rectangle[] blocks = null) + { + _Bounds = bounds; + _Graphics = g; + if (blocks == null) + { + _Blocks = new Rectangle[] { + + }; + } + else { + _Blocks = blocks; + } + } + + private Rectangle _Bounds; + public Rectangle Bounds + { + get { return _Bounds; } + } + + private Rectangle[] _Blocks; + public Rectangle[] Blocks + { + get { return _Blocks; } + } + + private Graphics _Graphics; + public Graphics Graphics + { + get { return _Graphics; } + } + + } + +#endregion + +#region " Methods " + + public void PerformStep() + { + if (this.Step > 0) + { + this.Value = Math.Min(this.Value + this.Step, this.MaxValue); + } + else { + this.Value = Math.Max(this.Value + this.Step, this.MinValue); + } + } + + public void Increment(int value) + { + if (value > 0) + { + this.Value = Math.Min(this.Value + value, this.MaxValue); + } + else { + this.Value = Math.Max(this.Value + value, this.MinValue); + } + } + +#endregion + +#region " Process Logic " + + private Rectangle GetProcessRect() + { + int w = this.Width; + int h = this.Height; + int valRel = GetRelativeValue(); + return new Rectangle(0, 0, w * valRel / 100, h); + } + + private Rectangle[] GetBlocks() + { + List<Rectangle> b = new List<Rectangle>(); + + int w = this.BlockWidth; + int h = this.Height; + Rectangle r; + + int x = 0; + int stopX = (int)(GetRelativeValue() / 100) * this.Width; + while ((x + w <= stopX)) + { + r = new Rectangle(x, 0, w, h); + b.Add(r); + + x += this.BlockWidth + this.BlockSeparation; + } + + return b.ToArray(); + } + + private int GetRelativeValue() + { + return (int)100 * this.Value / (this.MaxValue - this.MinValue); + } + +#endregion + +#region " Drawing " + + protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) + { + base.OnPaint(e); + DoPaintBackground(e.Graphics); + DoPaintProcess(e.Graphics); + if (this.ShowValue) + DoPaintValue(e.Graphics); + } + + private void DoPaintBackground(Graphics g) + { + if (PaintBackground != null) + { + PaintBackground(this, new PaintEventArgs(g, this.ClientRectangle)); + } + } + + private void DoPaintProcess(Graphics g) + { + Rectangle rect = GetProcessRect(); + Rectangle[] blocks = GetBlocks(); + using (SolidBrush brush = new SolidBrush(this.Color)) + { + if (this.Style == ProgressBarExStyle.Continuous) + { + g.FillRectangle(brush, rect); + } + else if (this.Style == ProgressBarExStyle.Blocks) + { + foreach (Rectangle b in blocks) + { + g.FillRectangle(brush, b); + } + } + } + + ProgressBarProcessPaintEventArgs e = new ProgressBarProcessPaintEventArgs(rect, g, blocks); + if (PaintProcess != null) + { + PaintProcess(this, e); + } + } + + private void DoPaintValue(Graphics g) + { + string valStr = GetRelativeValue().ToString() + "%"; + if (show_label) + valStr = _label + " " + valStr; + + StringFormat sf = new StringFormat(); + sf.Alignment = StringAlignment.Center; + SizeF s = g.MeasureString(valStr, this.Font); + + g.DrawString(valStr, this.Font, new SolidBrush(this.ForeColor), (this.Width - s.Width) / 2, (this.Height - s.Height) / 2); + } + +#endregion + } +} diff --git a/source/WindowsFormsApplication1/Controls/ProgressBarEX.resx b/source/WindowsFormsApplication1/Controls/ProgressBarEX.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ProgressBarEX.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/source/WindowsFormsApplication1/Controls/ShifterColorInput.Designer.cs b/source/WindowsFormsApplication1/Controls/ShifterColorInput.Designer.cs new file mode 100644 index 0000000..47cf0a1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterColorInput.Designer.cs @@ -0,0 +1,77 @@ +namespace ShiftOS +{ + partial class ShifterColorInput + { + /// <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.pnlmainbuttoncolour = new System.Windows.Forms.Panel(); + this.lblabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // pnlmainbuttoncolour + // + this.pnlmainbuttoncolour.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlmainbuttoncolour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlmainbuttoncolour.Location = new System.Drawing.Point(128, 3); + this.pnlmainbuttoncolour.MaximumSize = new System.Drawing.Size(41, 20); + this.pnlmainbuttoncolour.Name = "pnlmainbuttoncolour"; + this.pnlmainbuttoncolour.Size = new System.Drawing.Size(41, 20); + this.pnlmainbuttoncolour.TabIndex = 3; + // + // lblabel + // + this.lblabel.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.lblabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblabel.Location = new System.Drawing.Point(3, 6); + this.lblabel.Name = "lblabel"; + this.lblabel.Size = new System.Drawing.Size(122, 19); + this.lblabel.TabIndex = 2; + this.lblabel.Text = "Main Button Colour:"; + this.lblabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // ShifterColorInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlmainbuttoncolour); + this.Controls.Add(this.lblabel); + this.Name = "ShifterColorInput"; + this.Size = new System.Drawing.Size(173, 28); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlmainbuttoncolour; + private System.Windows.Forms.Label lblabel; + + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterColorInput.cs b/source/WindowsFormsApplication1/Controls/ShifterColorInput.cs new file mode 100644 index 0000000..11bedf0 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterColorInput.cs @@ -0,0 +1,47 @@ +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 +{ + public partial class ShifterColorInput : IShifterSetting + { + public ShifterColorInput() + { + InitializeComponent(); + pnlmainbuttoncolour.Click += (o, e) => + { + API.CreateColorPickerSession(Text, pnlmainbuttoncolour.BackColor); + API.ColorPickerSession.FormClosing += (s, a) => + { + var res = API.GetLastColorFromSession(); + pnlmainbuttoncolour.BackColor = res; + InvokeEvent(o, e); + }; + }; + } + + public override string Text + { + get { return lblabel.Text; } + set { lblabel.Text = value; } + } + + public override object Value + { + get { return pnlmainbuttoncolour.BackColor; } + set + { + pnlmainbuttoncolour.BackColor = (Color)value; + } + } + + + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterColorInput.resx b/source/WindowsFormsApplication1/Controls/ShifterColorInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterColorInput.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/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.Designer.cs b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.Designer.cs new file mode 100644 index 0000000..b09416f --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.Designer.cs @@ -0,0 +1,76 @@ +namespace ShiftOS +{ + partial class ShifterGraphicInput + { + /// <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.pnlmainbuttoncolour = new System.Windows.Forms.Panel(); + this.lblabel = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // pnlmainbuttoncolour + // + this.pnlmainbuttoncolour.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlmainbuttoncolour.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.pnlmainbuttoncolour.Location = new System.Drawing.Point(129, 3); + this.pnlmainbuttoncolour.MaximumSize = new System.Drawing.Size(41, 20); + this.pnlmainbuttoncolour.Name = "pnlmainbuttoncolour"; + this.pnlmainbuttoncolour.Size = new System.Drawing.Size(41, 20); + this.pnlmainbuttoncolour.TabIndex = 3; + // + // lblabel + // + this.lblabel.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.lblabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lblabel.Location = new System.Drawing.Point(3, 6); + this.lblabel.Name = "lblabel"; + this.lblabel.Size = new System.Drawing.Size(123, 18); + this.lblabel.TabIndex = 2; + this.lblabel.Text = "Main Button Colour:"; + this.lblabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // ShifterGraphicInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pnlmainbuttoncolour); + this.Controls.Add(this.lblabel); + this.Name = "ShifterGraphicInput"; + this.Size = new System.Drawing.Size(174, 27); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Panel pnlmainbuttoncolour; + private System.Windows.Forms.Label lblabel; + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.cs b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.cs new file mode 100644 index 0000000..8e15e07 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.cs @@ -0,0 +1,49 @@ +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 +{ + public partial class ShifterGraphicInput : IShifterSetting + { + public ShifterGraphicInput() + { + InitializeComponent(); + pnlmainbuttoncolour.Click += (o, e) => + { + API.CreateGraphicPickerSession(Text, false); + API.GraphicPickerSession.FormClosing += (s, a) => + { + var res = API.GetGraphicPickerResult(); + if(res != "fail") + { + pnlmainbuttoncolour.BackgroundImage = API.GraphicPickerSession.IdleImage; + InvokeEvent(o, e); + } + }; + }; + } + + public override string Text + { + get { return lblabel.Text; } + set { lblabel.Text = value; } + } + + public override object Value + { + get { return pnlmainbuttoncolour.BackgroundImage; } + set + { + pnlmainbuttoncolour.BackgroundImage = (Image)value; + } + } + + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.resx b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterGraphicInput.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/source/WindowsFormsApplication1/Controls/ShifterIntInput.Designer.cs b/source/WindowsFormsApplication1/Controls/ShifterIntInput.Designer.cs new file mode 100644 index 0000000..130db0c --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterIntInput.Designer.cs @@ -0,0 +1,83 @@ +namespace ShiftOS +{ + partial class ShifterIntInput + { + /// <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.txttext = new System.Windows.Forms.TextBox(); + this.Label51 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txttext + // + this.txttext.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.txttext.BackColor = System.Drawing.Color.White; + this.txttext.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.txttext.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txttext.ForeColor = System.Drawing.Color.Black; + this.txttext.Location = new System.Drawing.Point(174, 3); + this.txttext.MinimumSize = new System.Drawing.Size(5, 2); + this.txttext.Name = "txttext"; + this.txttext.Size = new System.Drawing.Size(36, 22); + this.txttext.TabIndex = 32; + this.txttext.TextChanged += new System.EventHandler(this.txttext_TextChanged); + // + // Label51 + // + this.Label51.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.Label51.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label51.Location = new System.Drawing.Point(0, 0); + this.Label51.Name = "Label51"; + this.Label51.Size = new System.Drawing.Size(168, 29); + this.Label51.TabIndex = 31; + this.Label51.Text = "Label:"; + this.Label51.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // ShifterIntInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.Controls.Add(this.txttext); + this.Controls.Add(this.Label51); + this.Name = "ShifterIntInput"; + this.Size = new System.Drawing.Size(213, 29); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txttext; + private System.Windows.Forms.Label Label51; + + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterIntInput.cs b/source/WindowsFormsApplication1/Controls/ShifterIntInput.cs new file mode 100644 index 0000000..782d265 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterIntInput.cs @@ -0,0 +1,62 @@ +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 +{ + public partial class ShifterIntInput : IShifterSetting + { + public ShifterIntInput() + { + InitializeComponent(); + } + + public bool NoDecimal + { + get; + set; + } + + public override string Text + { + get { return Label51.Text; } + set { Label51.Text = value; } + } + + public override object Value + { + get { + if (NoDecimal) + return Convert.ToInt32(txttext.Text); + else + return Convert.ToDecimal(txttext.Text); + } + set + { + txttext.Text = value.ToString(); + } + } + + private void txttext_TextChanged(object sender, EventArgs e) + { + try + { + if (NoDecimal) + Value = Convert.ToInt32(txttext.Text); + else + Value = Convert.ToDecimal(txttext.Text); + InvokeEvent(sender, e); + } + catch + { + txttext.Text = Value.ToString(); + } + } + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterIntInput.resx b/source/WindowsFormsApplication1/Controls/ShifterIntInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterIntInput.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/source/WindowsFormsApplication1/Controls/ShifterTextInput.Designer.cs b/source/WindowsFormsApplication1/Controls/ShifterTextInput.Designer.cs new file mode 100644 index 0000000..9da62c6 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterTextInput.Designer.cs @@ -0,0 +1,78 @@ +namespace ShiftOS +{ + partial class ShifterTextInput + { + /// <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.txttext = new System.Windows.Forms.TextBox(); + this.Label51 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // txttext + // + this.txttext.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.txttext.BackColor = System.Drawing.Color.White; + this.txttext.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.txttext.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txttext.ForeColor = System.Drawing.Color.Black; + this.txttext.Location = new System.Drawing.Point(106, 7); + this.txttext.MinimumSize = new System.Drawing.Size(5, 2); + this.txttext.Name = "txttext"; + this.txttext.Size = new System.Drawing.Size(116, 22); + this.txttext.TabIndex = 32; + // + // Label51 + // + this.Label51.Dock = System.Windows.Forms.DockStyle.Left; + this.Label51.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.Label51.Location = new System.Drawing.Point(0, 0); + this.Label51.Name = "Label51"; + this.Label51.Size = new System.Drawing.Size(100, 29); + this.Label51.TabIndex = 31; + this.Label51.Text = "Label:"; + this.Label51.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // ShifterTextInput + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.Controls.Add(this.txttext); + this.Controls.Add(this.Label51); + this.Name = "ShifterTextInput"; + this.Size = new System.Drawing.Size(222, 29); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TextBox txttext; + private System.Windows.Forms.Label Label51; + } +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterTextInput.cs b/source/WindowsFormsApplication1/Controls/ShifterTextInput.cs new file mode 100644 index 0000000..6e59649 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterTextInput.cs @@ -0,0 +1,65 @@ +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 +{ + public partial class ShifterTextInput : IShifterSetting + { + public ShifterTextInput() + { + InitializeComponent(); + txttext.TextChanged += (o, e) => + { + Value = txttext.Text; + InvokeEvent(o, e); + }; + } + + public override string Text + { + get + { + return Label51.Text; + } + set + { + Label51.Text = value; + } + } + + public override object Value + { + get + { + return txttext.Text; + } + set + { + txttext.Text = value as string; + } + } + + + + } + + public class IShifterSetting : UserControl + { + public virtual string Text { get; set; } + public virtual object Value { get; set; } + public event EventHandler OnValueChange; + + public void InvokeEvent(object s, EventArgs a) + { + OnValueChange?.Invoke(s, a); + } + } + +} diff --git a/source/WindowsFormsApplication1/Controls/ShifterTextInput.resx b/source/WindowsFormsApplication1/Controls/ShifterTextInput.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/ShifterTextInput.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/source/WindowsFormsApplication1/Controls/WindowBorder.Designer.cs b/source/WindowsFormsApplication1/Controls/WindowBorder.Designer.cs new file mode 100644 index 0000000..6e0970e --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/WindowBorder.Designer.cs @@ -0,0 +1,270 @@ +using System; + +namespace ShiftOS +{ + partial class WindowBorder + { + /// <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); + } + + private void InitializeComponent() + { + this.components = new System.ComponentModel.Container(); + this.pgleft = new System.Windows.Forms.Panel(); + this.pgbottomlcorner = new System.Windows.Forms.Panel(); + this.pgright = new System.Windows.Forms.Panel(); + this.pgbottomrcorner = new System.Windows.Forms.Panel(); + this.titlebar = new System.Windows.Forms.Panel(); + this.minimizebutton = new System.Windows.Forms.Panel(); + this.pnlicon = new System.Windows.Forms.PictureBox(); + this.rollupbutton = new System.Windows.Forms.Panel(); + this.closebutton = new System.Windows.Forms.Panel(); + this.lbtitletext = new System.Windows.Forms.Label(); + this.pgtoplcorner = new System.Windows.Forms.Panel(); + this.pgtoprcorner = new System.Windows.Forms.Panel(); + this.pgbottom = new System.Windows.Forms.Panel(); + this.pgcontents = new System.Windows.Forms.Panel(); + this.pullbs = new System.Windows.Forms.Timer(this.components); + this.pullbottom = new System.Windows.Forms.Timer(this.components); + this.pullside = new System.Windows.Forms.Timer(this.components); + this.pgleft.SuspendLayout(); + this.pgright.SuspendLayout(); + this.titlebar.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pnlicon)).BeginInit(); + this.SuspendLayout(); + // + // pgleft + // + this.pgleft.BackColor = System.Drawing.Color.Gray; + this.pgleft.Controls.Add(this.pgbottomlcorner); + this.pgleft.Dock = System.Windows.Forms.DockStyle.Left; + this.pgleft.Location = new System.Drawing.Point(0, 30); + this.pgleft.Name = "pgleft"; + this.pgleft.Size = new System.Drawing.Size(2, 345); + this.pgleft.TabIndex = 16; + this.pgleft.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Rightpull_MouseDown); + this.pgleft.MouseEnter += new System.EventHandler(this.RightCursorOn_MouseDown); + this.pgleft.MouseLeave += new System.EventHandler(this.SizeCursoroff_MouseDown); + this.pgleft.MouseUp += new System.Windows.Forms.MouseEventHandler(this.rightpull_MouseUp); + // + // pgbottomlcorner + // + this.pgbottomlcorner.BackColor = System.Drawing.Color.Red; + this.pgbottomlcorner.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pgbottomlcorner.Location = new System.Drawing.Point(0, 343); + this.pgbottomlcorner.Name = "pgbottomlcorner"; + this.pgbottomlcorner.Size = new System.Drawing.Size(2, 2); + this.pgbottomlcorner.TabIndex = 14; + this.pgbottomlcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.bspull_MouseDown); + this.pgbottomlcorner.MouseEnter += new System.EventHandler(this.CornerCursorOn_MouseDown); + this.pgbottomlcorner.MouseLeave += new System.EventHandler(this.SizeCursoroff_MouseDown); + this.pgbottomlcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.bspull_MouseUp); + // + // pgright + // + this.pgright.BackColor = System.Drawing.Color.Gray; + this.pgright.Controls.Add(this.pgbottomrcorner); + this.pgright.Dock = System.Windows.Forms.DockStyle.Right; + this.pgright.Location = new System.Drawing.Point(545, 30); + this.pgright.Name = "pgright"; + this.pgright.Size = new System.Drawing.Size(2, 345); + this.pgright.TabIndex = 17; + this.pgright.MouseDown += new System.Windows.Forms.MouseEventHandler(this.Rightpull_MouseDown); + this.pgright.MouseEnter += new System.EventHandler(this.RightCursorOn_MouseDown); + this.pgright.MouseLeave += new System.EventHandler(this.SizeCursoroff_MouseDown); + this.pgright.MouseUp += new System.Windows.Forms.MouseEventHandler(this.rightpull_MouseUp); + // + // pgbottomrcorner + // + this.pgbottomrcorner.BackColor = System.Drawing.Color.Red; + this.pgbottomrcorner.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pgbottomrcorner.Location = new System.Drawing.Point(0, 343); + this.pgbottomrcorner.Name = "pgbottomrcorner"; + this.pgbottomrcorner.Size = new System.Drawing.Size(2, 2); + this.pgbottomrcorner.TabIndex = 15; + this.pgbottomrcorner.MouseDown += new System.Windows.Forms.MouseEventHandler(this.bspull_MouseDown); + this.pgbottomrcorner.MouseEnter += new System.EventHandler(this.CornerCursorOn_MouseDown); + this.pgbottomrcorner.MouseLeave += new System.EventHandler(this.SizeCursoroff_MouseDown); + this.pgbottomrcorner.MouseUp += new System.Windows.Forms.MouseEventHandler(this.bspull_MouseUp); + // + // titlebar + // + this.titlebar.BackColor = System.Drawing.Color.Gray; + this.titlebar.Controls.Add(this.minimizebutton); + this.titlebar.Controls.Add(this.pnlicon); + this.titlebar.Controls.Add(this.rollupbutton); + this.titlebar.Controls.Add(this.closebutton); + this.titlebar.Controls.Add(this.lbtitletext); + this.titlebar.Controls.Add(this.pgtoplcorner); + this.titlebar.Controls.Add(this.pgtoprcorner); + this.titlebar.Dock = System.Windows.Forms.DockStyle.Top; + this.titlebar.ForeColor = System.Drawing.Color.White; + this.titlebar.Location = new System.Drawing.Point(0, 0); + this.titlebar.Name = "titlebar"; + this.titlebar.Size = new System.Drawing.Size(547, 30); + this.titlebar.TabIndex = 14; + this.titlebar.MouseDown += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseDown); + this.titlebar.MouseMove += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseMove); + this.titlebar.MouseUp += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseUp); + // + // minimizebutton + // + this.minimizebutton.BackColor = System.Drawing.Color.Black; + this.minimizebutton.Location = new System.Drawing.Point(246, 5); + this.minimizebutton.Name = "minimizebutton"; + this.minimizebutton.Size = new System.Drawing.Size(22, 22); + this.minimizebutton.TabIndex = 24; + this.minimizebutton.Click += new System.EventHandler(this.minimizebutton_Click); + // + // pnlicon + // + this.pnlicon.BackColor = System.Drawing.Color.Transparent; + this.pnlicon.Location = new System.Drawing.Point(8, 8); + this.pnlicon.Name = "pnlicon"; + this.pnlicon.Size = new System.Drawing.Size(16, 16); + this.pnlicon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage; + this.pnlicon.TabIndex = 24; + this.pnlicon.TabStop = false; + this.pnlicon.Visible = false; + // + // rollupbutton + // + this.rollupbutton.BackColor = System.Drawing.Color.Black; + this.rollupbutton.Location = new System.Drawing.Point(274, 3); + this.rollupbutton.Name = "rollupbutton"; + this.rollupbutton.Size = new System.Drawing.Size(22, 22); + this.rollupbutton.TabIndex = 22; + this.rollupbutton.Click += new System.EventHandler(this.rollupbutton_Click); + // + // closebutton + // + this.closebutton.BackColor = System.Drawing.Color.Black; + this.closebutton.Location = new System.Drawing.Point(302, 3); + this.closebutton.Name = "closebutton"; + this.closebutton.Size = new System.Drawing.Size(22, 22); + this.closebutton.TabIndex = 20; + this.closebutton.Click += new System.EventHandler(this.closebutton_Click); + // + // lbtitletext + // + this.lbtitletext.AutoSize = true; + this.lbtitletext.BackColor = System.Drawing.Color.Transparent; + this.lbtitletext.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.lbtitletext.Location = new System.Drawing.Point(26, 7); + this.lbtitletext.Name = "lbtitletext"; + this.lbtitletext.Size = new System.Drawing.Size(77, 18); + this.lbtitletext.TabIndex = 19; + this.lbtitletext.Text = "Template"; + this.lbtitletext.MouseDown += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseDown); + this.lbtitletext.MouseMove += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseMove); + this.lbtitletext.MouseUp += new System.Windows.Forms.MouseEventHandler(this.titlebar_MouseUp); + // + // pgtoplcorner + // + this.pgtoplcorner.BackColor = System.Drawing.Color.Red; + this.pgtoplcorner.Dock = System.Windows.Forms.DockStyle.Left; + this.pgtoplcorner.Location = new System.Drawing.Point(0, 0); + this.pgtoplcorner.Name = "pgtoplcorner"; + this.pgtoplcorner.Size = new System.Drawing.Size(2, 30); + this.pgtoplcorner.TabIndex = 17; + // + // pgtoprcorner + // + this.pgtoprcorner.BackColor = System.Drawing.Color.Red; + this.pgtoprcorner.Dock = System.Windows.Forms.DockStyle.Right; + this.pgtoprcorner.Location = new System.Drawing.Point(545, 0); + this.pgtoprcorner.Name = "pgtoprcorner"; + this.pgtoprcorner.Size = new System.Drawing.Size(2, 30); + this.pgtoprcorner.TabIndex = 16; + // + // pgbottom + // + this.pgbottom.BackColor = System.Drawing.Color.Gray; + this.pgbottom.Dock = System.Windows.Forms.DockStyle.Bottom; + this.pgbottom.Location = new System.Drawing.Point(2, 373); + this.pgbottom.Name = "pgbottom"; + this.pgbottom.Size = new System.Drawing.Size(543, 2); + this.pgbottom.TabIndex = 18; + this.pgbottom.MouseDown += new System.Windows.Forms.MouseEventHandler(this.bottompull_MouseDown); + this.pgbottom.MouseEnter += new System.EventHandler(this.bottomCursorOn_MouseDown); + this.pgbottom.MouseLeave += new System.EventHandler(this.SizeCursoroff_MouseDown); + this.pgbottom.MouseUp += new System.Windows.Forms.MouseEventHandler(this.bottompull_MouseUp); + // + // pgcontents + // + this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; + this.pgcontents.Location = new System.Drawing.Point(2, 30); + this.pgcontents.Name = "pgcontents"; + this.pgcontents.Size = new System.Drawing.Size(543, 343); + this.pgcontents.TabIndex = 15; + // + // pullbs + // + this.pullbs.Interval = 1; + this.pullbs.Tick += new System.EventHandler(this.pullbs_Tick); + // + // pullbottom + // + this.pullbottom.Interval = 1; + this.pullbottom.Tick += new System.EventHandler(this.pullbottom_Tick); + // + // pullside + // + this.pullside.Interval = 1; + this.pullside.Tick += new System.EventHandler(this.pullside_Tick); + // + // WindowBorder + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.pgcontents); + this.Controls.Add(this.pgbottom); + this.Controls.Add(this.pgright); + this.Controls.Add(this.pgleft); + this.Controls.Add(this.titlebar); + this.Name = "WindowBorder"; + this.Size = new System.Drawing.Size(547, 375); + this.Load += new System.EventHandler(this.Template_Load); + this.pgleft.ResumeLayout(false); + this.pgright.ResumeLayout(false); + this.titlebar.ResumeLayout(false); + this.titlebar.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pnlicon)).EndInit(); + this.ResumeLayout(false); + + } + internal System.Windows.Forms.Panel pgleft; + internal System.Windows.Forms.Panel pgbottomlcorner; + internal System.Windows.Forms.Panel pgright; + internal System.Windows.Forms.Panel pgbottomrcorner; + internal System.Windows.Forms.Panel titlebar; + internal System.Windows.Forms.Panel pgtoplcorner; + internal System.Windows.Forms.Panel pgtoprcorner; + internal System.Windows.Forms.Panel pgbottom; + internal System.Windows.Forms.Panel pgcontents; + internal System.Windows.Forms.Label lbtitletext; + internal System.Windows.Forms.Panel closebutton; + internal System.Windows.Forms.Panel rollupbutton; + internal System.Windows.Forms.PictureBox pnlicon; + internal System.Windows.Forms.Panel minimizebutton; + internal System.Windows.Forms.Timer pullbs; + internal System.Windows.Forms.Timer pullbottom; + internal System.Windows.Forms.Timer pullside; + + } +} diff --git a/source/WindowsFormsApplication1/Controls/WindowBorder.cs b/source/WindowsFormsApplication1/Controls/WindowBorder.cs new file mode 100644 index 0000000..751cb43 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/WindowBorder.cs @@ -0,0 +1,668 @@ +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 +{ + public partial class WindowBorder : UserControl + { + public Timer updater = new Timer(); + + public WindowBorder(string aname, Image aicon) + { + AppName = aname; + AppIcon = aicon; + InitializeComponent(); + } + + public Image AppIcon = null; + public string AppName = null; + + public void HideAll() + { + titlebar.Hide(); + pgleft.Hide(); + pgright.Hide(); + pgbottom.Hide(); + } + + #region "Template Code" + public int rolldownsize; + public int oldbordersize; + public int oldtitlebarheight; + public bool justopened = false; + public bool needtorollback = false; + //replace with minimum size + public int minimumsizewidth = 0; + //replace with minimum size + public int minimumsizeheight = 0; + + // ERROR: Handles clauses are not supported in C# + private void Template_Load(object sender, EventArgs e) + { + setupall(); + if (ParentForm.Name == "Terminal" && API.Upgrades["windowedterminal"] == false) + { + HideAll(); + } + string x = ParentForm.Width.ToString(); + string y = ParentForm.Height.ToString(); + ParentForm.MinimumSize = new Size(Convert.ToInt16(x), Convert.ToInt16(y)); + string mx = ParentForm.MinimumSize.Width.ToString(); + string my = ParentForm.MinimumSize.Height.ToString(); + Form frm = ParentForm; + pbtn = new PanelButton(AppName, AppIcon, ref frm); + API.PanelButtons.Add(pbtn); + if (API.CurrentSession != null) + { + API.CurrentSession.SetupPanelButtons(); + } + ParentForm.FormClosing += new FormClosingEventHandler(this.Clock_FormClosing); + var vtimer = new Timer(); + vtimer.Interval = 1000; + vtimer.Tick += (object s, EventArgs a) => + { + try { + if (API.Upgrades["titlebar"] == true) + { + titlebar.Show(); + } + else { + titlebar.Hide(); + } + + } + catch(Exception ex) + { + API.LogException(ex.Message, false); + } + if (Viruses.InfectedWith("windowmicrofier")) + { + if (this.Width > 0) + { + this.ParentForm.MinimumSize = new Size(0, 0); + this.ParentForm.Width -= 1; + } + if (this.Height > 0) + { + this.ParentForm.Height -= 1; + } + } + try { + if (this.ParentForm.TopMost == API.CurrentSession.UnityEnabled) + { + this.ParentForm.TopMost = !this.ParentForm.TopMost; + } + } + catch + { + //FAIL. + } + }; + vtimer.Start(); + //try { + ParentForm.Name = AppName.ToLower().Replace(" ", "_"); + /*} + catch(Exception ex) + { + ParentForm.Name = "null"; + }*/ + ParentForm.Tag = ParentForm.Location; + WindowComposition.WindowsEverywhere(this.ParentForm); + } + + private PanelButton pbtn = null; + + public void setupall() + { + setuptitlebar(); + setupborders(); + setskin(); + + } + + + + private void titlebar_MouseDown(object sender, MouseEventArgs e) + { + // Handle Draggable Windows + if (API.Upgrades["draggablewindows"] == true) + { + if (e.Button == MouseButtons.Left) + { + WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, true); + LastMouseX = e.X; + LastMouseY = e.Y; + Resizing = true; + } + //ShiftOSDesktop.log = //ShiftOSDesktop.log + My.Computer.Clock.LocalTime + " User dragged " + this.Name + " to " + this.Location.ToString + Environment.NewLine; + } + } + + private bool Resizing = false; + private int LastMouseX = 0; + private int LastMouseY = 0; + + private void titlebar_MouseMove(object sender, MouseEventArgs e) + { + if(Resizing == true) + { + int left = 0; + int top = 0; + if (e.X < LastMouseX) + { + left = -1; + } + else if (e.X > LastMouseX) + { + left = 1; + } + if (e.Y < LastMouseY) + { + top = -1; + } + else if (e.Y > LastMouseY) + { + top = 1; + } + if (API.CurrentSkin.DragAnimation == WindowDragEffect.Shake) + { + WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, true, left, top); + } + else { + + ParentForm.Left += left; + ParentForm.Top += top; + ParentForm.Tag = ParentForm.Location; + } + } + if(Viruses.InfectedWith("windowspazzer")) + { + int left = 0; + int top = 0; + if (e.X < LastMouseX) + { + left = -1; + } + else if (e.X > LastMouseX) + { + left = 1; + } + if (e.Y < LastMouseY) + { + top = -1; + } + else if (e.Y > LastMouseY) + { + top = 1; + } + WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, true, left, top); + + } + } + + private void titlebar_MouseUp(object s, MouseEventArgs e) + { + WindowComposition.AnimateDragWindow(this.ParentForm, API.CurrentSkin.DragAnimation, false); + + Resizing = false; + } + + public void setupborders() + { + if (API.Upgrades["windowborders"] == false) + { + pgleft.Hide(); + pgbottom.Hide(); + pgright.Hide(); + this.Size = new Size(this.Width - pgleft.Width - pgright.Width, this.Height - pgbottom.Height); + } + } + + private void closebutton_Click(object sender, EventArgs e) + { + this.ParentForm.Close(); + } + + private void closebutton_MouseEnter(object sender, EventArgs e) + { + closebutton.BackgroundImage = API.CurrentSkinImages.closebtnhover; + } + + private void closebutton_MouseLeave(object sender, EventArgs e) + { + closebutton.BackgroundImage = API.CurrentSkinImages.closebtn; + } + + private void closebutton_MouseDown(object sender, EventArgs e) + { + closebutton.BackgroundImage = API.CurrentSkinImages.closebtnclick; + } + + public Point OldLoc = new Point(0, 0); + public bool Minimized = false; + + private void minimizebutton_Click(object sender, EventArgs e) + { + API.MinimizeForm(ParentForm); + } + + private void rollupbutton_Click(object sender, EventArgs e) + { + rollupanddown(); + } + + private void rollupbutton_MouseEnter(object sender, EventArgs e) + { + rollupbutton.BackgroundImage = API.CurrentSkinImages.rollbtnhover; + } + + private void rollupbutton_MouseLeave(object sender, EventArgs e) + { + rollupbutton.BackgroundImage = API.CurrentSkinImages.rollbtn; + } + + private void rollupbutton_MouseDown(object sender, EventArgs e) + { + rollupbutton.BackgroundImage = API.CurrentSkinImages.rollbtnclick; + } + + public void setuptitlebar() + { + setupborders(); + + if (this.Height == this.titlebar.Height) { pgleft.Show(); pgbottom.Show(); pgright.Show(); this.Height = rolldownsize; needtorollback = true; } + pgleft.Width = API.CurrentSkin.borderwidth; + pgright.Width = API.CurrentSkin.borderwidth; + pgbottom.Height = API.CurrentSkin.borderwidth; + titlebar.Height = API.CurrentSkin.titlebarheight; + + if (justopened == true) + { + this.Size = new Size(420, 510); + //put the default size of your window here + this.Size = new Size(this.Width, this.Height + API.CurrentSkin.titlebarheight - 30); + this.Size = new Size(this.Width + API.CurrentSkin.borderwidth + API.CurrentSkin.borderwidth, this.Height + API.CurrentSkin.borderwidth); + oldbordersize = API.CurrentSkin.borderwidth; + oldtitlebarheight = API.CurrentSkin.titlebarheight; + justopened = false; + } + else { + if (this.Visible == true) + { + this.Size = new Size(this.Width - (2 * oldbordersize) + (2 * API.CurrentSkin.borderwidth), (this.Height - oldtitlebarheight - oldbordersize) + API.CurrentSkin.titlebarheight + API.CurrentSkin.borderwidth); + oldbordersize = API.CurrentSkin.borderwidth; + oldtitlebarheight = API.CurrentSkin.titlebarheight; + rolldownsize = this.Height; + if (needtorollback == true) { this.Height = titlebar.Height; pgleft.Hide(); pgbottom.Hide(); pgright.Hide(); } + } + } + + if (API.CurrentSkin.enablecorners == true) + { + pgtoplcorner.Show(); + pgtoprcorner.Show(); + pgtoprcorner.Width = API.CurrentSkin.titlebarcornerwidth; + pgtoplcorner.Width = API.CurrentSkin.titlebarcornerwidth; + } + else { + pgtoplcorner.Hide(); + pgtoprcorner.Hide(); + } + + if (API.Upgrades["titlebar"] == false) + { + titlebar.Hide(); + this.Size = new Size(this.Width, this.Size.Height - titlebar.Height); + } + + if (API.Upgrades["titletext"] == false) + { + lbtitletext.Hide(); + } + else { + lbtitletext.Font = new Font(API.CurrentSkin.titletextfontfamily, API.CurrentSkin.titletextfontsize, API.CurrentSkin.titletextfontstyle, GraphicsUnit.Point); + lbtitletext.Text = this.AppName; + //Remember to change to name of program!!!! + lbtitletext.Show(); + } + + if (API.Upgrades["closebutton"] == false) + { + closebutton.Hide(); + } + else { + closebutton.BackColor = API.CurrentSkin.closebtncolour; + closebutton.Size = API.CurrentSkin.closebtnsize; + closebutton.Show(); + } + + if (API.Upgrades["rollupbutton"] == false) + { + rollupbutton.Hide(); + } + else { + rollupbutton.BackColor = API.CurrentSkin.rollbtncolour; + rollupbutton.Size = API.CurrentSkin.rollbtnsize; + rollupbutton.Show(); + } + + if (API.Upgrades["minimizebutton"] == false) + { + minimizebutton.Hide(); + } + else { + minimizebutton.BackColor = API.CurrentSkin.minbtncolour; + minimizebutton.Size = API.CurrentSkin.minbtnsize; + minimizebutton.Show(); + } + + if (API.Upgrades["windowborders"] == true) + { + closebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.closebtnfromside - closebutton.Size.Width, API.CurrentSkin.closebtnfromtop); + rollupbutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.rollbtnfromside - rollupbutton.Size.Width, API.CurrentSkin.rollbtnfromtop); + minimizebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.minbtnfromside - minimizebutton.Size.Width, API.CurrentSkin.minbtnfromtop); + switch (API.CurrentSkin.titletextpos) + { + case "Left": + lbtitletext.Location = new Point(API.CurrentSkin.titletextfromside, API.CurrentSkin.titletextfromtop); + break; + case "Centre": + lbtitletext.Location = new Point((titlebar.Width / 2) - lbtitletext.Width / 2, API.CurrentSkin.titletextfromtop); + break; + } + lbtitletext.ForeColor = API.CurrentSkin.titletextcolour; + } + else { + closebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.closebtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - closebutton.Size.Width, API.CurrentSkin.closebtnfromtop); + rollupbutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.rollbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - rollupbutton.Size.Width, API.CurrentSkin.rollbtnfromtop); + minimizebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.minbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - minimizebutton.Size.Width, API.CurrentSkin.minbtnfromtop); + switch (API.CurrentSkin.titletextpos) + { + case "Left": + lbtitletext.Location = new Point(API.CurrentSkin.titletextfromside + pgtoplcorner.Width, API.CurrentSkin.titletextfromtop); + break; + case "Centre": + lbtitletext.Location = new Point((titlebar.Width / 2) - lbtitletext.Width / 2, API.CurrentSkin.titletextfromtop); + break; + } + lbtitletext.ForeColor = API.CurrentSkin.titletextcolour; + } + + //Change when Icon skinning complete + // Change to program's icon + if (API.Upgrades["appicons"] == true) + { + pnlicon.Visible = true; + pnlicon.Location = new Point(API.CurrentSkin.titleiconfromside, API.CurrentSkin.titleiconfromtop); + pnlicon.Size = new Size(API.CurrentSkin.titlebariconsize, API.CurrentSkin.titlebariconsize); + pnlicon.Image = this.AppIcon; + //Replace with the correct icon for the program. + } + + } + + public void rollupanddown() + { + API.RollForm(this.ParentForm); + } + + public void resettitlebar() + { + if (API.Upgrades["windowborders"] == true) + { + closebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.closebtnfromside - closebutton.Size.Width, API.CurrentSkin.closebtnfromtop); + rollupbutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.rollbtnfromside - rollupbutton.Size.Width, API.CurrentSkin.rollbtnfromtop); + minimizebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.minbtnfromside - minimizebutton.Size.Width, API.CurrentSkin.minbtnfromtop); + switch (API.CurrentSkin.titletextpos) + { + case "Left": + lbtitletext.Location = new Point(API.CurrentSkin.titletextfromside, API.CurrentSkin.titletextfromtop); + break; + case "Centre": + lbtitletext.Location = new Point((titlebar.Width / 2) - lbtitletext.Width / 2, API.CurrentSkin.titletextfromtop); + break; + } + lbtitletext.ForeColor = API.CurrentSkin.titletextcolour; + } + else { + closebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.closebtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - closebutton.Size.Width, API.CurrentSkin.closebtnfromtop); + rollupbutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.rollbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - rollupbutton.Size.Width, API.CurrentSkin.rollbtnfromtop); + minimizebutton.Location = new Point(titlebar.Size.Width - API.CurrentSkin.minbtnfromside - pgtoplcorner.Width - pgtoprcorner.Width - minimizebutton.Size.Width, API.CurrentSkin.minbtnfromtop); + switch (API.CurrentSkin.titletextpos) + { + case "Left": + lbtitletext.Location = new Point(API.CurrentSkin.titletextfromside + pgtoplcorner.Width, API.CurrentSkin.titletextfromtop); + break; + case "Centre": + lbtitletext.Location = new Point((titlebar.Width / 2) - lbtitletext.Width / 2, API.CurrentSkin.titletextfromtop); + break; + } + lbtitletext.ForeColor = API.CurrentSkin.titletextcolour; + } + } + + // ERROR: Handles clauses are not supported in C# + private void pullside_Tick(System.Object sender, System.EventArgs e) + { + this.ParentForm.Width = Cursor.Position.X - this.ParentForm.Location.X; + resettitlebar(); + } + + // ERROR: Handles clauses are not supported in C# + private void pullbottom_Tick(System.Object sender, System.EventArgs e) + { + this.ParentForm.Height = Cursor.Position.Y - this.ParentForm.Location.Y; + resettitlebar(); + } + + // ERROR: Handles clauses are not supported in C# + private void pullbs_Tick(object sender, System.EventArgs e) + { + this.ParentForm.Width = Cursor.Position.X - this.ParentForm.Location.X; + this.ParentForm.Height = Cursor.Position.Y - this.ParentForm.Location.Y; + resettitlebar(); + } + + //delete this for non-resizable windows + // ERROR: Handles clauses are not supported in C# + private void Rightpull_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullside.Start(); + } + } + + // ERROR: Handles clauses are not supported in C# + private void RightCursorOn_MouseDown(object sender, System.EventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + Cursor = Cursors.SizeWE; + } + } + + // ERROR: Handles clauses are not supported in C# + private void bottomCursorOn_MouseDown(object sender, System.EventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + Cursor = Cursors.SizeNS; + } + } + + // ERROR: Handles clauses are not supported in C# + private void CornerCursorOn_MouseDown(object sender, System.EventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + Cursor = Cursors.SizeNWSE; + } + } + + // ERROR: Handles clauses are not supported in C# + private void SizeCursoroff_MouseDown(object sender, System.EventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + Cursor = Cursors.Default; + } + } + + // ERROR: Handles clauses are not supported in C# + private void rightpull_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullside.Stop(); + } + } + + // ERROR: Handles clauses are not supported in C# + private void bottompull_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullbottom.Start(); + } + } + + // ERROR: Handles clauses are not supported in C# + private void bottompull_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullbottom.Stop(); + } + } + + // ERROR: Handles clauses are not supported in C# + private void bspull_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullbs.Start(); + } + } + + // ERROR: Handles clauses are not supported in C# + private void bspull_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) + { + if (API.Upgrades["resizablewindows"] == true) + { + pullbs.Stop(); + } + } + + public void setskin() + { + //disposals + closebutton.BackgroundImage = null; + titlebar.BackgroundImage = null; + rollupbutton.BackgroundImage = null; + pgtoplcorner.BackgroundImage = null; + pgtoprcorner.BackgroundImage = null; + minimizebutton.BackgroundImage = null; + //apply new skin + if (API.CurrentSkinImages.closebtn == null) + closebutton.BackColor = API.CurrentSkin.closebtncolour; + else + closebutton.BackgroundImage = API.CurrentSkinImages.closebtn; + closebutton.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.closebtnlayout; + if (API.CurrentSkinImages.titlebar == null) + titlebar.BackColor = API.CurrentSkin.titlebarcolour; + else + titlebar.BackgroundImage = API.CurrentSkinImages.titlebar; + titlebar.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.titlebarlayout; + if (API.CurrentSkinImages.rollbtn == null) + rollupbutton.BackColor = API.CurrentSkin.rollbtncolour; + else + rollupbutton.BackgroundImage = API.CurrentSkinImages.rollbtn; + rollupbutton.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.rollbtnlayout; + if (API.CurrentSkinImages.leftcorner == null) + pgtoplcorner.BackColor = API.CurrentSkin.leftcornercolour; + else + pgtoplcorner.BackgroundImage = API.CurrentSkinImages.leftcorner; + pgtoplcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.leftcornerlayout; + if (API.CurrentSkinImages.rightcorner == null) + pgtoprcorner.BackColor = API.CurrentSkin.rightcornercolour; + else + pgtoprcorner.BackgroundImage = API.CurrentSkinImages.rightcorner; + pgtoprcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.rightcornerlayout; + if (API.CurrentSkinImages.minbtn == null) + minimizebutton.BackColor = API.CurrentSkin.minbtncolour; + else + minimizebutton.BackgroundImage = API.CurrentSkinImages.minbtn; + minimizebutton.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.minbtnlayout; + if (API.CurrentSkinImages.borderleft == null) + pgleft.BackColor = API.CurrentSkin.borderleftcolour; + else + pgleft.BackgroundImage = API.CurrentSkinImages.borderleft; + pgleft.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.borderleftlayout; + if (API.CurrentSkinImages.borderright == null) + pgright.BackColor = API.CurrentSkin.borderrightcolour; + else + pgright.BackgroundImage = API.CurrentSkinImages.borderright; + pgleft.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.borderrightlayout; + if (API.CurrentSkinImages.borderbottom == null) + pgbottom.BackColor = API.CurrentSkin.borderbottomcolour; + else + pgbottom.BackgroundImage = API.CurrentSkinImages.borderbottom; + pgbottom.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.borderbottomlayout; + if (API.CurrentSkin.enablebordercorners == true) + { + if (API.CurrentSkinImages.bottomleftcorner == null) + pgbottomlcorner.BackColor = API.CurrentSkin.bottomleftcornercolour; + else + pgbottomlcorner.BackgroundImage = API.CurrentSkinImages.bottomleftcorner; + pgbottomlcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.bottomleftcornerlayout; + if (API.CurrentSkinImages.bottomrightcorner == null) + pgbottomrcorner.BackColor = API.CurrentSkin.bottomrightcornercolour; + else + pgbottomrcorner.BackgroundImage = API.CurrentSkinImages.bottomrightcorner; + pgbottomrcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.bottomrightcornerlayout; + } + else { + pgbottomlcorner.BackColor = API.CurrentSkin.borderrightcolour; + pgbottomrcorner.BackColor = API.CurrentSkin.borderrightcolour; + pgbottomlcorner.BackgroundImage = null; + pgbottomrcorner.BackgroundImage = null; + } + + //set bottom border corner size + pgbottomlcorner.Size = new Size(API.CurrentSkin.borderwidth, API.CurrentSkin.borderwidth); + pgbottomrcorner.Size = new Size(API.CurrentSkin.borderwidth, API.CurrentSkin.borderwidth); + pgbottomlcorner.Location = new Point(0, this.Height - API.CurrentSkin.borderwidth); + pgbottomrcorner.Location = new Point(this.Width, this.Height - API.CurrentSkin.borderwidth); + + //I don't know if this already happens... + pgright.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.borderrightlayout; + pgbottomrcorner.BackgroundImage = API.CurrentSkinImages.bottomrightcorner; + pgbottomlcorner.BackgroundImage = API.CurrentSkinImages.bottomleftcorner; + pgbottomrcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.bottomrightcornerlayout; + pgbottomlcorner.BackgroundImageLayout = (ImageLayout)API.CurrentSkin.bottomleftcornerlayout; + + + } + + // ERROR: Handles clauses are not supported in C# + private void Clock_FormClosing(object sender, FormClosingEventArgs e) + { + if (WindowComposition.ShuttingDown == false) + { + e.Cancel = true; + WindowComposition.CloseForm(this.ParentForm, pbtn, API.CurrentSkin.WindowCloseAnimation); + } + } + } + #endregion + +} + diff --git a/source/WindowsFormsApplication1/Controls/WindowBorder.resx b/source/WindowsFormsApplication1/Controls/WindowBorder.resx new file mode 100644 index 0000000..8bf59aa --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/WindowBorder.resx @@ -0,0 +1,129 @@ +<?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="pullbs.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="pullbottom.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>101, 17</value> + </metadata> + <metadata name="pullside.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>214, 17</value> + </metadata> +</root>
\ No newline at end of file diff --git a/source/WindowsFormsApplication1/Controls/infobox.Designer.cs b/source/WindowsFormsApplication1/Controls/infobox.Designer.cs new file mode 100644 index 0000000..1472a09 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/infobox.Designer.cs @@ -0,0 +1,187 @@ +using System; + +namespace ShiftOS +{ + partial class infobox + { + /// <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); + } + + private void InitializeComponent() + { + this.pgcontents = new System.Windows.Forms.Panel(); + this.txtuserinput = new System.Windows.Forms.TextBox(); + this.btnok = new System.Windows.Forms.Button(); + this.txtmessage = new System.Windows.Forms.Label(); + this.pboximage = new System.Windows.Forms.PictureBox(); + this.lblintructtext = new System.Windows.Forms.Label(); + this.pnlyesno = new System.Windows.Forms.Panel(); + this.btnno = new System.Windows.Forms.Button(); + this.btnyes = new System.Windows.Forms.Button(); + this.pgcontents.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pboximage)).BeginInit(); + this.pnlyesno.SuspendLayout(); + this.SuspendLayout(); + // + // pgcontents + // + this.pgcontents.BackColor = System.Drawing.Color.White; + this.pgcontents.Controls.Add(this.txtuserinput); + this.pgcontents.Controls.Add(this.btnok); + this.pgcontents.Controls.Add(this.txtmessage); + this.pgcontents.Controls.Add(this.pboximage); + this.pgcontents.Controls.Add(this.lblintructtext); + this.pgcontents.Controls.Add(this.pnlyesno); + 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(371, 154); + this.pgcontents.TabIndex = 20; + // + // txtuserinput + // + this.txtuserinput.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.txtuserinput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.txtuserinput.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtuserinput.Location = new System.Drawing.Point(103, 86); + this.txtuserinput.Multiline = true; + this.txtuserinput.Name = "txtuserinput"; + this.txtuserinput.Size = new System.Drawing.Size(256, 23); + this.txtuserinput.TabIndex = 8; + this.txtuserinput.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.txtuserinput.Visible = false; + // + // btnok + // + this.btnok.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.btnok.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnok.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnok.ForeColor = System.Drawing.Color.Black; + this.btnok.Location = new System.Drawing.Point(134, 118); + this.btnok.Name = "btnok"; + this.btnok.Size = new System.Drawing.Size(109, 30); + this.btnok.TabIndex = 7; + this.btnok.TabStop = false; + this.btnok.Text = "Ok"; + this.btnok.UseVisualStyleBackColor = true; + this.btnok.Click += new System.EventHandler(this.btnok_Click); + // + // txtmessage + // + this.txtmessage.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.txtmessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.txtmessage.Location = new System.Drawing.Point(102, 7); + this.txtmessage.Name = "txtmessage"; + this.txtmessage.Size = new System.Drawing.Size(266, 102); + this.txtmessage.TabIndex = 2; + this.txtmessage.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // pboximage + // + this.pboximage.Image = global::ShiftOS.Properties.Resources.Symbolinfo1; + this.pboximage.Location = new System.Drawing.Point(12, 7); + this.pboximage.Name = "pboximage"; + this.pboximage.Size = new System.Drawing.Size(80, 70); + this.pboximage.TabIndex = 0; + this.pboximage.TabStop = false; + // + // lblintructtext + // + this.lblintructtext.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.lblintructtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F); + this.lblintructtext.Location = new System.Drawing.Point(105, 7); + this.lblintructtext.Name = "lblintructtext"; + this.lblintructtext.Size = new System.Drawing.Size(256, 76); + this.lblintructtext.TabIndex = 9; + this.lblintructtext.TextAlign = System.Drawing.ContentAlignment.TopCenter; + this.lblintructtext.Visible = false; + // + // pnlyesno + // + this.pnlyesno.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.pnlyesno.Controls.Add(this.btnno); + this.pnlyesno.Controls.Add(this.btnyes); + this.pnlyesno.Location = new System.Drawing.Point(57, 115); + this.pnlyesno.Name = "pnlyesno"; + this.pnlyesno.Size = new System.Drawing.Size(269, 33); + this.pnlyesno.TabIndex = 10; + this.pnlyesno.Visible = false; + // + // btnno + // + this.btnno.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnno.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnno.ForeColor = System.Drawing.Color.Black; + this.btnno.Location = new System.Drawing.Point(142, 2); + this.btnno.Name = "btnno"; + this.btnno.Size = new System.Drawing.Size(105, 30); + this.btnno.TabIndex = 9; + this.btnno.TabStop = false; + this.btnno.Text = "No"; + this.btnno.UseVisualStyleBackColor = true; + this.btnno.Click += new System.EventHandler(this.btnno_Click); + // + // btnyes + // + this.btnyes.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.btnyes.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.btnyes.ForeColor = System.Drawing.Color.Black; + this.btnyes.Location = new System.Drawing.Point(29, 2); + this.btnyes.Name = "btnyes"; + this.btnyes.Size = new System.Drawing.Size(105, 30); + this.btnyes.TabIndex = 8; + this.btnyes.TabStop = false; + this.btnyes.Text = "Yes"; + this.btnyes.UseVisualStyleBackColor = true; + this.btnyes.Click += new System.EventHandler(this.btnyes_Click); + // + // infobox + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(371, 154); + this.Controls.Add(this.pgcontents); + this.DoubleBuffered = true; + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.KeyPreview = true; + this.Name = "infobox"; + this.Text = "infobox"; + this.TopMost = true; + this.Load += new System.EventHandler(this.infobox_Load); + this.pgcontents.ResumeLayout(false); + this.pgcontents.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.pboximage)).EndInit(); + this.pnlyesno.ResumeLayout(false); + this.ResumeLayout(false); + + } + internal System.Windows.Forms.Panel pgcontents; + internal System.Windows.Forms.Button btnok; + internal System.Windows.Forms.Label txtmessage; + internal System.Windows.Forms.PictureBox pboximage; + internal System.Windows.Forms.Label lblintructtext; + internal System.Windows.Forms.TextBox txtuserinput; + internal System.Windows.Forms.Panel pnlyesno; + internal System.Windows.Forms.Button btnno; + internal System.Windows.Forms.Button btnyes; + } +}
\ No newline at end of file diff --git a/source/WindowsFormsApplication1/Controls/infobox.cs b/source/WindowsFormsApplication1/Controls/infobox.cs new file mode 100644 index 0000000..2f706d2 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/infobox.cs @@ -0,0 +1,113 @@ +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; + +namespace ShiftOS +{ + public partial class infobox : Form + { + /// <summary> + /// Creates a new Infobox instance. + /// </summary> + /// <param name="Message">Message to display.</param> + /// <param name="mode">UI mode.</param> + public infobox(string Message, InfoboxMode mode) + { + InitializeComponent(); + + message = Message; + displayMode = mode; + } + + public string Result = "Cancelled"; + public enum InfoboxMode + { + YesNo, + TextEntry, + Info, + } + public InfoboxMode displayMode = InfoboxMode.Info; + private string message = "This is an infobox."; + public string TextEntry + { + get + { + return txtuserinput.Text; + } + } + + + + + + private void btnyes_Click(object sender, EventArgs e) + { + Result = "Yes"; + this.Close(); + } + + private void btnno_Click(object sender, EventArgs e) + { + Result = "No"; + this.Close(); + } + + private void btnok_Click(object sender, EventArgs e) + { + Result = "OK"; + this.Close(); + } + + private void infobox_Load(object sender, EventArgs e) + { + + switch(displayMode) + { + case InfoboxMode.Info: + txtmessage.Show(); + txtmessage.BringToFront(); + txtmessage.Text = message; + this.pnlyesno.Hide(); + this.txtuserinput.Hide(); + break; + case InfoboxMode.YesNo: + txtmessage.Show(); + txtmessage.BringToFront(); + txtmessage.Text = message; + this.pnlyesno.Show(); + this.pnlyesno.BringToFront(); + this.txtuserinput.Hide(); + break; + case InfoboxMode.TextEntry: + txtmessage.Hide(); + lblintructtext.Show(); + lblintructtext.BringToFront(); + lblintructtext.Text = message; + this.pnlyesno.Hide(); + this.txtuserinput.Show(); + this.txtuserinput.BringToFront(); + break; + } + txtuserinput.KeyDown += (object s, KeyEventArgs a) => + { + if (a.KeyCode == Keys.Enter) + { + a.SuppressKeyPress = true; + btnok_Click(s, (EventArgs)a); + } + }; + if (API.InfoboxesPlaySounds) + { + API.PlaySound(Properties.Resources.infobox); + } + } + + + } +} diff --git a/source/WindowsFormsApplication1/Controls/infobox.resx b/source/WindowsFormsApplication1/Controls/infobox.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/source/WindowsFormsApplication1/Controls/infobox.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 |
