diff options
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs | 83 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/ExperienceShifter.cs | 51 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/ExperienceShifter.resx | 3 |
3 files changed, 108 insertions, 29 deletions
diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs index 9a0d54c..02cb01b 100644 --- a/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.Designer.cs @@ -32,16 +32,19 @@ this.desktopToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.appLauncherToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.pnldesktop = new System.Windows.Forms.Panel(); + this.lbdesktops = new System.Windows.Forms.ListBox(); this.gpdesktopsettings = new System.Windows.Forms.GroupBox(); this.label2 = new System.Windows.Forms.Label(); this.pnlapplauncher = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.lbdesktops = new System.Windows.Forms.ListBox(); - this.gpalsettings = new System.Windows.Forms.GroupBox(); this.lblaunchers = new System.Windows.Forms.ListBox(); + this.gpalsettings = new System.Windows.Forms.GroupBox(); + this.label1 = new System.Windows.Forms.Label(); + this.menuStrip2 = new System.Windows.Forms.MenuStrip(); + this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.menuStrip1.SuspendLayout(); this.pnldesktop.SuspendLayout(); this.pnlapplauncher.SuspendLayout(); + this.menuStrip2.SuspendLayout(); this.SuspendLayout(); // // menuStrip1 @@ -71,6 +74,7 @@ // // pnldesktop // + this.pnldesktop.Controls.Add(this.menuStrip2); this.pnldesktop.Controls.Add(this.lbdesktops); this.pnldesktop.Controls.Add(this.gpdesktopsettings); this.pnldesktop.Controls.Add(this.label2); @@ -80,6 +84,16 @@ this.pnldesktop.Size = new System.Drawing.Size(582, 407); this.pnldesktop.TabIndex = 1; // + // lbdesktops + // + this.lbdesktops.Dock = System.Windows.Forms.DockStyle.Fill; + this.lbdesktops.FormattingEnabled = true; + this.lbdesktops.Location = new System.Drawing.Point(0, 23); + this.lbdesktops.Name = "lbdesktops"; + this.lbdesktops.Size = new System.Drawing.Size(582, 239); + this.lbdesktops.TabIndex = 0; + this.lbdesktops.SelectedIndexChanged += new System.EventHandler(this.lbdesktops_SelectedIndexChanged); + // // gpdesktopsettings // this.gpdesktopsettings.Dock = System.Windows.Forms.DockStyle.Bottom; @@ -113,6 +127,25 @@ this.pnlapplauncher.Size = new System.Drawing.Size(582, 407); this.pnlapplauncher.TabIndex = 0; // + // lblaunchers + // + this.lblaunchers.Dock = System.Windows.Forms.DockStyle.Fill; + this.lblaunchers.FormattingEnabled = true; + this.lblaunchers.Location = new System.Drawing.Point(0, 23); + this.lblaunchers.Name = "lblaunchers"; + this.lblaunchers.Size = new System.Drawing.Size(582, 239); + this.lblaunchers.TabIndex = 4; + // + // gpalsettings + // + this.gpalsettings.Dock = System.Windows.Forms.DockStyle.Bottom; + this.gpalsettings.Location = new System.Drawing.Point(0, 262); + this.gpalsettings.Name = "gpalsettings"; + this.gpalsettings.Size = new System.Drawing.Size(582, 145); + this.gpalsettings.TabIndex = 3; + this.gpalsettings.TabStop = false; + this.gpalsettings.Text = "Settings for this environment"; + // // label1 // this.label1.AutoSize = true; @@ -125,40 +158,30 @@ this.label1.Tag = "header2"; this.label1.Text = "App Launcher"; // - // lbdesktops + // menuStrip2 // - this.lbdesktops.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbdesktops.FormattingEnabled = true; - this.lbdesktops.Location = new System.Drawing.Point(0, 23); - this.lbdesktops.Name = "lbdesktops"; - this.lbdesktops.Size = new System.Drawing.Size(582, 239); - this.lbdesktops.TabIndex = 0; - // - // gpalsettings - // - this.gpalsettings.Dock = System.Windows.Forms.DockStyle.Bottom; - this.gpalsettings.Location = new System.Drawing.Point(0, 262); - this.gpalsettings.Name = "gpalsettings"; - this.gpalsettings.Size = new System.Drawing.Size(582, 145); - this.gpalsettings.TabIndex = 3; - this.gpalsettings.TabStop = false; - this.gpalsettings.Text = "Settings for this environment"; + this.menuStrip2.Dock = System.Windows.Forms.DockStyle.Bottom; + this.menuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addToolStripMenuItem}); + this.menuStrip2.Location = new System.Drawing.Point(0, 238); + this.menuStrip2.Name = "menuStrip2"; + this.menuStrip2.Size = new System.Drawing.Size(582, 24); + this.menuStrip2.TabIndex = 0; + this.menuStrip2.Text = "menuStrip2"; // - // lblaunchers + // addToolStripMenuItem // - this.lblaunchers.Dock = System.Windows.Forms.DockStyle.Fill; - this.lblaunchers.FormattingEnabled = true; - this.lblaunchers.Location = new System.Drawing.Point(0, 23); - this.lblaunchers.Name = "lblaunchers"; - this.lblaunchers.Size = new System.Drawing.Size(582, 239); - this.lblaunchers.TabIndex = 4; + this.addToolStripMenuItem.Name = "addToolStripMenuItem"; + this.addToolStripMenuItem.Size = new System.Drawing.Size(41, 20); + this.addToolStripMenuItem.Text = "Add"; + this.addToolStripMenuItem.Click += new System.EventHandler(this.addToolStripMenuItem_Click); // // ExperienceShifter // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.Controls.Add(this.pnlapplauncher); this.Controls.Add(this.pnldesktop); + this.Controls.Add(this.pnlapplauncher); this.Controls.Add(this.menuStrip1); this.Name = "ExperienceShifter"; this.Size = new System.Drawing.Size(582, 431); @@ -168,6 +191,8 @@ this.pnldesktop.PerformLayout(); this.pnlapplauncher.ResumeLayout(false); this.pnlapplauncher.PerformLayout(); + this.menuStrip2.ResumeLayout(false); + this.menuStrip2.PerformLayout(); this.ResumeLayout(false); this.PerformLayout(); @@ -186,5 +211,7 @@ private System.Windows.Forms.ListBox lbdesktops; private System.Windows.Forms.ListBox lblaunchers; private System.Windows.Forms.GroupBox gpalsettings; + private System.Windows.Forms.MenuStrip menuStrip2; + private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem; } } diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.cs b/ShiftOS.WinForms/Applications/ExperienceShifter.cs index 2623b88..281b723 100644 --- a/ShiftOS.WinForms/Applications/ExperienceShifter.cs +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.cs @@ -9,6 +9,8 @@ using System.Threading.Tasks; using System.Windows.Forms; using ShiftOS.Engine; +using ShiftOS.Objects.ShiftFS; +using Newtonsoft.Json; namespace ShiftOS.WinForms.Applications { @@ -42,12 +44,27 @@ namespace ShiftOS.WinForms.Applications public void PopulateDesktops() { lbdesktops.Items.Clear(); - foreach(var desk in Desktop.GetAllDesktops()) + foreach(var desk in GetAllDesktops()) { lbdesktops.Items.Add(desk.DesktopName); } } + public List<IDesktop> GetAllDesktops() + { + List<IDesktop> dekstops = new List<IDesktop>(); + dekstops.Add(new WinformsDesktop()); + if (!Utils.FileExists(Paths.GetPath("conf.sft"))) + Utils.WriteAllText(Paths.GetPath("conf.sft"), JsonConvert.SerializeObject(new ShiftOSConfigFile(), Formatting.Indented)); + + foreach(var script in JsonConvert.DeserializeObject<ShiftOSConfigFile>(Utils.ReadAllText(Paths.GetPath("conf.sft"))).Desktops) + { + if(Utils.FileExists(script)) + dekstops.Add(new LuaDesktop(script)); + } + return dekstops; + } + public void PopulateLaunchers() { lblaunchers.Items.Clear(); @@ -83,5 +100,37 @@ namespace ShiftOS.WinForms.Applications currentUI = "applauncher"; SetupUI(); } + + private void addToolStripMenuItem_Click(object sender, EventArgs e) + { + FileSkimmerBackend.GetFile(new[] { ".lua" }, FileOpenerStyle.Open, new Action<string>((script) => + { + ShiftOSConfigFile conf = new WinForms.ShiftOSConfigFile(); + if (Utils.FileExists(Paths.GetPath("conf.sft"))) + { + conf = JsonConvert.DeserializeObject<ShiftOSConfigFile>(Utils.ReadAllText(Paths.GetPath("conf.sft"))); + } + conf.Desktops.Add(script); + Utils.WriteAllText(Paths.GetPath("conf.sft"), JsonConvert.SerializeObject(conf, Formatting.Indented)); + })); + } + + private void lbdesktops_SelectedIndexChanged(object sender, EventArgs e) + { + foreach(var desk in GetAllDesktops()) + { + try + { + if(desk.DesktopName == lbdesktops.SelectedItem.ToString()) + { + Desktop.Init(desk, true); + } + } + catch + { + + } + } + } } } diff --git a/ShiftOS.WinForms/Applications/ExperienceShifter.resx b/ShiftOS.WinForms/Applications/ExperienceShifter.resx index d5494e3..2d404e0 100644 --- a/ShiftOS.WinForms/Applications/ExperienceShifter.resx +++ b/ShiftOS.WinForms/Applications/ExperienceShifter.resx @@ -120,4 +120,7 @@ <metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>17, 17</value> </metadata> + <metadata name="menuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>132, 17</value> + </metadata> </root>
\ No newline at end of file |
