aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Main/ShiftOS/Apps
diff options
context:
space:
mode:
Diffstat (limited to 'ShiftOS.Main/ShiftOS/Apps')
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs2
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs34
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs2
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs92
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs8
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs201
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/Terminal.cs143
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs2
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/TestForm.cs41
-rw-r--r--ShiftOS.Main/ShiftOS/Apps/TextPad.cs76
10 files changed, 283 insertions, 318 deletions
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs
index 7fd37f0..f8ee8e3 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.Designer.cs
@@ -1,4 +1,4 @@
-namespace ShiftOS.Main
+namespace ShiftOS.Main.ShiftOS.Apps
{
partial class ShiftDemo
{
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs
index 11fc160..ced10d2 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShiftDemo.cs
@@ -1,26 +1,18 @@
-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.Windows.Forms;
using ShiftOS.Engine.WindowManager;
-namespace ShiftOS.Main
+namespace ShiftOS.Main.ShiftOS.Apps
{
- public partial class ShiftDemo : UserControl, IShiftWindowExtensions
- {
- public ShiftDemo()
- {
- InitializeComponent();
- }
+ public partial class ShiftDemo : UserControl, IShiftWindowExtensions
+ {
+ public ShiftDemo()
+ {
+ InitializeComponent();
+ }
- public void OnLoaded(ShiftWindow window)
- {
- icon.Image = this.GetShiftWindow().Icon.ToBitmap();
- }
+ public void OnLoaded(ShiftWindow window)
+ {
+ icon.Image = this.GetShiftWindow().Icon.ToBitmap();
+ }
}
-}
+} \ No newline at end of file
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs
index a7473a0..5d50bc0 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.Designer.cs
@@ -1,4 +1,4 @@
-namespace ShiftOS.Main.ShiftOS.Apps
+namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
{
partial class SelectColor
{
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs
index f26fe4d..543529a 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/SelectColor.cs
@@ -1,50 +1,54 @@
using System;
using System.Drawing;
+using System.Globalization;
using System.Windows.Forms;
using ShiftOS.Engine.WindowManager;
-namespace ShiftOS.Main.ShiftOS.Apps
+namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
{
- public partial class SelectColor : UserControl
- {
- Color _finalColor;
- int _colorType1;
- int _colorType2;
- int _colorType3;
- public SelectColor()
- {
- InitializeComponent();
-
- }
-
- private Color setColor()
- {
- _colorType1 = Int32.Parse(redUpDown.Value.ToString());
- _colorType2 = Int32.Parse(greenUpDown.Value.ToString());
- _colorType3 = Int32.Parse(blueUpDown.Value.ToString());
- try
- {
- _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
-
-
- foreach (var window in ShiftWM.Windows)
-{
- window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor));
- }
-
-
- ShiftWM.StartInfoboxSession("Success!", $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.", InfoboxTemplate.ButtonType.Ok);
- }
- catch (Exception)
- {
- ShiftWM.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok);
- }
- return _finalColor;
- }
-
- private void btnSetColor_Click(object sender, EventArgs e)
- {
- setColor();
- }
- }
-}
+ public partial class SelectColor : UserControl
+ {
+ int _colorType1;
+ int _colorType2;
+ int _colorType3;
+ Color _finalColor;
+
+ public SelectColor()
+ {
+ InitializeComponent();
+ }
+
+ Color SetColor()
+ {
+ _colorType1 = int.Parse(redUpDown.Value.ToString(CultureInfo.InvariantCulture));
+ _colorType2 = int.Parse(greenUpDown.Value.ToString(CultureInfo.InvariantCulture));
+ _colorType3 = int.Parse(blueUpDown.Value.ToString(CultureInfo.InvariantCulture));
+ try
+ {
+ _finalColor = Color.FromArgb(_colorType1, _colorType2, _colorType3);
+
+
+ foreach (var window in ShiftWm.Windows)
+ {
+ window.Invoke(new Action(() => window.titleBar.BackColor = _finalColor));
+ }
+
+
+ ShiftWm.StartInfoboxSession(
+ "Success!",
+ $"Changed color to:\r\n{_colorType1}, {_colorType2}, {_colorType3}.",
+ InfoboxTemplate.ButtonType.Ok);
+ }
+ catch (Exception)
+ {
+ ShiftWm.StartInfoboxSession("Error!", "An error occured while setting the color.", InfoboxTemplate.ButtonType.Ok);
+ }
+ return _finalColor;
+ }
+
+ void btnSetColor_Click(object sender, EventArgs e)
+ {
+ SetColor();
+ }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs
index ac81a5c..2ed43b4 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.Designer.cs
@@ -1,4 +1,4 @@
-namespace ShiftOS.Main.ShiftOS.Apps
+namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
{
partial class Shifter
{
@@ -94,7 +94,7 @@
this.button4.TabIndex = 4;
this.button4.Text = "Set Random Skin";
this.button4.UseVisualStyleBackColor = true;
- this.button4.Click += new System.EventHandler(this.setRandomSkin);
+ this.button4.Click += new System.EventHandler(this.SetRandomSkin);
//
// button3
//
@@ -106,7 +106,7 @@
this.button3.TabIndex = 3;
this.button3.Text = "Set Default Skin";
this.button3.UseVisualStyleBackColor = true;
- this.button3.Click += new System.EventHandler(this.setDefaultSkin);
+ this.button3.Click += new System.EventHandler(this.SetDefaultSkin);
//
// button2
//
@@ -118,7 +118,7 @@
this.button2.TabIndex = 2;
this.button2.Text = "Set Colorful Skin";
this.button2.UseVisualStyleBackColor = true;
- this.button2.Click += new System.EventHandler(this.setColorSkin);
+ this.button2.Click += new System.EventHandler(this.SetColorSkin);
//
// groupBox1
//
diff --git a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs
index 609b617..f7c9752 100644
--- a/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/ShifterStuff/Shifter.cs
@@ -1,113 +1,116 @@
using System;
-using System.Windows.Forms;
-using ShiftOS.Engine;
-using ShiftOS.Engine.WindowManager;
using System.Drawing;
using System.IO;
+using System.Windows.Forms;
using Newtonsoft.Json;
+using ShiftOS.Engine.Misc;
+using ShiftOS.Engine.WindowManager;
+using ShiftOS.Main.Properties;
-namespace ShiftOS.Main.ShiftOS.Apps
+namespace ShiftOS.Main.ShiftOS.Apps.ShifterStuff
{
- public partial class Shifter : UserControl
- {
- public int colorType; //This is a check to see what option was chosen.
- public Shifter()
- {
- InitializeComponent();
- }
+ public partial class Shifter : UserControl
+ {
+ public int ColorType; //This is a check to see what option was chosen.
- private void button1_Click(object sender, EventArgs e)
- {
- colorType = 1;
- ShiftWM.Init(new SelectColor(), "Select a color", Properties.Resources.iconColourPicker_fw.ToIcon());
- }
+ public Shifter()
+ {
+ InitializeComponent();
+ }
- private void setDefaultSkin(object sender, EventArgs e)
- {
- setBorderColor(Color.FromArgb(64, 64, 64));
- ShiftSkinData.btnCloseColor = Color.Black;
- ShiftSkinData.btnMaxColor = Color.Black;
- ShiftSkinData.btnMinColor = Color.Black;
- button5_Click(sender, e);
- }
+ void button1_Click(object sender, EventArgs e)
+ {
+ ColorType = 1;
+ ShiftWm.Init(new SelectColor(), "Select a color", Resources.iconColourPicker_fw.ToIcon());
+ }
- private void setColorSkin(object sender, EventArgs e)
- {
- setBorderColor(Color.Blue);
- ShiftSkinData.btnCloseColor = Color.Red;
- ShiftSkinData.btnMaxColor = Color.Yellow;
- ShiftSkinData.btnMinColor = Color.Green;
- ShiftSkinData.btnCloseHoverColor = Color.FromArgb(255, 102, 102);
- ShiftSkinData.btnMaxHoverColor = Color.FromArgb(255, 255, 153);
- ShiftSkinData.btnMinColor = Color.FromArgb(102, 255, 102);
- button5_Click(sender, e);
- }
+ void SetDefaultSkin(object sender, EventArgs e)
+ {
+ SetBorderColor(Color.FromArgb(64, 64, 64));
+ ShiftSkinData.BtnCloseColor = Color.Black;
+ ShiftSkinData.BtnMaxColor = Color.Black;
+ ShiftSkinData.BtnMinColor = Color.Black;
+ button5_Click(sender, e);
+ }
- private void setRandomSkin(object sender, EventArgs e)
- {
- Random rnd = new Random();
- setBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
- ShiftSkinData.btnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- ShiftSkinData.btnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- ShiftSkinData.btnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- ShiftSkinData.btnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- ShiftSkinData.btnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- ShiftSkinData.btnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
- button5_Click(sender, e);
- }
+ void SetColorSkin(object sender, EventArgs e)
+ {
+ SetBorderColor(Color.Blue);
+ ShiftSkinData.BtnCloseColor = Color.Red;
+ ShiftSkinData.BtnMaxColor = Color.Yellow;
+ ShiftSkinData.BtnMinColor = Color.Green;
+ ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(255, 102, 102);
+ ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(255, 255, 153);
+ ShiftSkinData.BtnMinColor = Color.FromArgb(102, 255, 102);
+ button5_Click(sender, e);
+ }
- // SetBorderColor
- public void setBorderColor(Color borderColor)
- {
- ShiftSkinData.leftTopCornerColor = borderColor;
- ShiftSkinData.titleBarColor = borderColor;
- ShiftSkinData.rightTopCornerColor = borderColor;
- ShiftSkinData.leftSideColor = borderColor;
- ShiftSkinData.rightSideColor = borderColor;
- ShiftSkinData.leftBottomCornerColor = borderColor;
- ShiftSkinData.bottomSideColor = borderColor;
- ShiftSkinData.rightBottomCornerColor = borderColor;
- }
+ void SetRandomSkin(object sender, EventArgs e)
+ {
+ var rnd = new Random();
+ SetBorderColor(Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255)));
+ ShiftSkinData.BtnCloseColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ ShiftSkinData.BtnMaxColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ ShiftSkinData.BtnMinColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ ShiftSkinData.BtnCloseHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ ShiftSkinData.BtnMaxHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ ShiftSkinData.BtnMinHoverColor = Color.FromArgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
+ button5_Click(sender, e);
+ }
- private void button5_Click(object sender, EventArgs e)
- {
+ // SetBorderColor
+ public void SetBorderColor(Color borderColor)
+ {
+ ShiftSkinData.LeftTopCornerColor = borderColor;
+ ShiftSkinData.TitleBarColor = borderColor;
+ ShiftSkinData.RightTopCornerColor = borderColor;
+ ShiftSkinData.LeftSideColor = borderColor;
+ ShiftSkinData.RightSideColor = borderColor;
+ ShiftSkinData.LeftBottomCornerColor = borderColor;
+ ShiftSkinData.BottomSideColor = borderColor;
+ ShiftSkinData.RightBottomCornerColor = borderColor;
+ }
- foreach (var window in ShiftWM.Windows)
- {
- window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.titleBarColor));
- window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.leftTopCornerColor));
- window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.rightTopCornerColor));
- window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.leftSideColor));
- window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.rightSideColor));
- window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.leftBottomCornerColor));
- window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.bottomSideColor));
- window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.rightBottomCornerColor));
- window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.btnCloseColor));
- window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.btnMaxColor));
- window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.btnMinColor));
-
- }
- }
+ void button5_Click(object sender, EventArgs e)
+ {
+ foreach (var window in ShiftWm.Windows)
+ {
+ window.Invoke(new Action(() => window.titleBar.BackColor = ShiftSkinData.TitleBarColor));
+ window.Invoke(new Action(() => window.leftTopCorner.BackColor = ShiftSkinData.LeftTopCornerColor));
+ window.Invoke(new Action(() => window.rightTopCorner.BackColor = ShiftSkinData.RightTopCornerColor));
+ window.Invoke(new Action(() => window.leftSide.BackColor = ShiftSkinData.LeftSideColor));
+ window.Invoke(new Action(() => window.rightSide.BackColor = ShiftSkinData.RightSideColor));
+ window.Invoke(new Action(() => window.leftBottomCorner.BackColor = ShiftSkinData.LeftBottomCornerColor));
+ window.Invoke(new Action(() => window.bottomSide.BackColor = ShiftSkinData.BottomSideColor));
+ window.Invoke(new Action(() => window.rightBottomCorner.BackColor = ShiftSkinData.RightBottomCornerColor));
+ window.Invoke(new Action(() => window.btnClose.BackColor = ShiftSkinData.BtnCloseColor));
+ window.Invoke(new Action(() => window.btnMax.BackColor = ShiftSkinData.BtnMaxColor));
+ window.Invoke(new Action(() => window.btnMin.BackColor = ShiftSkinData.BtnMinColor));
+ }
+ }
- private void btnSave_Click(object sender, EventArgs e)
- {
- Color[] shiftColors = new Color[14];
- shiftColors[0] = ShiftSkinData.leftTopCornerColor;
- shiftColors[1] = ShiftSkinData.titleBarColor;
- shiftColors[2] = ShiftSkinData.rightTopCornerColor;
- shiftColors[3] = ShiftSkinData.leftSideColor;
- shiftColors[4] = ShiftSkinData.rightSideColor;
- shiftColors[5] = ShiftSkinData.leftBottomCornerColor;
- shiftColors[6] = ShiftSkinData.bottomSideColor;
- shiftColors[7] = ShiftSkinData.rightBottomCornerColor;
- shiftColors[8] = ShiftSkinData.btnCloseColor;
- shiftColors[9] = ShiftSkinData.btnMaxColor;
- shiftColors[10] = ShiftSkinData.btnMinColor;
- shiftColors[11] = ShiftSkinData.btnCloseHoverColor;
- shiftColors[12] = ShiftSkinData.btnMaxHoverColor;
- shiftColors[13] = ShiftSkinData.btnMinHoverColor;
- File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors));
- ShiftWM.StartInfoboxSession("Saved Skin", "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json", InfoboxTemplate.ButtonType.Ok);
- }
- }
-}
+ void btnSave_Click(object sender, EventArgs e)
+ {
+ var shiftColors = new Color[14];
+ shiftColors[0] = ShiftSkinData.LeftTopCornerColor;
+ shiftColors[1] = ShiftSkinData.TitleBarColor;
+ shiftColors[2] = ShiftSkinData.RightTopCornerColor;
+ shiftColors[3] = ShiftSkinData.LeftSideColor;
+ shiftColors[4] = ShiftSkinData.RightSideColor;
+ shiftColors[5] = ShiftSkinData.LeftBottomCornerColor;
+ shiftColors[6] = ShiftSkinData.BottomSideColor;
+ shiftColors[7] = ShiftSkinData.RightBottomCornerColor;
+ shiftColors[8] = ShiftSkinData.BtnCloseColor;
+ shiftColors[9] = ShiftSkinData.BtnMaxColor;
+ shiftColors[10] = ShiftSkinData.BtnMinColor;
+ shiftColors[11] = ShiftSkinData.BtnCloseHoverColor;
+ shiftColors[12] = ShiftSkinData.BtnMaxHoverColor;
+ shiftColors[13] = ShiftSkinData.BtnMinHoverColor;
+ File.WriteAllText(@"C:\Users\Public\Documents\Skin.json", JsonConvert.SerializeObject(shiftColors));
+ ShiftWm.StartInfoboxSession(
+ "Saved Skin",
+ "Saved Skin to C:\\Users\\Public\\Documents\\Skin.json",
+ InfoboxTemplate.ButtonType.Ok);
+ }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
index a9bd093..4c11136 100644
--- a/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/Terminal.cs
@@ -1,95 +1,80 @@
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.Engine.Terminal;
namespace ShiftOS.Main.ShiftOS.Apps
{
- public partial class Terminal : UserControl
- {
- public string defaulttextBefore = "user> ";
- public string defaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!!
- public bool doClear = false;
+ public partial class Terminal : UserControl
+ {
+ public string DefaulttextBefore = "user> ";
+ string DefaulttextResult = "user@shiftos> "; // NOT YET IMPLEMENTED!!!
+ bool DoClear = false;
- // The below variables makes the terminal... a terminal!
- public string OldText = "";
- public int TrackingPosition = 0;
+ // The below variables makes the terminal... a terminal!
+ string OldText = "";
- public Terminal()
- {
- InitializeComponent();
+ int TrackingPosition;
- termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
- }
+ public Terminal()
+ {
+ InitializeComponent();
- public void Print(string text)
- {
- termmain.AppendText($"\n {text} \n {defaulttextResult}");
- TrackingPosition = termmain.Text.Length;
- }
+ termmain.ContextMenuStrip = new ContextMenuStrip(); // Disables the right click of a richtextbox!
+ }
- private void termmain_KeyDown(object sender, KeyEventArgs e)
- {
- // The below code disables the ability to paste anything other then text...
+ void Print(string text)
+ {
+ termmain.AppendText($"\n {text} \n {DefaulttextResult}");
+ TrackingPosition = termmain.Text.Length;
+ }
- if (e.Control && e.KeyCode == Keys.V)
- {
- //if (Clipboard.ContainsText())
- // termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
- e.Handled = true;
- } else if (e.KeyCode == Keys.Enter) {
- Print(TerminalBackend.RunCommand(termmain.Text.Substring(TrackingPosition, termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application!
- e.Handled = true;
- }
- }
+ void termmain_KeyDown(object sender, KeyEventArgs e)
+ {
+ // The below code disables the ability to paste anything other then text...
- private void termmain_TextChanged(object sender, EventArgs e)
- {
- if (termmain.SelectionStart < TrackingPosition)
- {
- if (doClear == false) // If it's not clearing the terminal
- {
- termmain.Text = OldText;
- termmain.Select(termmain.Text.Length, 0);
- }
- }
- else
- {
- OldText = termmain.Text;
- }
- }
+ if (e.Control && e.KeyCode == Keys.V)
+ {
+ //if (Clipboard.ContainsText())
+ // termmain.Paste(DataFormats.GetFormat(DataFormats.Text));
+ e.Handled = true;
+ }
+ else if (e.KeyCode == Keys.Enter)
+ {
+ Print(
+ TerminalBackend.RunCommand(
+ termmain.Text.Substring(
+ TrackingPosition,
+ termmain.Text.Length - TrackingPosition))); // The most horrific line in the entire application!
+ e.Handled = true;
+ }
+ }
- private void termmain_SelectionChanged(object sender, EventArgs e)
- {
- if (termmain.SelectionStart < TrackingPosition)
- {
- termmain.Text = OldText;
- termmain.Select(termmain.Text.Length, 0);
- }
- }
+ void termmain_TextChanged(object sender, EventArgs e)
+ {
+ if (termmain.SelectionStart < TrackingPosition)
+ {
+ if (DoClear) return;
+
+ termmain.Text = OldText;
+ termmain.Select(termmain.Text.Length, 0);
+ }
+ else
+ {
+ OldText = termmain.Text;
+ }
+ }
- private void Terminal_Load(object sender, EventArgs e)
- {
- Print("\n");
- }
+ void termmain_SelectionChanged(object sender, EventArgs e)
+ {
+ if (termmain.SelectionStart >= TrackingPosition) return;
+
+ termmain.Text = OldText;
+ termmain.Select(termmain.Text.Length, 0);
+ }
- public string RunCommand(string command)
- {
- string ToReturn = "";
-
- if (command == "hi")
- {
- ToReturn = $"{ToReturn} \n Hi!";
- MessageBox.Show("HI!");
- }
- return ToReturn;
- }
- }
-}
+ void Terminal_Load(object sender, EventArgs e)
+ {
+ Print("\n");
+ }
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs
index 50bcb58..b49924e 100644
--- a/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.Designer.cs
@@ -1,4 +1,4 @@
-namespace ShiftOS.Main
+namespace ShiftOS.Main.ShiftOS.Apps
{
partial class TestForm
{
diff --git a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs
index 389f8d1..5929a66 100644
--- a/ShiftOS.Main/ShiftOS/Apps/TestForm.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/TestForm.cs
@@ -1,28 +1,27 @@
using System;
-using System.Drawing;
-using System.Linq;
using System.Windows.Forms;
-using ShiftOS.Engine;
+using ShiftOS.Engine.Misc;
using ShiftOS.Engine.WindowManager;
-using ShiftOS.Main.ShiftOS.Apps;
+using ShiftOS.Main.Properties;
+using ShiftOS.Main.ShiftOS.Apps.ShifterStuff;
-namespace ShiftOS.Main
+namespace ShiftOS.Main.ShiftOS.Apps
{
- public partial class TestForm : Form
- {
- public TestForm()
- {
- InitializeComponent();
- }
+ public partial class TestForm : Form
+ {
+ public TestForm()
+ {
+ InitializeComponent();
+ }
- private void Button1_Click(object sender, EventArgs e)
- {
- ShiftDemo demo = new ShiftDemo();
- ShiftWM.Init(demo, textBox1.Text, null);
- ShiftWM.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok);
- }
+ void Button1_Click(object sender, EventArgs e)
+ {
+ var demo = new ShiftDemo();
+ ShiftWm.Init(demo, textBox1.Text, null);
+ ShiftWm.StartInfoboxSession(textBox1.Text, textBox2.Text, InfoboxTemplate.ButtonType.Ok);
+ }
- private void button2_Click(object sender, EventArgs e)
- => ShiftWM.Init(new Shifter(), "Shifter", Properties.Resources.iconShifter.ToIcon());
- }
-}
+ void button2_Click(object sender, EventArgs e)
+ => ShiftWm.Init(new Shifter(), "Shifter", Resources.iconShifter.ToIcon());
+ }
+} \ No newline at end of file
diff --git a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs
index 6c091df..e86b1be 100644
--- a/ShiftOS.Main/ShiftOS/Apps/TextPad.cs
+++ b/ShiftOS.Main/ShiftOS/Apps/TextPad.cs
@@ -1,54 +1,36 @@
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;
-using ShiftOS.Engine;
+using System.Windows.Forms;
namespace ShiftOS.Main.ShiftOS.Apps
{
- public partial class TextPad : UserControl
- {
- string editedText;
- public TextPad()
- {
- InitializeComponent();
- editedText = textBox.Text;
- }
- private bool isEdited(string editedString)
- {
- editedString = editedText;
- if(editedString != textBox.Text)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
+ public partial class TextPad : UserControl
+ {
+ readonly string _editedText;
+
+ public TextPad()
+ {
+ InitializeComponent();
+ _editedText = textBox.Text;
+ }
+
+ bool IsEdited() => _editedText != textBox.Text;
- private void openToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (openFileDialog1.ShowDialog() == DialogResult.OK)
- {
- var sr = new StreamReader(openFileDialog1.FileName);
- textBox.Text = sr.ReadToEnd();
- sr.Close();
- }
- }
+ void openToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (openFileDialog1.ShowDialog() != DialogResult.OK) return;
+
+ var sr = new StreamReader(openFileDialog1.FileName);
+ textBox.Text = sr.ReadToEnd();
+ sr.Close();
+ }
- private void newToolStripMenuItem_Click(object sender, EventArgs e)
- {
- if (isEdited(textBox.Text))
- {
- MessageBox.Show("yay it works");
- }
- }
- }
-}
+ void newToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (IsEdited())
+ {
+ MessageBox.Show("yay it works");
+ }
+ }
+ }
+} \ No newline at end of file