aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Applications
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.WinForms/Applications')
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs164
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs131
-rw-r--r--ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx120
3 files changed, 415 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs
new file mode 100644
index 0000000..9612b21
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.Designer.cs
@@ -0,0 +1,164 @@
+namespace ShiftOS.WinForms.Applications
+{
+ partial class WidgetManagerFrontend
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private System.ComponentModel.IContainer components = null;
+
+ /// <summary>
+ /// Clean up any resources being used.
+ /// </summary>
+ /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ /// <summary>
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ /// </summary>
+ private void InitializeComponent()
+ {
+ this.flbody = new System.Windows.Forms.FlowLayoutPanel();
+ this.label1 = new System.Windows.Forms.Label();
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnclose = new System.Windows.Forms.Button();
+ this.btnloaddefault = new System.Windows.Forms.Button();
+ this.btnimport = new System.Windows.Forms.Button();
+ this.btnexport = new System.Windows.Forms.Button();
+ this.btnapply = new System.Windows.Forms.Button();
+ this.flowLayoutPanel1.SuspendLayout();
+ this.SuspendLayout();
+ //
+ // flbody
+ //
+ this.flbody.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.flbody.Location = new System.Drawing.Point(22, 59);
+ this.flbody.Name = "flbody";
+ this.flbody.Size = new System.Drawing.Size(463, 389);
+ this.flbody.TabIndex = 0;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(22, 14);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(89, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Tag = "header1";
+ this.label1.Text = "Desktop Widgets";
+ //
+ // flowLayoutPanel1
+ //
+ this.flowLayoutPanel1.AutoSize = true;
+ this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flowLayoutPanel1.Controls.Add(this.btnclose);
+ this.flowLayoutPanel1.Controls.Add(this.btnloaddefault);
+ this.flowLayoutPanel1.Controls.Add(this.btnimport);
+ this.flowLayoutPanel1.Controls.Add(this.btnexport);
+ this.flowLayoutPanel1.Controls.Add(this.btnapply);
+ this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 461);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(517, 29);
+ this.flowLayoutPanel1.TabIndex = 2;
+ //
+ // btnclose
+ //
+ this.btnclose.AutoSize = true;
+ this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnclose.Location = new System.Drawing.Point(3, 3);
+ this.btnclose.Name = "btnclose";
+ this.btnclose.Size = new System.Drawing.Size(43, 23);
+ this.btnclose.TabIndex = 0;
+ this.btnclose.Text = "Close";
+ this.btnclose.UseVisualStyleBackColor = true;
+ this.btnclose.Click += new System.EventHandler(this.btnclose_Click);
+ //
+ // btnloaddefault
+ //
+ this.btnloaddefault.AutoSize = true;
+ this.btnloaddefault.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnloaddefault.Location = new System.Drawing.Point(52, 3);
+ this.btnloaddefault.Name = "btnloaddefault";
+ this.btnloaddefault.Size = new System.Drawing.Size(76, 23);
+ this.btnloaddefault.TabIndex = 1;
+ this.btnloaddefault.Text = "Load default";
+ this.btnloaddefault.UseVisualStyleBackColor = true;
+ this.btnloaddefault.Click += new System.EventHandler(this.btnloaddefault_Click);
+ //
+ // btnimport
+ //
+ this.btnimport.AutoSize = true;
+ this.btnimport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnimport.Location = new System.Drawing.Point(134, 3);
+ this.btnimport.Name = "btnimport";
+ this.btnimport.Size = new System.Drawing.Size(46, 23);
+ this.btnimport.TabIndex = 2;
+ this.btnimport.Text = "Import";
+ this.btnimport.UseVisualStyleBackColor = true;
+ this.btnimport.Click += new System.EventHandler(this.btnimport_Click);
+ //
+ // btnexport
+ //
+ this.btnexport.AutoSize = true;
+ this.btnexport.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnexport.Location = new System.Drawing.Point(186, 3);
+ this.btnexport.Name = "btnexport";
+ this.btnexport.Size = new System.Drawing.Size(47, 23);
+ this.btnexport.TabIndex = 3;
+ this.btnexport.Text = "Export";
+ this.btnexport.UseVisualStyleBackColor = true;
+ this.btnexport.Click += new System.EventHandler(this.btnexport_Click);
+ //
+ // btnapply
+ //
+ this.btnapply.AutoSize = true;
+ this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnapply.Location = new System.Drawing.Point(239, 3);
+ this.btnapply.Name = "btnapply";
+ this.btnapply.Size = new System.Drawing.Size(43, 23);
+ this.btnapply.TabIndex = 4;
+ this.btnapply.Text = "Apply";
+ this.btnapply.UseVisualStyleBackColor = true;
+ this.btnapply.Click += new System.EventHandler(this.btnapply_Click);
+ //
+ // WidgetManagerFrontend
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.flowLayoutPanel1);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.flbody);
+ this.Name = "WidgetManagerFrontend";
+ this.Size = new System.Drawing.Size(517, 490);
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.flowLayoutPanel1.PerformLayout();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.FlowLayoutPanel flbody;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.Button btnclose;
+ private System.Windows.Forms.Button btnloaddefault;
+ private System.Windows.Forms.Button btnimport;
+ private System.Windows.Forms.Button btnexport;
+ private System.Windows.Forms.Button btnapply;
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs
new file mode 100644
index 0000000..6424710
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.cs
@@ -0,0 +1,131 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.Engine;
+using ShiftOS.WinForms.Tools;
+using Newtonsoft.Json;
+using ShiftOS.Objects.ShiftFS;
+
+namespace ShiftOS.WinForms.Applications
+{
+ [WinOpen("desktop_widgets")]
+ [Launcher("Widget Manager", true, "al_widget_manager", "Customization")]
+ [DefaultTitle("Widget Manager")]
+ [RequiresUpgrade("desktop_widgets")]
+ public partial class WidgetManagerFrontend : UserControl, IShiftOSWindow
+ {
+ public WidgetManagerFrontend()
+ {
+ InitializeComponent();
+ }
+
+ Dictionary<string, WidgetDetails> temp_details = null;
+
+ public void SetupUI()
+ {
+ flbody.Controls.Clear();
+ if(temp_details == null)
+ temp_details = new Dictionary<string, WinForms.WidgetDetails>();
+ foreach(var widgetType in WidgetManager.GetAllWidgetTypes())
+ {
+
+ var details = WidgetManager.LoadDetails(widgetType.Value);
+ if (temp_details.ContainsKey(widgetType.Key.ToString()))
+ details = temp_details[widgetType.Key.ToString()];
+ else
+ temp_details.Add(widgetType.Key.ToString(), details);
+ var cbox = new CheckBox();
+ cbox.Checked = details.IsVisible;
+ cbox.Size = new Size(32, 32);
+ cbox.CheckedChanged += (o, a) =>
+ {
+ details.IsVisible = cbox.Checked;
+ };
+ flbody.Controls.Add(cbox);
+ cbox.Show();
+ var title = new Label();
+ title.Text = widgetType.Key.Name;
+ title.AutoSize = true;
+ title.Tag = "header3";
+ ControlManager.SetupControl(title);
+ flbody.Controls.Add(title);
+ title.Show();
+ var desc = new Label();
+ desc.Text = widgetType.Key.Description;
+ flbody.Controls.Add(desc);
+ flbody.SetFlowBreak(desc, true);
+ flbody.SetFlowBreak(title, true);
+ desc.Show();
+ }
+ }
+
+ public void OnLoad()
+ {
+ SetupUI();
+ }
+
+ public void OnSkinLoad()
+ {
+ SetupUI();
+ }
+
+ public bool OnUnload()
+ {
+ return false;
+ }
+
+ public void OnUpgrade()
+ {
+ SetupUI();
+ }
+
+ private void btnapply_Click(object sender, EventArgs e)
+ {
+ Utils.WriteAllText(Paths.GetPath("widgets.dat"), JsonConvert.SerializeObject(temp_details));
+ Desktop.CurrentDesktop.SetupDesktop();
+ }
+
+ private void btnexport_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".wid" }, FileOpenerStyle.Save, (path) =>
+ {
+ Utils.WriteAllText(path, JsonConvert.SerializeObject(temp_details));
+ });
+ }
+
+ private void btnimport_Click(object sender, EventArgs e)
+ {
+ FileSkimmerBackend.GetFile(new[] { ".wid" }, FileOpenerStyle.Open, (path) =>
+ {
+ temp_details = JsonConvert.DeserializeObject<Dictionary<string, WidgetDetails>>(Utils.ReadAllText(path));
+ SetupUI();
+ });
+
+ }
+
+ private void btnloaddefault_Click(object sender, EventArgs e)
+ {
+ temp_details.Clear();
+ foreach(var type in WidgetManager.GetAllWidgetTypes())
+ {
+ temp_details.Add(type.Key.ToString(), new WidgetDetails
+ {
+ IsVisible = false,
+ Location = new Point(-1, -1)
+ });
+ }
+ SetupUI();
+ }
+
+ private void btnclose_Click(object sender, EventArgs e)
+ {
+ AppearanceManager.Close(this);
+ }
+ }
+}
diff --git a/ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx
new file mode 100644
index 0000000..1af7de1
--- /dev/null
+++ b/ShiftOS.WinForms/Applications/WidgetManagerFrontend.resx
@@ -0,0 +1,120 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" use="required" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ <xsd:attribute ref="xml:space" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file