diff --git a/EditGroupForm.cs b/EditGroupForm.cs
new file mode 100644
index 0000000..75e1627
--- /dev/null
+++ b/EditGroupForm.cs
@@ -0,0 +1,186 @@
+using System.Windows.Forms;
+using FizzyLauncher.Models;
+using RyzStudio.Windows.Forms;
+using RyzStudio.Windows.ThemedForms;
+using RyzStudio.Windows.ThemedForms.ButtonTextBox;
+using RyzStudio.Windows.ThemedForms.PickerBox;
+
+namespace FizzyLauncher
+{
+ public class EditGroupForm : TDialog
+ {
+ private Label label2;
+ private Label label1;
+ private ThButton button1;
+ private ThYesNoPickerBox pickerBox1;
+ private THorizontalSeparator horizontalSeparator2;
+ private ThClearableTextBox textBox1;
+
+ private TileGroupModel result = null;
+
+
+ public EditGroupForm(TileGroupModel model = null)
+ {
+ InitializeComponent();
+
+ result = model;
+
+ StartPosition = FormStartPosition.WindowsDefaultLocation;
+ Text = result == null ? "Add Group" : "Edit Group";
+ OkButton = button1;
+
+ pickerBox1.ComboBox.Items.Clear();
+ pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
+ if (pickerBox1.ComboBox.Items.Count > 0)
+ {
+ pickerBox1.ComboBox.SelectedIndex = 0;
+ }
+
+ if (result != null)
+ {
+ textBox1.Text = result.Title?.Trim() ?? string.Empty;
+ pickerBox1.Value = result.IsExpanded;
+ }
+ }
+
+ private void InitializeComponent()
+ {
+ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditGroupForm));
+ textBox1 = new ThClearableTextBox();
+ label2 = new Label();
+ label1 = new Label();
+ button1 = new ThButton();
+ pickerBox1 = new ThYesNoPickerBox();
+ horizontalSeparator2 = new THorizontalSeparator();
+ SuspendLayout();
+ //
+ // textBox1
+ //
+ textBox1.AcceptButton = null;
+ textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
+ textBox1.BackColor = System.Drawing.Color.Transparent;
+ textBox1.ClearedValue = "";
+ textBox1.EnableReactiveVisual = true;
+ textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
+ textBox1.HighlightImage = (System.Drawing.Image)resources.GetObject("textBox1.HighlightImage");
+ textBox1.Location = new System.Drawing.Point(192, 20);
+ textBox1.Margin = new Padding(10, 10, 10, 0);
+ textBox1.Name = "textBox1";
+ textBox1.NormalImage = (System.Drawing.Image)resources.GetObject("textBox1.NormalImage");
+ textBox1.Padding = new Padding(4, 4, 3, 3);
+ textBox1.Size = new System.Drawing.Size(177, 32);
+ textBox1.TabIndex = 152;
+ textBox1.TabStop = false;
+ textBox1.UseSystemPasswordChar = false;
+ //
+ // label2
+ //
+ label2.AutoSize = true;
+ label2.BackColor = System.Drawing.Color.Transparent;
+ label2.ForeColor = System.Drawing.SystemColors.ControlText;
+ label2.Location = new System.Drawing.Point(10, 62);
+ label2.Name = "label2";
+ label2.Padding = new Padding(0, 9, 0, 10);
+ label2.Size = new System.Drawing.Size(91, 34);
+ label2.TabIndex = 155;
+ label2.Text = "Show Expanded";
+ label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // label1
+ //
+ label1.AutoSize = true;
+ label1.BackColor = System.Drawing.Color.Transparent;
+ label1.ForeColor = System.Drawing.SystemColors.ControlText;
+ label1.Location = new System.Drawing.Point(10, 21);
+ label1.Margin = new Padding(0);
+ label1.Name = "label1";
+ label1.Padding = new Padding(0, 9, 0, 10);
+ label1.Size = new System.Drawing.Size(29, 34);
+ label1.TabIndex = 153;
+ label1.Text = "Title";
+ label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // button1
+ //
+ button1.AcceptButton = null;
+ button1.ActiveImage = null;
+ button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
+ button1.BackColor = System.Drawing.Color.Transparent;
+ button1.EnableMenuOnClick = false;
+ button1.EnableReactiveVisual = true;
+ button1.HoverImage = null;
+ button1.IdleImage = null;
+ button1.LabelText = "&Save";
+ button1.Location = new System.Drawing.Point(241, 469);
+ button1.Margin = new Padding(10, 10, 10, 0);
+ button1.Name = "button1";
+ button1.Padding = new Padding(4, 4, 3, 3);
+ button1.Size = new System.Drawing.Size(128, 32);
+ button1.TabIndex = 173;
+ button1.TabStop = false;
+ //
+ // pickerBox1
+ //
+ pickerBox1.AcceptButton = null;
+ pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
+ pickerBox1.BackColor = System.Drawing.Color.Transparent;
+ pickerBox1.EnableReactiveVisual = true;
+ pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
+ pickerBox1.Location = new System.Drawing.Point(285, 62);
+ pickerBox1.Name = "pickerBox1";
+ pickerBox1.Padding = new Padding(4, 4, 3, 3);
+ pickerBox1.SelectedIndex = 0;
+ pickerBox1.Size = new System.Drawing.Size(84, 34);
+ pickerBox1.TabIndex = 174;
+ pickerBox1.TabStop = false;
+ pickerBox1.Value = false;
+ //
+ // horizontalSeparator2
+ //
+ horizontalSeparator2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
+ horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
+ horizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
+ horizontalSeparator2.Location = new System.Drawing.Point(10, 437);
+ horizontalSeparator2.Margin = new Padding(0, 10, 0, 0);
+ horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
+ horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
+ horizontalSeparator2.Name = "horizontalSeparator2";
+ horizontalSeparator2.Size = new System.Drawing.Size(364, 22);
+ horizontalSeparator2.TabIndex = 182;
+ horizontalSeparator2.TabStop = false;
+ //
+ // EditGroupForm
+ //
+ ClientSize = new System.Drawing.Size(384, 521);
+ Controls.Add(horizontalSeparator2);
+ Controls.Add(pickerBox1);
+ Controls.Add(button1);
+ Controls.Add(label2);
+ Controls.Add(label1);
+ Controls.Add(textBox1);
+ MinimumSize = new System.Drawing.Size(400, 560);
+ Name = "EditGroupForm";
+ Text = "Edit Group";
+ ResumeLayout(false);
+ PerformLayout();
+ }
+
+ public TileGroupModel Result
+ {
+ get
+ {
+ if (result == null)
+ {
+ result = new TileGroupModel();
+ }
+
+ result.Title = textBox1.Text?.Trim() ?? string.Empty;
+ result.IsExpanded = pickerBox1.Value;
+
+ return result;
+ }
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/Windows/TileGridPanelLayout.resx b/EditGroupForm.resx
similarity index 79%
rename from Windows/TileGridPanelLayout.resx
rename to EditGroupForm.resx
index a395bff..0386da6 100644
--- a/Windows/TileGridPanelLayout.resx
+++ b/EditGroupForm.resx
@@ -18,7 +18,7 @@
System.Resources.ResXResourceReader, System.Windows.Forms, ...
System.Resources.ResXResourceWriter, System.Windows.Forms, ...
this is my long stringthis is a comment
- Blue
+ Blue
[base64 mime encoded serialized .NET Framework object]
@@ -117,4 +117,25 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wQAADsEBuJFr7QAAAN5JREFUOE/tUzsKwkAUXLCyFMHjeIvdB4Gk8ALamU4rsbLaTWz0AOYGOYMewTqe
+ QLEQnZc8WRMSsBYHhrzPzJBin2pC60PPGLs3xl3Bp5DrHe9E1g2tHUH8QMjKmGReketyZkRWh9abfhTZ
+ YRimI4jWRPYSBMngkzzjHWtYyx6xK4X0Anz/7rcsxM4BdoxBTuTOqCdEaUyU6DrTuNqxxuXsEXsFDLfg
+ UdpOsIa10nr8A34p4CRtJ1jTGoC3PsPiBi78ETXplqzBwU3F5sHHgWWGJ3rHt+3tg+Uu84ek1AsYYd8q
+ EsfwCwAAAABJRU5ErkJggg==
+
+
+
+
+ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wQAADsEBuJFr7QAAANFJREFUOE/tkzEKAjEURANWliJ4HG+h9l5AO7fTSjyCxWpCIBB2b+AZ9AjW6wlc
+ LGSdWb9Elw1YiwOP/Pw/E1Ikqqksyzpa670x5goqgfWOM7HFhfAE5jvWNdYFkZq9sdg+laZp13vfBwOY
+ NjBfnHO9d9jjjB56mZG4UhgW4HXdbykkXl97iMYBnFFPrbUJGDVIOKOHXmYk/hSaW3CUbVT00CvboP8B
+ v3TASbZR0RM7YA5KsAT1J2phBUq8wpnEgvg5MMwxvGFte/uVzPLwkZR6AInAKK6aICfTAAAAAElFTkSu
+ QmCC
+
+
\ No newline at end of file
diff --git a/Windows/Forms/EditTileFolderForm.cs b/EditTileFolderForm.cs
similarity index 87%
rename from Windows/Forms/EditTileFolderForm.cs
rename to EditTileFolderForm.cs
index 42b97e1..2e310ad 100644
--- a/Windows/Forms/EditTileFolderForm.cs
+++ b/EditTileFolderForm.cs
@@ -6,36 +6,43 @@ using System.IO;
using System.Linq;
using System.Windows.Forms;
using FizzyLauncher.Models;
+using FizzyLauncher.Windows.Forms;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
+using RyzStudio.Windows.ThemedForms.ButtonTextBox;
+using static RyzStudio.Windows.ThemedForms.ButtonTextBox.ThKeyCodeTextBox;
-namespace FizzyLauncher.Windows.Forms
+namespace FizzyLauncher
{
public class EditTileFolderForm : TDialog
{
- private System.Windows.Forms.Label label1;
+ private Label label1;
private ThButton button1;
- private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
- private ThTextBox textBox1;
+ private THorizontalSeparator horizontalSeparator2;
+ private ThClearableTextBox textBox1;
private ThListBox listBox1;
- private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
- private System.Windows.Forms.Label label2;
+ private THorizontalSeparator tHorizontalSeparator1;
+ private Label label2;
+
+ private TileModel result = null;
public EditTileFolderForm(TileModel model = null)
{
InitializeComponent();
- this.StartPosition = FormStartPosition.WindowsDefaultLocation;
- this.OkButton = button1;
+ StartPosition = FormStartPosition.WindowsDefaultLocation;
+ OkButton = button1;
- if (model != null)
+ result = model;
+
+ if (result != null)
{
- this.Text = "Edit Folder";
+ Text = "Edit Folder";
- textBox1.Text = model?.Title ?? string.Empty;
+ textBox1.Text = result?.Title ?? string.Empty;
- foreach (TileModel item in model.Items ?? new System.Collections.Generic.List())
+ foreach (TileModel item in result.Items ?? new List())
{
if (item.IsGroup)
{
@@ -47,33 +54,29 @@ namespace FizzyLauncher.Windows.Forms
}
else
{
- this.Text = "Add Folder";
+ Text = "Add Folder";
}
}
private void InitializeComponent()
{
- textBox1 = new ThTextBox();
+ textBox1 = new ThClearableTextBox();
label1 = new Label();
button1 = new ThButton();
- horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
+ horizontalSeparator2 = new THorizontalSeparator();
listBox1 = new ThListBox();
label2 = new Label();
- tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
+ tHorizontalSeparator1 = new THorizontalSeparator();
SuspendLayout();
//
// textBox1
//
- textBox1.AcceptButton = null;
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = Color.Transparent;
textBox1.EnableReactiveVisual = true;
textBox1.Font = new Font("Microsoft Sans Serif", 8.25F);
textBox1.Location = new Point(109, 20);
- textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1";
- textBox1.Padding = new Padding(4, 4, 3, 3);
- textBox1.ReadOnly = false;
textBox1.Size = new Size(260, 35);
textBox1.TabIndex = 152;
textBox1.TabStop = false;
@@ -196,12 +199,14 @@ namespace FizzyLauncher.Windows.Forms
{
get
{
- var result = new TileModel()
+ if (result == null)
{
- Title = textBox1.Text?.Trim() ?? string.Empty,
- IsGroup = true,
- Items = new List()
- };
+ result = new TileModel();
+ }
+
+ result.Title = textBox1.Text?.Trim() ?? string.Empty;
+ result.IsGroup = true;
+ result.Items = new List();
foreach (TileModel item in listBox1.ListBox.Items.OfType())
{
@@ -253,7 +258,7 @@ namespace FizzyLauncher.Windows.Forms
};
}
- private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
+ private void listBox1_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
diff --git a/Windows/Forms/EditTileFolderForm.resx b/EditTileFolderForm.resx
similarity index 100%
rename from Windows/Forms/EditTileFolderForm.resx
rename to EditTileFolderForm.resx
diff --git a/Windows/Forms/EditTileForm.cs b/EditTileForm.cs
similarity index 75%
rename from Windows/Forms/EditTileForm.cs
rename to EditTileForm.cs
index 9991eb0..8ff7721 100644
--- a/Windows/Forms/EditTileForm.cs
+++ b/EditTileForm.cs
@@ -4,34 +4,40 @@ using FizzyLauncher.Models;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
+using RyzStudio.Windows.ThemedForms.PickerBox;
+using static RyzStudio.Windows.ThemedForms.ButtonTextBox.ThKeyCodeTextBox;
-namespace FizzyLauncher.Windows.Forms
+namespace FizzyLauncher
{
public class EditTileForm : TDialog
{
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
+ private Label label6;
+ private Label label7;
+ private Label label4;
+ private Label label3;
+ private Label label2;
+ private Label label1;
private ThPathDialogTextBox textBox2;
- private ThTextBox textBox3;
+ private ThClearableTextBox textBox3;
private ThPathDialogTextBox textBox4;
private ThButton button1;
private ThPickerBox pickerBox1;
- private ThPickerBox pickerBox2;
- private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1;
- private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
- private ThTextBox textBox1;
+ private ThYesNoPickerBox pickerBox2;
+ private THorizontalSeparator horizontalSeparator1;
+ private THorizontalSeparator horizontalSeparator2;
+ private ThClearableTextBox textBox1;
+
+ private TileModel result = null;
public EditTileForm(TileModel model = null)
{
InitializeComponent();
- this.StartPosition = FormStartPosition.WindowsDefaultLocation;
- this.OkButton = button1;
+ StartPosition = FormStartPosition.WindowsDefaultLocation;
+ OkButton = button1;
+
+ result = model;
pickerBox1.ComboBox.Items.Clear();
pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" });
@@ -40,33 +46,26 @@ namespace FizzyLauncher.Windows.Forms
pickerBox1.ComboBox.SelectedIndex = 0;
}
- pickerBox2.ComboBox.Items.Clear();
- pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
- if (pickerBox2.ComboBox.Items.Count > 0)
+ if (result != null)
{
- pickerBox2.ComboBox.SelectedIndex = 0;
- }
+ Text = "Edit Tile";
- if (model != null)
- {
- this.Text = "Edit Tile";
-
- textBox1.Text = model?.Title ?? string.Empty;
- textBox2.Text = model?.ProcessFilename ?? string.Empty;
- textBox3.Text = model?.ProcessArgument ?? string.Empty;
- textBox4.Text = model?.ProcessWorkingDirectory ?? string.Empty;
- pickerBox1.ComboBox.SelectedIndex = (int)model.ProcessWindowStyle;
- pickerBox2.ComboBox.SelectedIndex = (model.ProcessAsAdmin ? 1 : 0);
+ textBox1.Text = result?.Title ?? string.Empty;
+ textBox2.Text = result?.ProcessFilename ?? string.Empty;
+ textBox3.Text = result?.ProcessArgument ?? string.Empty;
+ textBox4.Text = result?.ProcessWorkingDirectory ?? string.Empty;
+ pickerBox1.ComboBox.SelectedIndex = (int)result.ProcessWindowStyle;
+ pickerBox2.Value = result.ProcessAsAdmin;
}
else
{
- this.Text = "Add Tile";
+ Text = "Add Tile";
}
}
private void InitializeComponent()
{
- textBox1 = new ThTextBox();
+ textBox1 = new ThClearableTextBox();
label6 = new Label();
label7 = new Label();
label4 = new Label();
@@ -74,27 +73,23 @@ namespace FizzyLauncher.Windows.Forms
label2 = new Label();
label1 = new Label();
textBox2 = new ThPathDialogTextBox();
- textBox3 = new ThTextBox();
+ textBox3 = new ThClearableTextBox();
textBox4 = new ThPathDialogTextBox();
button1 = new ThButton();
pickerBox1 = new ThPickerBox();
- pickerBox2 = new ThPickerBox();
- horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
- horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
+ pickerBox2 = new ThYesNoPickerBox();
+ horizontalSeparator1 = new THorizontalSeparator();
+ horizontalSeparator2 = new THorizontalSeparator();
SuspendLayout();
//
// textBox1
//
- textBox1.AcceptButton = null;
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = Color.Transparent;
textBox1.EnableReactiveVisual = true;
textBox1.Font = new Font("Segoe UI", 9F);
textBox1.Location = new Point(126, 20);
- textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1";
- textBox1.Padding = new Padding(4, 4, 3, 3);
- textBox1.ReadOnly = false;
textBox1.Size = new Size(243, 35);
textBox1.TabIndex = 152;
textBox1.TabStop = false;
@@ -181,21 +176,14 @@ namespace FizzyLauncher.Windows.Forms
//
// textBox2
//
- textBox2.AcceptButton = null;
textBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox2.BackColor = Color.Transparent;
textBox2.DialogMode = ThPathDialogTextBox.DialogType.OpenFile;
textBox2.EnableReactiveVisual = true;
- textBox2.FolderBrowserDialog = null;
textBox2.Font = new Font("Segoe UI", 9F);
- textBox2.HighlightImage = null;
textBox2.Location = new Point(126, 61);
textBox2.Margin = new Padding(10, 10, 10, 0);
textBox2.Name = "textBox2";
- textBox2.NormalImage = null;
- textBox2.OpenFileDialog = null;
- textBox2.Padding = new Padding(4, 4, 3, 3);
- textBox2.SaveFileDialog = null;
textBox2.Size = new Size(243, 32);
textBox2.TabIndex = 170;
textBox2.TabStop = false;
@@ -203,38 +191,25 @@ namespace FizzyLauncher.Windows.Forms
//
// textBox3
//
- textBox3.AcceptButton = null;
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox3.BackColor = Color.Transparent;
textBox3.EnableReactiveVisual = true;
textBox3.Font = new Font("Segoe UI", 9F);
textBox3.Location = new Point(147, 102);
- textBox3.Margin = new Padding(10, 10, 10, 0);
textBox3.Name = "textBox3";
- textBox3.Padding = new Padding(4, 4, 3, 3);
- textBox3.ReadOnly = false;
textBox3.Size = new Size(222, 35);
textBox3.TabIndex = 171;
textBox3.TabStop = false;
- textBox3.UseSystemPasswordChar = false;
//
// textBox4
//
- textBox4.AcceptButton = null;
textBox4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox4.BackColor = Color.Transparent;
textBox4.DialogMode = ThPathDialogTextBox.DialogType.FolderBrowser;
textBox4.EnableReactiveVisual = true;
- textBox4.FolderBrowserDialog = null;
textBox4.Font = new Font("Segoe UI", 9F);
- textBox4.HighlightImage = null;
textBox4.Location = new Point(147, 143);
- textBox4.Margin = new Padding(10, 10, 10, 0);
textBox4.Name = "textBox4";
- textBox4.NormalImage = null;
- textBox4.OpenFileDialog = null;
- textBox4.Padding = new Padding(4, 4, 3, 3);
- textBox4.SaveFileDialog = null;
textBox4.Size = new Size(222, 32);
textBox4.TabIndex = 172;
textBox4.TabStop = false;
@@ -277,16 +252,12 @@ namespace FizzyLauncher.Windows.Forms
//
// pickerBox2
//
- pickerBox2.AcceptButton = null;
pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox2.BackColor = Color.Transparent;
pickerBox2.EnableReactiveVisual = true;
pickerBox2.Font = new Font("Segoe UI", 9F);
pickerBox2.Location = new Point(285, 250);
- pickerBox2.Margin = new Padding(10, 10, 10, 0);
pickerBox2.Name = "pickerBox2";
- pickerBox2.Padding = new Padding(4, 4, 3, 3);
- pickerBox2.SelectedIndex = -1;
pickerBox2.Size = new Size(84, 34);
pickerBox2.TabIndex = 175;
pickerBox2.TabStop = false;
@@ -349,15 +320,22 @@ namespace FizzyLauncher.Windows.Forms
public TileModel Result
{
- get => new TileModel()
+ get
{
- Title = textBox1.Text?.Trim() ?? string.Empty,
- ProcessFilename = textBox2.Text?.Trim() ?? string.Empty,
- ProcessArgument = textBox3.Text?.Trim() ?? string.Empty,
- ProcessWorkingDirectory = textBox4.Text?.Trim(),
- ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex,
- ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1)
- };
+ if (result == null)
+ {
+ result = new TileModel();
+ }
+
+ result.Title = textBox1.Text?.Trim() ?? string.Empty;
+ result.ProcessFilename = textBox2.Text?.Trim() ?? string.Empty;
+ result.ProcessArgument = textBox3.Text?.Trim() ?? string.Empty;
+ result.ProcessWorkingDirectory = textBox4.Text?.Trim();
+ result.ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex;
+ result.ProcessAsAdmin = pickerBox2.Value;
+
+ return result;
+ }
}
}
diff --git a/Windows/Forms/EditTileForm.resx b/EditTileForm.resx
similarity index 100%
rename from Windows/Forms/EditTileForm.resx
rename to EditTileForm.resx
diff --git a/FileSessionManager.cs b/FileSessionManager.cs
deleted file mode 100644
index 8a373ba..0000000
--- a/FileSessionManager.cs
+++ /dev/null
@@ -1,209 +0,0 @@
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace FizzyLauncher
-{
- public class FileSessionManager
- {
- public delegate void OnNewSessionEvent(FileSessionManager sender);
- public delegate Task OnSaveSessionEvent(FileSessionManager sender, string filename, bool showNotices = true);
- public delegate Task OnLoadSessionEvent(FileSessionManager sender, string filename);
- public delegate Task OnClearSessionEvent(FileSessionManager sender);
-
-
- public string SessionFilename { get; set; } = null;
-
- public string NewSessionPromptTitle { get; set; } = "New session";
- public string OpenSessionPromptTitle { get; set; } = "Open session";
- public string CloseSessionPromptTitle { get; set; } = "Close session";
- public string SaveExistingSession { get; set; } = "Save existing session?";
-
- public OpenFileDialog OpenFileDialog { get; set; } = null;
- public SaveFileDialog SaveFileDialog { get; set; } = null;
-
- public OnNewSessionEvent OnNewSession { get; set; } = null;
- public OnSaveSessionEvent OnSaveSession { get; set; } = null;
- public OnLoadSessionEvent OnLoadSession { get; set; } = null;
- public OnClearSessionEvent OnClearSession { get; set; } = null;
-
-
- public async Task NewSession()
- {
- if (string.IsNullOrWhiteSpace(this.SessionFilename))
- {
- this.SessionFilename = null;
-
- PerformNewSession();
- }
- else
- {
- var result = MessageBox.Show(this.SaveExistingSession, this.NewSessionPromptTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- var result2 = await PerformSaveSession(this.SessionFilename, false);
- if (result2)
- {
- this.SessionFilename = null;
-
- PerformNewSession();
- }
- }
- else if (result == DialogResult.No)
- {
- this.SessionFilename = null;
-
- PerformNewSession();
- }
- else if (result == DialogResult.Cancel)
- {
- return;
- }
- }
- }
-
- public async Task OpenSession(string filename)
- {
- this.SessionFilename = filename;
-
- if (string.IsNullOrWhiteSpace(this.SessionFilename))
- {
- await this.OpenSession();
- }
- else
- {
- await PerformLoadSession(this.SessionFilename);
- }
- }
-
- public async Task OpenSession()
- {
- if (string.IsNullOrWhiteSpace(this.SessionFilename))
- {
- if (this.OpenFileDialog.ShowDialog() == DialogResult.OK)
- {
- this.SessionFilename = this.OpenFileDialog.FileName;
-
- await PerformLoadSession(this.SessionFilename);
- }
- }
- else
- {
- var result = MessageBox.Show(this.SaveExistingSession, this.OpenSessionPromptTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- if (await PerformSaveSession(this.SessionFilename, false))
- {
- if (this.OpenFileDialog.ShowDialog() == DialogResult.OK)
- {
- this.SessionFilename = this.OpenFileDialog.FileName;
-
- await PerformLoadSession(this.SessionFilename);
- }
- }
- }
- else if (result == DialogResult.No)
- {
- if (this.OpenFileDialog.ShowDialog() == DialogResult.OK)
- {
- this.SessionFilename = this.OpenFileDialog.FileName;
-
- await PerformLoadSession(this.SessionFilename);
- }
- }
- else if (result == DialogResult.Cancel)
- {
- return;
- }
- }
- }
-
- public async Task SaveSession()
- {
- if (string.IsNullOrWhiteSpace(this.SessionFilename))
- {
- await this.SaveAsSession();
- }
- else
- {
- await PerformSaveSession(this.SessionFilename, true);
- }
- }
-
- public async Task SaveAsSession()
- {
- if (this.SaveFileDialog.ShowDialog() == DialogResult.OK)
- {
- bool result = await PerformSaveSession(this.SaveFileDialog.FileName);
- if (result)
- {
- this.SessionFilename = this.SaveFileDialog.FileName;
- }
-
- return result;
- }
-
- return false;
- }
-
- public async Task CloseSession()
- {
- if (string.IsNullOrWhiteSpace(this.SessionFilename))
- {
- this.SessionFilename = null;
-
- await PerformClearSession();
- }
- else
- {
- var result = MessageBox.Show(this.SaveExistingSession, this.CloseSessionPromptTitle, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- if (result == DialogResult.Yes)
- {
- bool result2 = await PerformSaveSession(this.SessionFilename, false);
- if (result2)
- {
- this.SessionFilename = null;
-
- await PerformClearSession();
- }
- }
- else if (result == DialogResult.No)
- {
- this.SessionFilename = null;
-
- await PerformClearSession();
- }
- else if (result == DialogResult.Cancel)
- {
- return;
- }
- }
- }
-
-
- private void PerformNewSession() => this.OnNewSession?.Invoke(this);
-
- private async Task PerformSaveSession(string filename, bool showNotices = true)
- {
- if (this.OnSaveSession == null)
- {
- return false;
- }
-
- return await this.OnSaveSession?.Invoke(this, filename, showNotices);
- }
-
- private async Task PerformLoadSession(string filename)
- {
- if (this.OnLoadSession == null)
- {
- return false;
- }
-
- return await this.OnLoadSession?.Invoke(this, filename);
- }
-
- private async Task PerformClearSession() => this.OnClearSession?.Invoke(this);
-
-
- }
-}
diff --git a/FizzyLauncher.csproj b/FizzyLauncher.csproj
index c15b847..3e6e32e 100644
--- a/FizzyLauncher.csproj
+++ b/FizzyLauncher.csproj
@@ -14,7 +14,7 @@
Ray Lam
1.0.0.0
1.0.0.0
- 0.2.5.058
+ 0.3.0.153
False
x64
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index 0bcc517..fb2c82f 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -76,9 +76,11 @@ namespace FizzyLauncher
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ panel1 = new System.Windows.Forms.Panel();
contextMenuStrip2.SuspendLayout();
menuStrip1.SuspendLayout();
tileContainerMenu1.SuspendLayout();
+ panel1.SuspendLayout();
SuspendLayout();
//
// saveFileDialog1
@@ -117,7 +119,7 @@ namespace FizzyLauncher
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, toolStripMenuItem1, viewToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem1 });
menuStrip1.Location = new System.Drawing.Point(0, 0);
menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new System.Drawing.Size(873, 24);
+ menuStrip1.Size = new System.Drawing.Size(404, 24);
menuStrip1.TabIndex = 2;
menuStrip1.MenuActivate += menuStrip1_MenuActivate;
//
@@ -215,14 +217,14 @@ namespace FizzyLauncher
// showBigIconsToolStripMenuItem
//
showBigIconsToolStripMenuItem.Name = "showBigIconsToolStripMenuItem";
- showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
showBigIconsToolStripMenuItem.Text = "Show &Big Icons";
showBigIconsToolStripMenuItem.Click += showBigIconsToolStripMenuItem_Click;
//
// alwaysOnTopToolStripMenuItem
//
alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
- alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
alwaysOnTopToolStripMenuItem.Text = "Always On &Top";
alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click;
//
@@ -378,21 +380,35 @@ namespace FizzyLauncher
// flowLayoutPanel1
//
flowLayoutPanel1.AutoScroll = true;
- flowLayoutPanel1.BackColor = System.Drawing.Color.FromArgb(255, 192, 255);
+ flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
+ flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
- flowLayoutPanel1.Location = new System.Drawing.Point(12, 27);
+ flowLayoutPanel1.Location = new System.Drawing.Point(6, 0);
+ flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
flowLayoutPanel1.Name = "flowLayoutPanel1";
- flowLayoutPanel1.Size = new System.Drawing.Size(461, 426);
+ flowLayoutPanel1.Size = new System.Drawing.Size(398, 417);
flowLayoutPanel1.TabIndex = 8;
flowLayoutPanel1.WrapContents = false;
//
+ // panel1
+ //
+ panel1.BackColor = System.Drawing.Color.Transparent;
+ panel1.Controls.Add(flowLayoutPanel1);
+ panel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ panel1.Location = new System.Drawing.Point(0, 24);
+ panel1.Margin = new System.Windows.Forms.Padding(0);
+ panel1.Name = "panel1";
+ panel1.Padding = new System.Windows.Forms.Padding(6, 0, 0, 0);
+ panel1.Size = new System.Drawing.Size(404, 417);
+ panel1.TabIndex = 9;
+ //
// MainForm
//
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.FromArgb(250, 250, 250);
BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
- ClientSize = new System.Drawing.Size(873, 505);
- Controls.Add(flowLayoutPanel1);
+ ClientSize = new System.Drawing.Size(404, 441);
+ Controls.Add(panel1);
Controls.Add(menuStrip1);
DoubleBuffered = true;
ForeColor = System.Drawing.SystemColors.ControlText;
@@ -400,13 +416,14 @@ namespace FizzyLauncher
MainMenuStrip = menuStrip1;
MaximizeBox = false;
MinimizeBox = false;
- MinimumSize = new System.Drawing.Size(420, 280);
+ MinimumSize = new System.Drawing.Size(300, 320);
Name = "MainForm";
Text = "Fizzy Launcher";
contextMenuStrip2.ResumeLayout(false);
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
tileContainerMenu1.ResumeLayout(false);
+ panel1.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
@@ -456,6 +473,7 @@ namespace FizzyLauncher
private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
+ private System.Windows.Forms.Panel panel1;
}
}
diff --git a/MainForm.cs b/MainForm.cs
index fb107da..0104b4a 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
+using System.Drawing;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using FizzyLauncher.Models;
-using FizzyLauncher.Windows.Forms;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
using RyzStudio.Windows.TileForms;
@@ -15,185 +15,33 @@ namespace FizzyLauncher
{
public partial class MainForm : Form
{
- //protected OptionsForm optionsForm = null;
- protected string sessionFilename = null;
- protected bool isBusy = false;
- protected bool requestExit = false;
-
private readonly FileSessionManager _fileSessionManager;
+ private bool _isBusy = false;
+ private bool _requestExit = false;
+
+
public MainForm()
{
InitializeComponent();
_fileSessionManager = new FileSessionManager();
- _fileSessionManager.SessionFilename = sessionFilename;
_fileSessionManager.OpenFileDialog = openFileDialog1;
_fileSessionManager.SaveFileDialog = saveFileDialog1;
- _fileSessionManager.OnNewSession += fileSessionManager_OnNewSession;
- _fileSessionManager.OnLoadSession += fileSessionManager_OnLoadSession;
- _fileSessionManager.OnSaveSession += fileSessionManager_OnSaveSession;
- _fileSessionManager.OnClearSession += fileSessionManager_OnClearSession;
+ _fileSessionManager.OnNewing += fileSessionManager_OnNewSession;
+ _fileSessionManager.OnLoading += fileSessionManager_OnLoadSession;
+ _fileSessionManager.OnSaving += fileSessionManager_OnSaveSession;
+ _fileSessionManager.OnClearing += fileSessionManager_OnClearSession;
+ _fileSessionManager.OnFilenameChanged += fileSessionManager_OnFilenameChanged;
//tileContainer1.OnColumnSizeChanged += tileContainer1_OnSizeChanged;
notifyIcon1.Text = System.Windows.Forms.Application.ProductName;
this.AutoScaleMode = AutoScaleMode.None;
- this.StartPosition = FormStartPosition.WindowsDefaultBounds;
- this.Visible = false;
+ //this.StartPosition = FormStartPosition.WindowsDefaultBounds;
+ //this.Visible = false;
}
-
- #region File session manager
-
- private void fileSessionManager_OnNewSession(FileSessionManager sender)
- {
- var form = new NewForm();
- if (form.ShowDialog() == DialogResult.OK)
- {
- var result = form.Result;
-
- UIControl.Clear(flowLayoutPanel1);
-
- for (var i = 0; i < result.GroupCount; i++)
- {
- AddNewTileGroup();
- }
- }
-
- sessionFilename = sender.SessionFilename;
- UIControl.SetText(this, System.Windows.Forms.Application.ProductName);
- }
-
- private async Task fileSessionManager_OnLoadSession(FileSessionManager sender, string filename)
- {
- return await Task.Run(async () =>
- {
- this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile(filename);
- if (this.CurrentSession == null)
- {
- MessageBox.Show("Unable to read session", "Load session");
-
- return false;
- }
-
- if (this.CurrentSession == null)
- {
- this.CurrentSession = new LauncherSession();
- }
-
- UIControl.SetText(this, Path.GetFileNameWithoutExtension(sessionFilename) + " - " + System.Windows.Forms.Application.ProductName);
-
- // Reposition + resize
- if (!this.CurrentSession.StartPosition.IsEmpty)
- {
- UIControl.SetLocation(this, this.CurrentSession.StartPosition);
- }
-
- if (this.CurrentSession.Height > 0)
- {
- UIControl.SetClientHeight(this, this.CurrentSession.Height);
- }
-
- InvalidateOptions();
-
- // Load tiles
- await LoadTileGroups(this.CurrentSession.Groups);
-
- sessionFilename = sender.SessionFilename;
-
- UIControl.SetVisible(this, true);
- UIControl.SetFocus(this);
-
- return true;
- });
- }
-
- private async Task fileSessionManager_OnSaveSession(FileSessionManager sender, string filename, bool showNotices)
- {
- if (string.IsNullOrWhiteSpace(filename))
- {
- return false;
- }
-
- if (!flowLayoutPanel1.Controls.OfType().Any())
- {
- return true;
- }
-
- return await Task.Run(() =>
- {
- if (isBusy)
- {
- return false;
- }
-
- isBusy = true;
-
- // update session
- if (this.CurrentSession == null)
- {
- this.CurrentSession = new LauncherSession();
- }
-
- this.CurrentSession.StartPosition = this.Location;
- this.CurrentSession.Height = this.Height;
- //this.CurrentSession.AlwaysOnTop = this.TopMost;
-
- this.CurrentSession.Groups = new List();
- foreach (var container in flowLayoutPanel1.Controls.OfType())
- {
- this.CurrentSession.Groups.Add(container.Tag as TileGroupModel);
- }
-
- var result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
- if (result.IsSuccess)
- {
- if (showNotices)
- {
- MessageBox.Show("Session saved!", "Save session", MessageBoxButtons.OK, MessageBoxIcon.Information);
- }
- }
- else
- {
- MessageBox.Show(result.Message, "Save session");
-
- isBusy = false;
-
- return false;
- }
-
- sessionFilename = sender.SessionFilename;
- UIControl.SetText(this, Path.GetFileNameWithoutExtension(sessionFilename) + " - " + System.Windows.Forms.Application.ProductName);
-
- isBusy = false;
-
- return true;
- });
- }
-
- private async Task fileSessionManager_OnClearSession(FileSessionManager sender)
- {
- await Task.Run(() =>
- {
- UIControl.Clear(flowLayoutPanel1);
-
- sessionFilename = sender.SessionFilename;
-
- UIControl.SetText(this, System.Windows.Forms.Application.ProductName);
- });
- }
-
- #endregion
-
-
- //protected override void OnLoad(EventArgs e)
- //{
- // base.OnLoad(e);
-
- // //UIControl.SetSize(this, this.MinimumSize);
- //}
-
protected async override void OnShown(EventArgs e)
{
base.OnShown(e);
@@ -209,14 +57,14 @@ namespace FizzyLauncher
if (!string.IsNullOrWhiteSpace(jsonfigFilename) && File.Exists(jsonfigFilename))
{
await _fileSessionManager.OpenSession(jsonfigFilename);
-
- sessionFilename = _fileSessionManager.SessionFilename;
}
else
{
- this.CurrentSession = new LauncherSession();
+ this.CurrentSession = new AppOptions();
- UIControl.SetVisible(this, true);
+ InvalidateOptions();
+
+ //UIControl.SetVisible(this, true);
}
}
@@ -226,62 +74,26 @@ namespace FizzyLauncher
if (this.CurrentSession == null)
{
- this.CurrentSession = new LauncherSession();
+ this.CurrentSession = new AppOptions();
}
- if (this.CurrentSession.HideOnClose && !requestExit)
+ if (this.CurrentSession.HideOnClose && !_requestExit)
{
this.Visible = !this.Visible;
e.Cancel = true;
return;
}
- requestExit = false;
+ _requestExit = false;
await _fileSessionManager.CloseSession();
- sessionFilename = _fileSessionManager.SessionFilename;
-
- //if (string.IsNullOrWhiteSpace(sessionFilename))
- //{
- // // do nothing
- //}
- //else
- //{
-
- //if (this.CurrentSession.AutoSave == LauncherSession.AutoSaveOption.Prompt)
- //{
- //DialogResult dr = MessageBox.Show("Save existing session?", "Exit", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- //if (dr == DialogResult.Yes)
- //{
- // bool rv = saveFile(sessionFilename, false);
- // if (!rv)
- // {
- // e.Cancel = true;
- // }
- //}
- //else if (dr == DialogResult.No)
- //{
- // // do nothing
- //}
- //else if (dr == DialogResult.Cancel)
- //{
- // e.Cancel = true;
- //}
- //}
- //else if (this.CurrentSession.AutoSave == LauncherSession.AutoSaveOption.Yes)
- //{
- // saveFile(sessionFilename, false);
- //}
- //}
-
if ((this.CurrentSession?.ShowToggleHotkey ?? new ThKeyCodeTextBox.Results()).Key != Keys.None)
{
#if !DEBUG
RyzStudio.Runtime.InteropServices.User32.UnregisterHotKey((IntPtr)Handle, 1);
#endif
}
-
}
protected override void WndProc(ref Message m)
@@ -296,8 +108,8 @@ namespace FizzyLauncher
break;
case RyzStudio.Runtime.InteropServices.User32.WM_QUERYENDSESSION:
- requestExit = true;
- //this.Close();
+ _requestExit = true;
+
System.Windows.Forms.Application.Exit();
break;
@@ -309,199 +121,9 @@ namespace FizzyLauncher
}
- public LauncherSession CurrentSession { get; set; } = null;
+ public AppOptions CurrentSession { get; set; } = null;
- public void Clear()
- {
- UIControl.Clear(flowLayoutPanel1);
-
- sessionFilename = null;
- }
-
-
- //protected async Task collapseWindow(int width, int increment = 6)
- //{
- // await Task.Run(() =>
- // {
- // while (this.Width > width)
- // {
- // UIControl.SetWidth(this, (this.Width - increment));
-
- // System.Windows.Forms.Application.DoEvents();
- // }
-
- // UIControl.SetWidth(this, width);
- // });
- //}
-
- //protected async Task expandWindow(int width, int increment = 8)
- //{
- // await Task.Run(() =>
- // {
- // while (this.Width < width)
- // {
- // UIControl.SetWidth(this, (this.Width + increment));
-
- // System.Windows.Forms.Application.DoEvents();
- // }
-
- // UIControl.SetWidth(this, width);
- // });
- //}
-
-// protected void invalidateHotKey()
-// {
-//#if !DEBUG
-// UIControl.Invoke(this, (x) =>
-// {
-// RyzStudio.Runtime.InteropServices.User32.UnregisterHotKey((IntPtr)Handle, 1);
-// });
-
-// if ((this.CurrentSession?.ShowToggleHotkey ?? new ThKeyCodeTextBox.Results()).Key != Keys.None)
-// {
-// UIControl.Invoke(this, (x) =>
-// {
-// RyzStudio.Runtime.InteropServices.User32.RegisterHotKey((IntPtr)Handle, 1, this.CurrentSession.HotKey.ModifierCode, this.CurrentSession.HotKey.Key);
-// });
-// }
-//#endif
-// }
-
- //protected void newSession()
- //{
- // var form = new NewForm();
- // if (form.ShowDialog() == DialogResult.OK)
- // {
- // var result = form.Result;
-
- // flowLayoutPanel1.Controls.Clear();
-
- // for (var i = 0; i < result.GroupCount; i++)
- // {
- // AddNewTileGroup();
- // }
- // }
- //}
-
- //protected async Task loadFile(string filename)
- //{
- // //await Task.Run(async () =>
- // //{
- // if (isBusy)
- // {
- // return;
- // }
-
- // this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile(filename);
- // if (this.CurrentSession == null)
- // {
- // MessageBox.Show("Unable to read session", "Load session");
- // return;
- // }
-
- // if (this.CurrentSession == null)
- // {
- // this.CurrentSession = new LauncherSession();
- // }
-
- // InvalidateOptions();
-
- // // load tiles
- // //tileContainer1.Load(this.CurrentSession.Groups);
- // await LoadTileGroups(this.CurrentSession.Groups);
-
- // // reposition
- // //if (!this.CurrentSession.StartPosition.IsEmpty)
- // //{
- // //UIControl.SetLocation(this, this.CurrentSession.StartPosition);
- // //}
-
- // //
- // //UIControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
- // UIControl.SetVisible(this, true);
- // //UIControl.SetChecked(showBigIconsToolStripMenuItem, this.CurrentSession.EnableBigIconInFolder);
- // //UIControl.SetClientHeight(this, this.CurrentSession.DefaultHeight);
-
- // UIControl.SetFocus(this);
-
- // // hotkey
- // //invalidateHotKey();
-
- // //});
- //}
-
- //protected bool saveFile(string filename, bool showNotices = true)
- //{
- // if (isBusy)
- // {
- // return false;
- // }
-
- // if (string.IsNullOrWhiteSpace(filename))
- // {
- // return false;
- // }
-
- // //if (tileContainer1.GroupCount <= 0)
- // //{
- // // return true;
- // //}
-
- // isBusy = true;
-
- // // update session
- // if (this.CurrentSession == null)
- // {
- // this.CurrentSession = new LauncherSession();
- // }
-
- // this.CurrentSession.Height = this.Height;
- // //this.CurrentSession.AlwaysOnTop = this.TopMost;
- // this.CurrentSession.StartPosition = this.Location;
- // //this.CurrentSession.Groups = flowLayoutPanel1.Controls.OfType()?.ToList() ?? new List();
-
- // var result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
- // if (result.IsSuccess)
- // {
- // if (showNotices)
- // {
- // MessageBox.Show("Session saved!", "Save session", MessageBoxButtons.OK, MessageBoxIcon.Information);
- // }
- // }
- // else
- // {
- // MessageBox.Show(result.Message, "Save session");
-
- // return false;
- // }
-
- // isBusy = false;
-
- // return true;
- //}
-
- //protected bool saveAsFile()
- //{
- // if (isBusy)
- // {
- // return false;
- // }
-
- // if (saveFileDialog1.ShowDialog() == DialogResult.OK)
- // {
- // bool rv = saveFile(saveFileDialog1.FileName);
- // if (rv)
- // {
- // sessionFilename = saveFileDialog1.FileName;
- // }
-
- // return rv;
- // }
-
- // return false;
- //}
-
private void InvalidateOptions()
{
/// todo: big icons
@@ -522,11 +144,23 @@ namespace FizzyLauncher
#endif
UIControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
+ }
+ private void menuStrip1_MenuActivate(object sender, EventArgs e)
+ {
+ closeToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
+
+ saveToolStripMenuItem.Enabled = (_fileSessionManager.SessionState == FileSessionManager.SessionStateEnum.Open);
+ saveAsToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
+
+ addGroupToolStripMenuItem.Enabled = (_fileSessionManager.SessionState != FileSessionManager.SessionStateEnum.Close);
+
+ showBigIconsToolStripMenuItem.Checked = this.CurrentSession?.ShowBigIcons ?? true;
+ alwaysOnTopToolStripMenuItem.Checked = this.CurrentSession?.AlwaysOnTop ?? false;
}
- #region main menu
+ #region Main Menu
///
/// New
@@ -535,32 +169,12 @@ namespace FizzyLauncher
///
private async void newToolStripMenuItem_Click(object sender, EventArgs e)
{
- await _fileSessionManager.NewSession();
+ if (_isBusy)
+ {
+ return;
+ }
- //if (string.IsNullOrWhiteSpace(sessionFilename))
- //{
- // newSession();
- //}
- //else
- //{
- // var result = MessageBox.Show("Save existing session?", "New session", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- // if (result == DialogResult.Yes)
- // {
- // bool rv = saveFile(sessionFilename, false);
- // if (rv)
- // {
- // newSession();
- // }
- // }
- // else if (result == DialogResult.No)
- // {
- // newSession();
- // }
- // else if (result == DialogResult.Cancel)
- // {
- // return;
- // }
- //}
+ await _fileSessionManager.NewSession();
}
///
@@ -570,42 +184,12 @@ namespace FizzyLauncher
///
private async void openToolStripMenuItem_Click(object sender, EventArgs e)
{
+ if (_isBusy)
+ {
+ return;
+ }
+
await _fileSessionManager.OpenSession();
-
-
- //if (string.IsNullOrWhiteSpace(sessionFilename))
- //{
- // if (openFileDialog1.ShowDialog() == DialogResult.OK)
- // {
- // await loadFile(openFileDialog1.FileName);
- // }
- //}
- //else
- //{
- // var result = MessageBox.Show("Save existing session?", "Open session", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- // if (result == DialogResult.Yes)
- // {
- // bool rv = saveFile(sessionFilename, false);
- // if (rv)
- // {
- // if (openFileDialog1.ShowDialog() == DialogResult.OK)
- // {
- // await loadFile(openFileDialog1.FileName);
- // }
- // }
- // }
- // else if (result == DialogResult.No)
- // {
- // if (openFileDialog1.ShowDialog() == DialogResult.OK)
- // {
- // await loadFile(openFileDialog1.FileName);
- // }
- // }
- // else if (result == DialogResult.Cancel)
- // {
- // return;
- // }
- //}
}
///
@@ -615,40 +199,12 @@ namespace FizzyLauncher
///
private async void closeToolStripMenuItem_Click(object sender, EventArgs e)
{
+ if (_isBusy)
+ {
+ return;
+ }
+
await _fileSessionManager.CloseSession();
-
- //if (string.IsNullOrWhiteSpace(sessionFilename))
- //{
- // //flowLayoutPanel1.Controls.Clear();
-
- // this.Clear();
- //}
- //else
- //{
- // var result = MessageBox.Show("Save existing session?", "Close session", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
- // if (result == DialogResult.Yes)
- // {
- // bool rv = saveFile(sessionFilename, false);
- // if (rv)
- // {
- // this.Clear();
- // //flowLayoutPanel1.Controls.Clear();
-
- // //sessionFilename = null;
- // }
- // }
- // else if (result == DialogResult.No)
- // {
- // this.Clear();
- // //flowLayoutPanel1.Controls.Clear();
-
- // //sessionFilename = null;
- // }
- // else if (result == DialogResult.Cancel)
- // {
- // return;
- // }
- //}
}
///
@@ -658,16 +214,12 @@ namespace FizzyLauncher
///
private async void saveToolStripMenuItem_Click(object sender, EventArgs e)
{
- await _fileSessionManager.SaveSession();
+ if (_isBusy)
+ {
+ return;
+ }
- //if (string.IsNullOrWhiteSpace(sessionFilename))
- //{
- // saveAsFile();
- //}
- //else
- //{
- // saveFile(sessionFilename, true);
- //}
+ await _fileSessionManager.SaveSession();
}
///
@@ -677,9 +229,12 @@ namespace FizzyLauncher
///
private async void saveAsToolStripMenuItem_Click(object sender, EventArgs e)
{
- await _fileSessionManager.SaveAsSession();
+ if (_isBusy)
+ {
+ return;
+ }
- //saveAsFile();
+ await _fileSessionManager.SaveAsSession();
}
///
@@ -689,7 +244,12 @@ namespace FizzyLauncher
///
private void exitToolStripMenuItem2_Click(object sender, EventArgs e)
{
- requestExit = true;
+ if (_isBusy)
+ {
+ return;
+ }
+
+ _requestExit = true;
this.Close();
}
@@ -776,18 +336,9 @@ namespace FizzyLauncher
MessageBox.Show(System.Windows.Forms.Application.ProductName + " v" + System.Windows.Forms.Application.ProductVersion, "About", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
-
- private void menuStrip1_MenuActivate(object sender, EventArgs e)
- {
- saveAsToolStripMenuItem.Enabled = !string.IsNullOrWhiteSpace(sessionFilename);
-
- showBigIconsToolStripMenuItem.Checked = this.CurrentSession.ShowBigIcons;
- alwaysOnTopToolStripMenuItem.Checked = this.CurrentSession.AlwaysOnTop;
- }
-
#endregion
- #region notification icon
+ #region Notification Icon
private void notifyIcon1_MouseClick(object sender, MouseEventArgs e)
{
@@ -799,76 +350,176 @@ namespace FizzyLauncher
private void exitToolStripMenuItem1_Click(object sender, EventArgs e)
{
- requestExit = true;
+ _requestExit = true;
this.Close();
}
#endregion
- //private void tileContainer1_OnSizeChanged(object sender, EventArgs e)
- //{
- // //int newWidth = this.Padding.Horizontal + SystemInformation.VerticalScrollBarWidth + tileContainer1.CalcWidth;
- // //UIControl.SetClientWidth(this, newWidth);
- //}
+ #region File Session Manager
-
-
- private void AddNewTileGroup()
+ private async Task fileSessionManager_OnNewSession(FileSessionManager sender)
{
- var group = new TileGroupModel();
- group.Title = "New Group";
- group.IsExpanded = true;
- group.GridSize = new System.Drawing.Size(8, 1);
+ return await Task.Run(() =>
+ {
+ var form = new NewForm();
+ if (form.ShowDialog() == DialogResult.OK)
+ {
+ var result = form.Result;
- var container = new RyzStudio.Windows.TileForms.TileContainer();
- container.Title = group.Title;
- container.IsOpen = group.IsExpanded;
- container.TitleContextMenuStrip = tileContainerMenu1;
- container.AutoSizeHeight = true;
- container.Tag = group;
+ UIControl.Clear(flowLayoutPanel1);
- container.AutoResize(group.GridSize.Width, group.GridSize.Height);
+ this.CurrentSession.TilesPerRow = result.ColumnCount;
- UIControl.Add(flowLayoutPanel1, container);
+ for (var i = 0; i < result.GroupCount; i++)
+ {
+ AddNewTileGroup();
+ }
+ }
+
+ AutoResize();
+
+ return true;
+ });
}
- private async Task LoadTileGroups(List groupList)
+ private async Task fileSessionManager_OnLoadSession(FileSessionManager sender, string filename)
+ {
+ return await Task.Run(async () =>
+ {
+ this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile(filename);
+ if (this.CurrentSession == null)
+ {
+ MessageBox.Show("Unable to read session", "Load session");
+
+ return false;
+ }
+
+ if (this.CurrentSession == null)
+ {
+ this.CurrentSession = new AppOptions();
+ }
+
+ // Reposition + resize
+ if (!this.CurrentSession.StartPosition.IsEmpty)
+ {
+ UIControl.SetLocation(this, this.CurrentSession.StartPosition);
+ }
+
+ if (this.CurrentSession.Height > 0)
+ {
+ UIControl.SetClientHeight(this, this.CurrentSession.Height);
+ }
+
+ InvalidateOptions();
+
+ // Load tiles
+ await LoadTileGroups(this.CurrentSession.Groups);
+
+ AutoResize();
+
+ //UIControl.SetVisible(this, true);
+ UIControl.SetFocus(this);
+
+ return true;
+ });
+ }
+
+ private async Task fileSessionManager_OnSaveSession(FileSessionManager sender, string filename, bool showNotices)
+ {
+ if (string.IsNullOrWhiteSpace(filename))
+ {
+ return false;
+ }
+
+ if (!flowLayoutPanel1.Controls.OfType().Any())
+ {
+ return true;
+ }
+
+ return await Task.Run(() =>
+ {
+ if (_isBusy)
+ {
+ return false;
+ }
+
+ _isBusy = true;
+
+ // update session
+ if (this.CurrentSession == null)
+ {
+ this.CurrentSession = new AppOptions();
+ }
+
+ this.CurrentSession.StartPosition = this.Location;
+ this.CurrentSession.Height = this.Height;
+
+ this.CurrentSession.Groups = new List();
+ foreach (var container in flowLayoutPanel1.Controls.OfType())
+ {
+ this.CurrentSession.Groups.Add((TileGroupModel)container.Tag);
+ }
+
+ var result = RyzStudio.Text.Json.JsonSerialiser.SerialiseFile(filename, this.CurrentSession);
+ if (result.IsSuccess)
+ {
+ if (showNotices)
+ {
+ MessageBox.Show("Session saved!", "Save session", MessageBoxButtons.OK, MessageBoxIcon.Information);
+ }
+ }
+ else
+ {
+ MessageBox.Show(result.Message, "Save session");
+
+ _isBusy = false;
+
+ return false;
+ }
+
+ _isBusy = false;
+
+ return true;
+ });
+ }
+
+ private async Task fileSessionManager_OnClearSession(FileSessionManager sender)
{
await Task.Run(() =>
{
UIControl.Clear(flowLayoutPanel1);
+ });
- // Load groups
- foreach (var item in groupList ?? new List())
+ return true;
+ }
+
+ private async Task fileSessionManager_OnFilenameChanged(FileSessionManager sender, string filename)
+ {
+ await Task.Run(() =>
+ {
+ switch (sender.SessionState)
{
- var panel = new RyzStudio.Windows.TileForms.TileContainer();
- panel.Title = item.Title;
- panel.IsOpen = item.IsExpanded;
- panel.TitleContextMenuStrip = tileContainerMenu1;
- panel.AutoSizeHeight = true;
- panel.Tag = item;
-
- panel.AutoResize(item.GridSize.Width, item.GridSize.Height);
-
- UIControl.Add(flowLayoutPanel1, panel);
-
- // Load tiles
- foreach (var item2 in item.Items ?? new List())
- {
- var tile = new FizzyLauncher.Windows.Forms.TilePanel();
- tile.LoadInfo(item2);
-
- panel.Add(tile, item2.Position.X, item2.Position.Y);
- }
+ case FileSessionManager.SessionStateEnum.New:
+ UIControl.SetText(this, "New Session - " + System.Windows.Forms.Application.ProductName);
+ break;
+ case FileSessionManager.SessionStateEnum.Open:
+ UIControl.SetText(this, Path.GetFileNameWithoutExtension(filename) + " - " + System.Windows.Forms.Application.ProductName);
+ break;
+ case FileSessionManager.SessionStateEnum.Close:
+ UIControl.SetText(this, System.Windows.Forms.Application.ProductName);
+ break;
+ default:
+ break;
}
-
- //InvalidateColumnSize();
});
}
- #region Tile container
+ #endregion
+
+ #region Tile Container
///
/// Add Tile
@@ -893,6 +544,8 @@ namespace FizzyLauncher
newTile.LoadInfo(result);
container.Add(newTile, newCoord.X, newCoord.Y);
+
+ _fileSessionManager.HasChanged = true;
};
}
@@ -919,6 +572,8 @@ namespace FizzyLauncher
newTile.LoadInfo(result);
container.Add(newTile, newCoord.X, newCoord.Y);
+
+ _fileSessionManager.HasChanged = true;
};
}
@@ -946,6 +601,8 @@ namespace FizzyLauncher
container.Tag = result;
container.Invalidate();
+
+ _fileSessionManager.HasChanged = true;
};
}
@@ -963,6 +620,8 @@ namespace FizzyLauncher
}
container.AddRow();
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -979,6 +638,8 @@ namespace FizzyLauncher
}
container.RemoveRow();
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -995,6 +656,8 @@ namespace FizzyLauncher
}
UIControl.MoveTop(flowLayoutPanel1, container);
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -1011,6 +674,8 @@ namespace FizzyLauncher
}
UIControl.MoveUp(flowLayoutPanel1, container);
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -1027,6 +692,8 @@ namespace FizzyLauncher
}
UIControl.MoveDown(flowLayoutPanel1, container);
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -1043,6 +710,8 @@ namespace FizzyLauncher
}
UIControl.MoveBottom(flowLayoutPanel1, container);
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -1059,9 +728,83 @@ namespace FizzyLauncher
}
flowLayoutPanel1.Controls.Remove(container);
+
+ _fileSessionManager.HasChanged = true;
}
#endregion
+
+ private void AddNewTileGroup()
+ {
+ var group = new TileGroupModel();
+ group.Title = "New Group";
+ group.IsExpanded = true;
+ group.GridSize = new System.Drawing.Size(this.CurrentSession.TilesPerRow, 1);
+
+ var container = new RyzStudio.Windows.TileForms.TileContainer();
+ container.Title = group.Title;
+ container.IsOpen = group.IsExpanded;
+ container.TitleContextMenuStrip = tileContainerMenu1;
+ container.AutoSizeHeight = true;
+ container.Tag = group;
+ container.BackColor = Color.Orange;
+
+ UIControl.Add(flowLayoutPanel1, container);
+
+ container.AutoSize(group.GridSize.Width, group.GridSize.Height);
+
+ _fileSessionManager.HasChanged = true;
+ }
+
+ private void AutoResize()
+ {
+ if (flowLayoutPanel1.Controls.Count <= 0)
+ {
+ return;
+ }
+
+ var width = 0;
+ foreach (var item in flowLayoutPanel1.Controls.OfType())
+ {
+ width = Math.Max(width, item.Width);
+ }
+
+ UIControl.SetClientWidth(this, width + panel1.Padding.Horizontal + this.Padding.Horizontal + SystemInformation.VerticalScrollBarWidth);
+ }
+
+ private async Task LoadTileGroups(List groupList)
+ {
+ await Task.Run(() =>
+ {
+ UIControl.Clear(flowLayoutPanel1);
+
+ // Load groups
+ foreach (var item in groupList ?? new List())
+ {
+ var panel = new RyzStudio.Windows.TileForms.TileContainer();
+ panel.Title = item.Title;
+ panel.IsOpen = item.IsExpanded;
+ panel.TitleContextMenuStrip = tileContainerMenu1;
+ panel.AutoSizeHeight = true;
+ panel.Tag = item;
+
+ panel.AutoSize(item.GridSize.Width, item.GridSize.Height);
+
+ UIControl.Add(flowLayoutPanel1, panel);
+
+ // Load tiles
+ foreach (var item2 in item.Items ?? new List())
+ {
+ var tile = new FizzyLauncher.Windows.Forms.TilePanel();
+ tile.LoadInfo(item2);
+
+ panel.Add(tile, item2.Position.X, item2.Position.Y);
+ }
+
+ }
+ });
+ }
+
}
}
\ No newline at end of file
diff --git a/Models/AppOptions.cs b/Models/AppOptions.cs
new file mode 100644
index 0000000..0247bea
--- /dev/null
+++ b/Models/AppOptions.cs
@@ -0,0 +1,27 @@
+using System.Collections.Generic;
+using System.Drawing;
+
+namespace FizzyLauncher.Models
+{
+ public class AppOptions
+ {
+ public int TilesPerRow { get; set; } = 8;
+
+ public bool ShowBigIcons { get; set; } = true;
+
+ public RyzStudio.Windows.ThemedForms.ButtonTextBox.ThKeyCodeTextBox.Results ShowToggleHotkey { get; set; } = null;
+
+ public bool HideOnClose { get; set; } = true;
+
+ public bool HideOnExecute { get; set; } = true;
+
+ public bool AlwaysOnTop { get; set; } = false;
+
+ public List Groups { get; set; } = new List();
+
+ public Point StartPosition { get; set; } = Point.Empty;
+
+ public int Height { get; set; } = 280;
+
+ }
+}
\ No newline at end of file
diff --git a/Models/LauncherSession.cs b/Models/LauncherSession.cs
deleted file mode 100644
index 0647ac5..0000000
--- a/Models/LauncherSession.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-using System.Collections.Generic;
-using System.Drawing;
-using RyzStudio.Windows.ThemedForms.ButtonTextBox;
-
-namespace FizzyLauncher.Models
-{
- public class LauncherSession
- {
- public int TilesPerRow { get; set; } = 8;
-
- public bool ShowBigIcons { get; set; } = true;
-
- public ThKeyCodeTextBox.Results ShowToggleHotkey { get; set; } = null;
-
- public bool HideOnClose { get; set; } = true;
-
- public bool HideOnExecute { get; set; } = true;
-
- public bool AlwaysOnTop { get; set; } = false;
-
-
-
- //public class HotKeyOptions
- //{
- // public bool IsCtrl { get; set; } = false;
- // public bool IsAlt { get; set; } = false;
- // public bool IsShift { get; set; } = false;
- // public int Key { get; set; } = (int)System.Windows.Forms.Keys.None;
-
- // public int ModifierCode => ((this.IsAlt ? 1 : 0) + (this.IsCtrl ? 2 : 0) + (this.IsShift ? 4 : 0));
-
- // public System.Windows.Forms.Keys KeyCode => (System.Windows.Forms.Keys)this.Key;
- //}
-
- //public enum AutoSaveOption
- //{
- // Prompt = 0,
- // Yes,
- // No
- //}
-
- //public int DefaultHeight { get; set; } = 280;
-
- //public ThKeyCodeTextBox.Results HotKey { get; set; } = null;
-
- //public bool AlwaysOnTop { get; set; } = false;
- //public bool EnableAnimation { get; set; } = false;
- //public bool EnableBigIconInFolder { get; set; } = false;
-
- //public bool HideOnClose { get; set; } = false;
- //public bool HideOnClick { get; set; } = false;
- //public AutoSaveOption AutoSave { get; set; } = AutoSaveOption.Prompt;
-
- public List Groups { get; set; } = new List();
-
- public Point StartPosition { get; set; } = Point.Empty;
-
- public int Height { get; set; } = 280;
-
-
- //public int ColumnCount { get; set; } = 8;
-
-
- }
-}
\ No newline at end of file
diff --git a/Models/TileGroupModel.cs b/Models/TileGroupModel.cs
index 5ce4fd1..f037d58 100644
--- a/Models/TileGroupModel.cs
+++ b/Models/TileGroupModel.cs
@@ -10,8 +10,6 @@ namespace FizzyLauncher.Models
public bool IsExpanded { get; set; } = false;
- public bool IsExclusive { get; set; } = false;
-
public List Items { get; set; } = new List();
[JsonConverter(typeof(RyzStudio.Text.Json.JsonSizeConverter))]
diff --git a/OptionsForm.cs b/OptionsForm.cs
index 29e10c4..e8217bc 100644
--- a/OptionsForm.cs
+++ b/OptionsForm.cs
@@ -29,10 +29,10 @@ namespace FizzyLauncher
private ThYesNoPickerBox yesNoPickerBox4;
private Label label3;
- private LauncherSession _appSession = null;
+ private AppOptions _appSession = null;
- public OptionsForm(LauncherSession appSession)
+ public OptionsForm(AppOptions appSession)
{
InitializeComponent();
@@ -57,7 +57,7 @@ namespace FizzyLauncher
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm));
- ThKeyCodeTextBox.Results results2 = new ThKeyCodeTextBox.Results();
+ ThKeyCodeTextBox.Results results1 = new ThKeyCodeTextBox.Results();
label1 = new Label();
button1 = new ThButton();
yesNoPickerBox2 = new ThYesNoPickerBox();
@@ -198,11 +198,11 @@ namespace FizzyLauncher
textBox1.EnableReactiveVisual = true;
textBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
textBox1.HighlightImage = (System.Drawing.Image)resources.GetObject("textBox1.HighlightImage");
- results2.IsAlt = false;
- results2.IsCtrl = false;
- results2.IsShift = false;
- results2.Key = Keys.None;
- textBox1.KeyCodeResults = results2;
+ results1.IsAlt = false;
+ results1.IsCtrl = false;
+ results1.IsShift = false;
+ results1.Key = Keys.None;
+ textBox1.KeyCodeResults = results1;
textBox1.Location = new System.Drawing.Point(192, 21);
textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1";
@@ -253,9 +253,9 @@ namespace FizzyLauncher
flowLayoutPanel1.Controls.Add(tTogglePanel1);
flowLayoutPanel1.Controls.Add(tTogglePanel2);
flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
- flowLayoutPanel1.Location = new System.Drawing.Point(10, 12);
+ flowLayoutPanel1.Location = new System.Drawing.Point(8, 12);
flowLayoutPanel1.Name = "flowLayoutPanel1";
- flowLayoutPanel1.Size = new System.Drawing.Size(424, 412);
+ flowLayoutPanel1.Size = new System.Drawing.Size(436, 412);
flowLayoutPanel1.TabIndex = 194;
flowLayoutPanel1.WrapContents = false;
flowLayoutPanel1.Resize += flowLayoutPanel1_Resize;
@@ -268,6 +268,7 @@ namespace FizzyLauncher
tTogglePanel1.Controls.Add(label2);
tTogglePanel1.Controls.Add(label4);
tTogglePanel1.Controls.Add(numericBox1);
+ tTogglePanel1.ExpandedHeight = 100;
tTogglePanel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
tTogglePanel1.IsOpen = true;
tTogglePanel1.Location = new System.Drawing.Point(0, 0);
@@ -324,6 +325,7 @@ namespace FizzyLauncher
tTogglePanel2.Controls.Add(yesNoPickerBox3);
tTogglePanel2.Controls.Add(label6);
tTogglePanel2.Controls.Add(label7);
+ tTogglePanel2.ExpandedHeight = 100;
tTogglePanel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
tTogglePanel2.IsOpen = true;
tTogglePanel2.Location = new System.Drawing.Point(0, 119);
@@ -394,13 +396,6 @@ namespace FizzyLauncher
flowLayoutPanel1_Resize(null, e);
}
- //protected override void OnShown(EventArgs e)
- //{
- // base.OnShown(e);
-
- // flowLayoutPanel1_Resize(null, e);
- //}
-
private void flowLayoutPanel1_Resize(object sender, EventArgs e)
{
var width = flowLayoutPanel1.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;
@@ -411,13 +406,13 @@ namespace FizzyLauncher
}
}
- public LauncherSession Result
+ public AppOptions Result
{
get
{
if (_appSession == null)
{
- _appSession = new LauncherSession();
+ _appSession = new AppOptions();
}
_appSession.TilesPerRow = numericBox1.Value;
diff --git a/Windows/Forms/EditGroupForm.cs b/Windows/Forms/EditGroupForm.cs
deleted file mode 100644
index be037ed..0000000
--- a/Windows/Forms/EditGroupForm.cs
+++ /dev/null
@@ -1,164 +0,0 @@
-using System.Windows.Forms;
-using FizzyLauncher.Models;
-using RyzStudio.Windows.Forms;
-using RyzStudio.Windows.ThemedForms;
-
-namespace FizzyLauncher.Windows.Forms
-{
- public class EditGroupForm : TDialog
- {
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.Label label1;
- private ThButton button1;
- private ThPickerBox pickerBox1;
- private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
- private ThTextBox textBox1;
-
-
- public EditGroupForm(TileGroupModel model = null)
- {
- InitializeComponent();
-
- this.StartPosition = FormStartPosition.WindowsDefaultLocation;
- this.Text = ((model == null) ? "Add Group" : "Edit Group");
- this.OkButton = button1;
-
- pickerBox1.ComboBox.Items.Clear();
- pickerBox1.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
- if (pickerBox1.ComboBox.Items.Count > 0)
- {
- pickerBox1.ComboBox.SelectedIndex = 0;
- }
-
- if (model != null)
- {
- textBox1.Text = model.Title?.Trim() ?? string.Empty;
- pickerBox1.ComboBox.SelectedIndex = (model.IsExclusive ? 1 : 0);
- }
- }
-
- private void InitializeComponent()
- {
- this.textBox1 = new ThTextBox();
- this.label2 = new System.Windows.Forms.Label();
- this.label1 = new System.Windows.Forms.Label();
- this.button1 = new ThButton();
- this.pickerBox1 = new ThPickerBox();
- this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
- this.SuspendLayout();
- //
- // textBox1
- //
- this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.textBox1.BackColor = System.Drawing.Color.Transparent;
- this.textBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.textBox1.Location = new System.Drawing.Point(192, 20);
- this.textBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
- this.textBox1.Name = "textBox1";
- this.textBox1.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
- this.textBox1.Size = new System.Drawing.Size(177, 35);
- this.textBox1.AcceptButton = null;
- this.textBox1.TabIndex = 152;
- this.textBox1.UseSystemPasswordChar = false;
- //
- // label2
- //
- this.label2.AutoSize = true;
- this.label2.BackColor = System.Drawing.Color.Transparent;
- this.label2.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label2.Location = new System.Drawing.Point(10, 62);
- this.label2.Name = "label2";
- this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
- this.label2.Size = new System.Drawing.Size(119, 34);
- this.label2.TabIndex = 155;
- this.label2.Text = "Show Only Expanded";
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.BackColor = System.Drawing.Color.Transparent;
- this.label1.ForeColor = System.Drawing.SystemColors.ControlText;
- this.label1.Location = new System.Drawing.Point(10, 21);
- this.label1.Margin = new System.Windows.Forms.Padding(0);
- this.label1.Name = "label1";
- this.label1.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
- this.label1.Size = new System.Drawing.Size(29, 34);
- this.label1.TabIndex = 153;
- this.label1.Text = "Title";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // button1
- //
- this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
- this.button1.BackColor = System.Drawing.Color.Transparent;
- this.button1.IdleImage = null;
- this.button1.ActiveImage = null;
- this.button1.LabelText = "&Save";
- this.button1.Location = new System.Drawing.Point(241, 469);
- this.button1.Margin = new System.Windows.Forms.Padding(10);
- this.button1.Name = "button1";
- this.button1.HoverImage = null;
- this.button1.Padding = new System.Windows.Forms.Padding(4, 4, 3, 3);
- this.button1.Size = new System.Drawing.Size(128, 32);
- this.button1.TabIndex = 173;
- //
- // pickerBox1
- //
- this.pickerBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
- this.pickerBox1.BackColor = System.Drawing.Color.Transparent;
- this.pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
- this.pickerBox1.Location = new System.Drawing.Point(285, 62);
- this.pickerBox1.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
- this.pickerBox1.Name = "pickerBox1";
- this.pickerBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
- this.pickerBox1.Size = new System.Drawing.Size(84, 34);
- this.pickerBox1.AcceptButton = null;
- this.pickerBox1.TabIndex = 174;
- //
- // horizontalSeparator2
- //
- this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
- this.horizontalSeparator2.AutoScrollMargin = new System.Drawing.Size(0, 0);
- this.horizontalSeparator2.AutoScrollMinSize = new System.Drawing.Size(0, 0);
- this.horizontalSeparator2.BackColor = System.Drawing.Color.Transparent;
- this.horizontalSeparator2.Location = new System.Drawing.Point(10, 437);
- this.horizontalSeparator2.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
- this.horizontalSeparator2.MaximumSize = new System.Drawing.Size(4920, 2);
- this.horizontalSeparator2.MinimumSize = new System.Drawing.Size(0, 22);
- this.horizontalSeparator2.Name = "horizontalSeparator2";
- this.horizontalSeparator2.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
- this.horizontalSeparator2.Size = new System.Drawing.Size(364, 22);
- this.horizontalSeparator2.TabIndex = 182;
- //
- // EditGroupForm
- //
- this.ClientSize = new System.Drawing.Size(384, 521);
- this.Controls.Add(this.horizontalSeparator2);
- this.Controls.Add(this.pickerBox1);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.label2);
- this.Controls.Add(this.label1);
- this.Controls.Add(this.textBox1);
- this.MinimumSize = new System.Drawing.Size(400, 560);
- this.Name = "EditGroupForm";
- this.Text = "Edit Group";
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
-
- public TileGroupModel Result
- {
- get => new TileGroupModel()
- {
- Title = textBox1.Text?.Trim() ?? string.Empty,
- IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1)
- };
- }
-
- }
-}
\ No newline at end of file
diff --git a/Windows/Forms/EditGroupForm.resx b/Windows/Forms/EditGroupForm.resx
deleted file mode 100644
index f298a7b..0000000
--- a/Windows/Forms/EditGroupForm.resx
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Windows/Forms/TileContainer.cs b/Windows/Forms/TileContainer.cs
deleted file mode 100644
index d402138..0000000
--- a/Windows/Forms/TileContainer.cs
+++ /dev/null
@@ -1,149 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Windows.Forms;
-using FizzyLauncher.Models;
-using RyzStudio.Windows.Forms;
-
-namespace FizzyLauncher.Windows.Forms
-{
- public class TileContainer : Panel
- {
- protected const int DEFAULT_COLUMN = 6;
-
- protected FlowLayoutPanel flowLayoutPanel1 = null;
-
-
- public TileContainer()
- {
- flowLayoutPanel1 = new FlowLayoutPanel();
- flowLayoutPanel1.AutoSize = true;
- flowLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- flowLayoutPanel1.BackColor = Color.Transparent;
- flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
- flowLayoutPanel1.Location = new Point(10, 10);
- flowLayoutPanel1.Margin = new Padding(0);
- flowLayoutPanel1.Padding = new Padding(0, 0, 0, 20);
- flowLayoutPanel1.Size = new Size(0, 20);
- flowLayoutPanel1.WrapContents = false;
-
- this.AutoScroll = true;
- this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
- this.BackColor = System.Drawing.Color.Transparent;
- this.Margin = new Padding(0);
- this.Name = "tileContainer1";
- this.Padding = new Padding(10, 10, 10, 20);
- this.Controls.Add(flowLayoutPanel1);
- }
-
-
- [Browsable(false)]
- public event EventHandler OnColumnSizeChanged;
-
-
- public int CalcWidth
- {
- get =>
- TilePanelLayout.CalcWidth(this.TileWidthCount) +
- this.Left + this.Padding.Horizontal + this.Margin.Horizontal +
- flowLayoutPanel1.Padding.Horizontal + flowLayoutPanel1.Margin.Horizontal;
- }
-
- public int GroupCount
- {
- get => flowLayoutPanel1.Controls.Count;
- }
-
- public IEnumerable Groups
- {
- get
- {
- for (int i = 0; i < flowLayoutPanel1.Controls.Count; i++)
- {
- if (flowLayoutPanel1.Controls[i].GetType() != typeof(TilePanelLayout))
- {
- continue;
- }
-
- TilePanelLayout container = flowLayoutPanel1.Controls[i] as TilePanelLayout;
- yield return container;
- }
- }
- }
-
- public IEnumerable GroupModels
- {
- get
- {
- foreach (TilePanelLayout item in this.Groups)
- {
- yield return item.Model;
- }
- }
- }
-
- public int TileWidthCount { get; private set; } = DEFAULT_COLUMN;
-
-
- public void Add()
- {
- this.Add(new TilePanelLayout(new TileGroupModel()
- {
- Title = "New Group",
- IsExpanded = true,
- GridSize = new Size(this.TileWidthCount, 1)
- }));
- }
-
- public void Add(TilePanelLayout tilePanelLayout)
- {
- UIControl.Add(flowLayoutPanel1, tilePanelLayout);
-
- this.InvalidateColumnSize();
- }
-
- public void Add(int columnCount)
- {
- this.TileWidthCount = ((columnCount <= 0) ? DEFAULT_COLUMN : columnCount);
-
- this.Add();
- }
-
- public void Clear()
- {
- UIControl.Clear(flowLayoutPanel1);
-
- this.TileWidthCount = DEFAULT_COLUMN;
-
- InvalidateColumnSize();
- }
-
- public void InvalidateColumnSize()
- {
- this.OnColumnSizeChanged?.Invoke(this, null);
- }
-
- public void Load(List groupList)
- {
- this.Clear();
-
- if (groupList == null)
- {
- return;
- }
-
- foreach (TileGroupModel item in groupList)
- {
- this.TileWidthCount = Math.Max(this.TileWidthCount, item.GridSize.Width);
-
- TilePanelLayout panel = new TilePanelLayout(item);
-
- this.Add(panel);
- }
-
- InvalidateColumnSize();
- }
-
- }
-}
diff --git a/Windows/Forms/TileContainer.resx b/Windows/Forms/TileContainer.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/Windows/Forms/TileContainer.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Windows/Forms/TilePanelLayout.Designer.cs b/Windows/Forms/TilePanelLayout.Designer.cs
deleted file mode 100644
index 31d2727..0000000
--- a/Windows/Forms/TilePanelLayout.Designer.cs
+++ /dev/null
@@ -1,241 +0,0 @@
-namespace FizzyLauncher.Windows.Forms
-{
- partial class TilePanelLayout
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.addToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.addListToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripMenuItem6 = new System.Windows.Forms.ToolStripSeparator();
- this.removeRowToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(this.components);
- this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
- this.toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
- this.topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.upToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.downToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
- this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
- this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem();
- this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
- this.removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.contextMenuStrip1.SuspendLayout();
- this.contextMenuStrip2.SuspendLayout();
- this.SuspendLayout();
- //
- // contextMenuStrip1
- //
- this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.addToolStripMenuItem,
- this.addListToolStripMenuItem,
- this.toolStripMenuItem6,
- this.removeRowToolStripMenuItem1});
- this.contextMenuStrip1.Name = "contextMenuStrip1";
- this.contextMenuStrip1.Size = new System.Drawing.Size(144, 76);
- //
- // addToolStripMenuItem
- //
- this.addToolStripMenuItem.Name = "addToolStripMenuItem";
- this.addToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
- this.addToolStripMenuItem.Text = "&Add Tile";
- this.addToolStripMenuItem.Click += new System.EventHandler(this.addTileMenuItem_Click);
- //
- // addListToolStripMenuItem
- //
- this.addListToolStripMenuItem.Name = "addListToolStripMenuItem";
- this.addListToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
- this.addListToolStripMenuItem.Text = "Add &Folder";
- this.addListToolStripMenuItem.Click += new System.EventHandler(this.addListTileMenuItem_Click);
- //
- // toolStripMenuItem6
- //
- this.toolStripMenuItem6.Name = "toolStripMenuItem6";
- this.toolStripMenuItem6.Size = new System.Drawing.Size(140, 6);
- //
- // removeRowToolStripMenuItem1
- //
- this.removeRowToolStripMenuItem1.Name = "removeRowToolStripMenuItem1";
- this.removeRowToolStripMenuItem1.Size = new System.Drawing.Size(143, 22);
- this.removeRowToolStripMenuItem1.Text = "&Remove Row";
- this.removeRowToolStripMenuItem1.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1);
- //
- // contextMenuStrip2
- //
- this.contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripMenuItem2,
- this.toolStripMenuItem1,
- this.toolStripSeparator3,
- this.toolStripMenuItem7,
- this.toolStripSeparator2,
- this.toolStripMenuItem4,
- this.toolStripSeparator1,
- this.toolStripMenuItem3});
- this.contextMenuStrip2.Name = "contextMenuStrip1";
- this.contextMenuStrip2.Size = new System.Drawing.Size(181, 154);
- //
- // toolStripMenuItem2
- //
- this.toolStripMenuItem2.Name = "toolStripMenuItem2";
- this.toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem2.Text = "&Add Group";
- this.toolStripMenuItem2.Click += new System.EventHandler(this.addGroupMenuItem_Click);
- //
- // toolStripMenuItem1
- //
- this.toolStripMenuItem1.Name = "toolStripMenuItem1";
- this.toolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem1.Text = "&Edit";
- this.toolStripMenuItem1.Click += new System.EventHandler(this.editGroupMenuItem_Click);
- //
- // toolStripSeparator2
- //
- this.toolStripSeparator2.Name = "toolStripSeparator2";
- this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6);
- //
- // toolStripMenuItem4
- //
- this.toolStripMenuItem4.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.topToolStripMenuItem,
- this.upToolStripMenuItem,
- this.downToolStripMenuItem,
- this.bottomToolStripMenuItem});
- this.toolStripMenuItem4.Name = "toolStripMenuItem4";
- this.toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem4.Text = "&Move";
- //
- // topToolStripMenuItem
- //
- this.topToolStripMenuItem.Name = "topToolStripMenuItem";
- this.topToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
- this.topToolStripMenuItem.Text = "&Top";
- this.topToolStripMenuItem.Click += new System.EventHandler(this.moveTopMenuItem_Click);
- //
- // upToolStripMenuItem
- //
- this.upToolStripMenuItem.Name = "upToolStripMenuItem";
- this.upToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
- this.upToolStripMenuItem.Text = "&Up";
- this.upToolStripMenuItem.Click += new System.EventHandler(this.moveUpMenuItem_Click);
- //
- // downToolStripMenuItem
- //
- this.downToolStripMenuItem.Name = "downToolStripMenuItem";
- this.downToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
- this.downToolStripMenuItem.Text = "&Down";
- this.downToolStripMenuItem.Click += new System.EventHandler(this.moveDownMenuItem_Click);
- //
- // bottomToolStripMenuItem
- //
- this.bottomToolStripMenuItem.Name = "bottomToolStripMenuItem";
- this.bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
- this.bottomToolStripMenuItem.Text = "&Bottom";
- this.bottomToolStripMenuItem.Click += new System.EventHandler(this.moveBottomMenuItem_Click);
- //
- // toolStripSeparator1
- //
- this.toolStripSeparator1.Name = "toolStripSeparator1";
- this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
- //
- // toolStripMenuItem3
- //
- this.toolStripMenuItem3.Name = "toolStripMenuItem3";
- this.toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem3.Text = "&Remove";
- this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click);
- //
- // toolStripSeparator3
- //
- this.toolStripSeparator3.Name = "toolStripSeparator3";
- this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
- //
- // toolStripMenuItem7
- //
- this.toolStripMenuItem7.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
- this.toolStripMenuItem5,
- this.removeRowToolStripMenuItem});
- this.toolStripMenuItem7.Name = "toolStripMenuItem7";
- this.toolStripMenuItem7.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem7.Text = "Ro&w";
- //
- // toolStripMenuItem5
- //
- this.toolStripMenuItem5.Name = "toolStripMenuItem5";
- this.toolStripMenuItem5.Size = new System.Drawing.Size(180, 22);
- this.toolStripMenuItem5.Text = "Add &Row";
- this.toolStripMenuItem5.Click += new System.EventHandler(this.toolStripMenuItem5_Click);
- //
- // removeRowToolStripMenuItem
- //
- this.removeRowToolStripMenuItem.Name = "removeRowToolStripMenuItem";
- this.removeRowToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
- this.removeRowToolStripMenuItem.Text = "Remo&ve Row";
- this.removeRowToolStripMenuItem.Click += new System.EventHandler(this.removeRowToolStripMenuItem_Click_1);
- //
- // TilePanelLayout
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.BackColor = System.Drawing.Color.Transparent;
- this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
- this.Name = "TilePanelLayout";
- this.Size = new System.Drawing.Size(432, 173);
- this.contextMenuStrip1.ResumeLayout(false);
- this.contextMenuStrip2.ResumeLayout(false);
- this.ResumeLayout(false);
- this.PerformLayout();
-
- }
-
- #endregion
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
- private System.Windows.Forms.ToolStripMenuItem addToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem addListToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
- private System.Windows.Forms.ToolStripMenuItem topToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
- private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6;
- private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem1;
- private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem7;
- private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
- private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem;
- }
-}
diff --git a/Windows/Forms/TilePanelLayout.cs b/Windows/Forms/TilePanelLayout.cs
deleted file mode 100644
index cb826c7..0000000
--- a/Windows/Forms/TilePanelLayout.cs
+++ /dev/null
@@ -1,438 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Drawing;
-using System.IO;
-using System.Linq;
-using System.Windows.Forms;
-using FizzyLauncher.Models;
-using RyzStudio.Windows.Forms;
-
-namespace FizzyLauncher.Windows.Forms
-{
- public partial class TilePanelLayout : TileGridPanelLayout
- {
- protected TileGroupModel groupModel = null;
-
-
- public TilePanelLayout(TileGroupModel model) : base()
- {
- InitializeComponent();
-
- this.TitleContextMenuStrip = contextMenuStrip2;
- this.ContainerContextMenuStrip = contextMenuStrip1;
-
- this.LoadModel(model);
- }
-
- protected override void OnDragDrop(DragEventArgs e)
- {
- string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
-
- this.LoadShortcuts(fileList);
- }
-
- public new bool EnableAnimation
- {
- get
- {
- MainForm mainForm = this.MainForm;
- if (mainForm == null)
- {
- return false;
- }
-
- if (mainForm.CurrentSession == null)
- {
- return false;
- }
-
- base.EnableAnimation = mainForm.CurrentSession.EnableAnimation;
-
- return base.EnableAnimation;
- }
- set => base.EnableAnimation = value;
- }
-
- public void LoadShortcuts(string[] fileList)
- {
- if (fileList == null)
- {
- return;
- }
-
- if (fileList.Length <= 0)
- {
- return;
- }
-
- if (string.IsNullOrWhiteSpace(fileList[0]))
- {
- return;
- }
-
- TileModel model = new TileModel()
- {
- ProcessFilename = fileList[0],
- Title = Path.GetFileName(fileList[0])
- };
-
- // exe
- if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
- {
- if (File.Exists(fileList[0]))
- {
- try
- {
- FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
- if (fvi != null)
- {
- model.Title = fvi.ProductName;
- }
- }
- catch
- {
- // do nothing
- }
- }
-
- if (string.IsNullOrWhiteSpace(model.Title))
- {
- model.Title = Path.GetFileNameWithoutExtension(fileList[0]);
- }
- }
-
- this.AddTile(model);
- }
-
- public TileGroupModel Model
- {
- get
- {
- TileGroupModel rs = new TileGroupModel()
- {
- Title = groupModel.Title,
- GridSize = new Size(this.GridSize.X, this.GridSize.Y),
- IsExpanded = this.IsExpanded,
- IsExclusive = groupModel.IsExclusive,
- Items = this.Tiles
- };
-
- return rs;
- }
- }
-
-
- public MainForm MainForm { get => UIControl.GetParentsUntil(this.Parent); }
-
- public List Tiles
- {
- get
- {
- List result = new List();
- foreach (GridTileItem item in this.GridTileItems.Where(x => x.Tile.GetType() == typeof(TilePanel)))
- {
- TileModel model = (item.Tile as TilePanel).ModelInfo;
- model.Position = item.Coord;
-
- result.Add(model);
- }
-
- return result;
- }
- }
-
- public void AddTile(TileModel tile)
- {
- Point gridSize = this.GridSize;
-
- if (GridTileItems.Count >= (gridSize.X * gridSize.Y))
- {
- this.SetGridSize(gridSize.X, (gridSize.Y + 1));
- }
-
- Point? newCoord = tile.Position;
- if ((newCoord == null) || HasTile(tile.Position))
- {
- newCoord = FindLastFreeCoord();
- }
-
- if (newCoord == null)
- {
- return;
- }
-
- tile.Position = newCoord.Value;
-
- TilePanel panel = new TilePanel();
- panel.LoadInfo(tile);
- panel.Location = ConvertCoordToLocation(tile.Position);
-
- GridTileItems.Add(new GridTileItem()
- {
- Tile = panel,
- Coord = tile.Position
- });
-
- this.Controls.Add(panel);
- }
-
- public void AddGroup()
- {
- if (this.FlowLayoutPanel == null)
- {
- return;
- }
-
- this.FlowLayoutPanel.Controls.Add(new TilePanelLayout(new TileGroupModel()
- {
- Title = "New Group",
- GridSize = new Size(8, 1)
- }));
- }
-
- public void AddRow() => this.SetGridSize(this.GridSize.X, (this.GridSize.Y + 1));
-
- public void EditGroup()
- {
- //EditGroupForm.ShowDialog(this);
- }
-
- public async void LoadModel(TileGroupModel model)
- {
- groupModel = model;
-
- this.Title = groupModel?.Title ?? string.Empty;
- this.IsExpanded = groupModel.IsExpanded;
-
- //label1.Image = (isExpanded ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
-
- this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height);
- this.LoadTiles(model.Items);
- this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height);
-
- await this.Invalidate();
- }
-
- public async void UpdateModel(TileGroupModel model)
- {
- groupModel = model;
-
- this.Title = groupModel?.Title ?? string.Empty;
- this.IsExpanded = groupModel.IsExpanded;
-
- await this.Invalidate();
- }
-
- public void LoadTiles(List tiles)
- {
- if (tiles == null)
- {
- return;
- }
-
- if (tiles.Count() <= 0)
- {
- return;
- }
-
- foreach (TileModel item in tiles)
- {
- // resolve final grid position
- Point? confirmedPosition = ResolveCoord(item.Position);
- if (confirmedPosition == null)
- {
- continue;
- }
-
- // place control
- TilePanel panel = new TilePanel();
- panel.LoadInfo(item);
- panel.Location = ConvertCoordToLocation(confirmedPosition.Value);
-
- GridTileItems.Add(new GridTileItem()
- {
- Tile = panel,
- Coord = confirmedPosition.Value
- });
-
- this.Controls.Add(panel);
- }
- }
-
- private void SetGridSize(int width, int height)
- {
- this.GridSize = new Point(width, height);
-
- groupModel.GridSize = new Size(groupModel.GridSize.Width, height);
- }
-
- protected override async void label1_MouseClick(object sender, MouseEventArgs e)
- {
- base.label1_MouseClick(sender, e);
-
- if (isAnimating)
- {
- return;
- }
-
- if (e.Button == MouseButtons.Left)
- {
- // exclusivity
- if (this.IsExpanded)
- {
- if (this.Model.IsExclusive)
- {
- if (this.FlowLayoutPanel != null)
- {
- foreach (TilePanelLayout item in this.FlowLayoutPanel.Controls.OfType())
- {
- if (item.Equals(this))
- {
- continue;
- }
-
- await item.Collapse();
- }
- }
- }
- }
- }
- }
-
- #region tile context menu
-
- ///
- /// Add tile
- ///
- ///
- ///
- private void addTileMenuItem_Click(object sender, EventArgs e)
- {
- Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
-
- //EditTileForm.ShowAddDialog(this, coord);
- }
-
- ///
- /// Add folder
- ///
- ///
- ///
- private void addListTileMenuItem_Click(object sender, EventArgs e)
- {
- Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
-
- //EditTileFolderForm.ShowAddDialog(this, coord);
- }
-
- #endregion
-
- #region group context menu
-
- ///
- /// Add group
- ///
- ///
- ///
- private void addGroupMenuItem_Click(object sender, EventArgs e)
- {
- this.AddGroup();
- }
-
- ///
- /// Edit group
- ///
- ///
- ///
- private void editGroupMenuItem_Click(object sender, EventArgs e)
- {
- this.EditGroup();
- }
-
- ///
- /// Add row
- ///
- ///
- ///
- private void toolStripMenuItem5_Click(object sender, EventArgs e)
- {
- this.AddRow();
- }
-
- ///
- /// Remove row
- ///
- ///
- ///
- private void removeRowToolStripMenuItem_Click_1(object sender, EventArgs e)
- {
- if (this.GridSize.Y <= 1)
- {
- return;
- }
-
- bool rs = GridTileItems.Exists(x => x.Coord.Y.Equals(this.GridSize.Y - 1));
- if (rs)
- {
- return;
- }
-
- this.SetGridSize(this.GridSize.X, (this.GridSize.Y - 1));
- }
-
- ///
- /// Move to top
- ///
- ///
- ///
- private void moveTopMenuItem_Click(object sender, EventArgs e)
- {
- this.MoveTop();
- }
-
- ///
- /// Move up
- ///
- ///
- ///
- private void moveUpMenuItem_Click(object sender, EventArgs e)
- {
- this.MoveUp();
- }
-
- ///
- /// Move down
- ///
- ///
- ///
- private void moveDownMenuItem_Click(object sender, EventArgs e)
- {
- this.MoveDown();
- }
-
- ///
- /// Move to bottom
- ///
- ///
- ///
- private void moveBottomMenuItem_Click(object sender, EventArgs e)
- {
- this.MoveBottom();
- }
-
- ///
- /// Remove group
- ///
- ///
- ///
- private void removeGroupMenuItem3_Click(object sender, EventArgs e)
- {
- this.Remove();
- }
-
- #endregion
-
-
- }
-}
diff --git a/Windows/Forms/TilePanelLayout.resx b/Windows/Forms/TilePanelLayout.resx
deleted file mode 100644
index b5d6123..0000000
--- a/Windows/Forms/TilePanelLayout.resx
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- 17, 17
-
-
- 172, 17
-
-
\ No newline at end of file
diff --git a/Windows/GridTableLayout.Designer.cs b/Windows/GridTableLayout.Designer.cs
deleted file mode 100644
index 7accad9..0000000
--- a/Windows/GridTableLayout.Designer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace FizzyLauncher.Windows
-{
- partial class GridTableLayout
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- }
-
- #endregion
- }
-}
diff --git a/Windows/GridTableLayout.cs b/Windows/GridTableLayout.cs
deleted file mode 100644
index 09dd3d1..0000000
--- a/Windows/GridTableLayout.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-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 FizzyLauncher.Windows
-{
- public partial class GridTableLayout : RyzStudio.Windows.Forms.T1UserControl
- {
- public GridTableLayout()
- {
- InitializeComponent();
- }
- }
-}
diff --git a/Windows/GridTableLayout.resx b/Windows/GridTableLayout.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/Windows/GridTableLayout.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Windows/TileGridPanel.Designer.cs b/Windows/TileGridPanel.Designer.cs
deleted file mode 100644
index 02e2d8b..0000000
--- a/Windows/TileGridPanel.Designer.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace RyzStudio.Windows.Forms
-{
- partial class TileGridPanel
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- }
-
- #endregion
- }
-}
diff --git a/Windows/TileGridPanel.cs b/Windows/TileGridPanel.cs
deleted file mode 100644
index 61524e8..0000000
--- a/Windows/TileGridPanel.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-namespace RyzStudio.Windows.Forms
-{
- public partial class TileGridPanel : RyzStudio.Windows.Forms.T1UserControl
- {
- public TileGridPanel() : base()
- {
- InitializeComponent();
-
- this.EnableMovable = true;
- }
-
- //protected override void OnDragOver(DragEventArgs e)
- //{
- // base.OnDragDrop(e);
-
- // e.Effect = (e.Data.GetDataPresent(DataFormats.FileDrop)) ? DragDropEffects.Link : DragDropEffects.None;
- //}
-
- //protected override void OnMouseUp(MouseEventArgs e)
- //{
- // base.OnMouseUp(e);
-
- // isDragging = false;
- //}
-
- //protected override void OnMouseDown(MouseEventArgs e)
- //{
- // base.OnMouseDown(e);
-
- // //var parentLayout = this.TileGridLayout;
- // //if (parentLayout == null)
- // //{
- // // return;
- // //}
-
- // this.BringToFront();
-
- // if (((e.Button == MouseButtons.Left) && (Control.ModifierKeys == Keys.Control)) || (e.Button == MouseButtons.Right))
- // {
- // isDragging = true;
- // startPosition = e.Location;
- // }
- //}
-
- //protected override void OnMouseMove(MouseEventArgs e)
- //{
- // base.OnMouseMove(e);
-
- // if (isDragging)
- // {
- // //var parentLayout = this.TileGridLayout;
- // //if (parentLayout == null)
- // //{
- // // return;
- // //}
-
- // int x = (this.Location.X + (e.Location.X - startPosition.X));
- // int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
-
- // //parentLayout.MoveTile(this, x, y);
-
- // this.Location = new Point(x, y);
-
- // }
- //}
-
-
- //public TileGridPanelLayout TileGridLayout { get => UIControl.GetParentsUntil>(this); }
-
-
- }
-}
\ No newline at end of file
diff --git a/Windows/TileGridPanel.resx b/Windows/TileGridPanel.resx
deleted file mode 100644
index 1af7de1..0000000
--- a/Windows/TileGridPanel.resx
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- text/microsoft-resx
-
-
- 2.0
-
-
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
\ No newline at end of file
diff --git a/Windows/TileGridPanelLayout.Designer.cs b/Windows/TileGridPanelLayout.Designer.cs
deleted file mode 100644
index 42a0c3a..0000000
--- a/Windows/TileGridPanelLayout.Designer.cs
+++ /dev/null
@@ -1,67 +0,0 @@
-using System.Drawing;
-using System.Windows.Forms;
-
-namespace RyzStudio.Windows.Forms
-{
- partial class TileGridPanelLayout
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Component Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- label1 = new System.Windows.Forms.Label();
- SuspendLayout();
- //
- // label1
- //
- this.label1.AutoSize = true;
- this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(99)))), ((int)(((byte)(105)))), ((int)(((byte)(119)))));
- this.label1.Image = global::FizzyLauncher.AppResource.toggle_left_ea_16;
- this.label1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.label1.Location = new System.Drawing.Point(0, 4);
- this.label1.Margin = new System.Windows.Forms.Padding(0);
- this.label1.Padding = new System.Windows.Forms.Padding(0);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(0, 15);
- this.label1.TabIndex = 2;
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- this.label1.MouseClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick);
- this.label1.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.label1_MouseClick);
- //
- // GridLayout2
- //
- AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
- AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- Controls.Add(label1);
- Name = "GridLayout2";
- ResumeLayout(false);
- PerformLayout();
- }
-
- #endregion
-
- private System.Windows.Forms.Label label1;
- }
-}
diff --git a/Windows/TileGridPanelLayout.cs b/Windows/TileGridPanelLayout.cs
deleted file mode 100644
index 28f3430..0000000
--- a/Windows/TileGridPanelLayout.cs
+++ /dev/null
@@ -1,581 +0,0 @@
-using System;
-using System.CodeDom;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Drawing;
-using System.Linq;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-using FizzyLauncher;
-using FizzyLauncher.Windows.Forms;
-
-namespace RyzStudio.Windows.Forms
-{
- public partial class TileGridPanelLayout : RyzStudio.Windows.Forms.TUserControl where T : Control
- {
- public static int CalcWidth(int tileCount)
- => (tileCount * tileSize) + ((tileCount - 1) * margin);
-
-
- public class GridTileItem
- {
- public T Tile { get; set; }
- public Point Coord { get; set; } = new Point(0, 0);
- }
-
-
- protected const int tileSize = 70;
- protected const int margin = 3;
- protected const int labelHeight = 20;
- protected const int collapseIncrement = 6;
- protected const int expandIncrement = 8;
-
- protected int collapseHeight = 0;
- protected int expandedHeight = 0;
-
- protected bool isAnimating = false;
- protected bool isExpanded = true;
- protected Point lastMousePosition = new Point();
- protected Point gridSize = new Point(0, 0);
-
-
- public TileGridPanelLayout() : base()
- {
- InitializeComponent();
-
- this.AllowDrop = true;
- this.BackColor = Color.Transparent;
- this.Margin = new Padding(0);
- this.Padding = new Padding(0, 0, 0, 10);
-
- }
-
- protected override void OnControlAdded(ControlEventArgs e)
- {
- base.OnControlAdded(e);
-
- e.Control.MouseMove += (sender, e) =>
- {
- this.MoveTile(sender as T, e.X, e.Y);
- };
- }
-
- private void tilePanel_Move(object sender, EventArgs e)
- {
- throw new NotImplementedException();
- }
-
- protected override void OnDragOver(DragEventArgs e)
- {
- if (e.Data.GetDataPresent(DataFormats.FileDrop))
- {
- e.Effect = DragDropEffects.Link;
- }
- else
- {
- e.Effect = DragDropEffects.None;
- }
- }
-
- protected override void OnMouseClick(MouseEventArgs e)
- {
- base.OnMouseClick(e);
-
- lastMousePosition = e.Location;
-
- bool isLabel = ((e.Location.X >= 0) && (e.Location.X <= this.Width) && (e.Location.Y >= 0) && (e.Location.Y <= 20));
-
- if (e.Button == MouseButtons.Left)
- {
- // do nothing
- }
- else if (e.Button == MouseButtons.Right)
- {
- if (isLabel)
- {
- this.TitleContextMenuStrip?.Show(this, e.Location);
- }
- else
- {
- this.ContainerContextMenuStrip?.Show(this, e.Location);
- }
- }
- }
-
- protected override void OnMouseDoubleClick(MouseEventArgs e)
- => base.OnMouseClick(e);
-
- protected override async void OnResize(EventArgs e)
- {
- base.OnResize(e);
-
- await this.Invalidate();
- }
-
- protected virtual async void label1_MouseClick(object sender, MouseEventArgs e)
- {
- if (isAnimating)
- {
- return;
- }
-
- if (e.Button == MouseButtons.Left)
- {
- this.IsExpanded = !this.IsExpanded;
-
- //label1.Image = (this.IsExpanded ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
-
- await this.Invalidate();
-
- // exclusivity
- //if (this.IsExpanded)
- //{
- //if (this.Model.IsExclusive)
- //{
- // if (this.FlowLayoutPanel != null)
- // {
- // foreach (TilePanelLayout item in this.FlowLayoutPanel.Controls.OfType())
- // {
- // if (item.Equals(this))
- // {
- // continue;
- // }
-
- // await item.Collapse();
- // }
- // }
- //}
- //}
-
- //label1.Image = (this.IsExpanded ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
- }
- else if (e.Button == MouseButtons.Right)
- {
- this.TitleContextMenuStrip?.Show(this, e.Location);
- }
- }
-
- #region encapsulation
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public new Padding Margin { get => base.Margin; set => base.Margin = new Padding(0); }
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public new Padding Padding { get => base.Padding; set => base.Padding = new Padding(0, 0, 0, 10); }
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public new ContextMenuStrip ContextMenuStrip { get; set; } = null;
-
- #endregion
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public Point GridSize
- {
- get => gridSize;
- protected set
- {
- gridSize = value;
- expandedHeight = (this.TileSize * value.Y) + labelHeight;
-
- int newWidth = CalcWidth(gridSize.X);
-
- this.Size = new Size(newWidth, (this.IsExpanded ? this.ExpandedHeight : this.CollapseHeight));
- }
- }
-
- [Category("Appearance")]
- public ContextMenuStrip TitleContextMenuStrip { get; set; } = null;
-
- [Category("Appearance")]
- public ContextMenuStrip ContainerContextMenuStrip { get; set; } = null;
-
- [Category("Appearance")]
- public bool EnableAnimation { get; set; } = false;
-
- [Category("Appearance")]
- public string Title { get => label1.Text?.Trim(); set => label1.Text = " " + value; }
-
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public List GridTileItems { get; protected set; } = new List();
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public FlowLayoutPanel FlowLayoutPanel { get => UIControl.GetParentsUntil(this.Parent); }
-
- protected int CollapseHeight
- => labelHeight + collapseHeight;
-
- protected int ExpandedHeight
- => expandedHeight + this.Padding.Bottom;
-
- protected int TileSize => (tileSize + margin);
-
- [Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
- public bool IsExpanded
- {
- get => isExpanded;
- protected set
- {
- isExpanded = value;
-
- //label1.Image = (isExpanded ? UIResource1.toggle_right_16 : UIResource1.toggle_left_16);
- label1.Image = (isExpanded ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
- }
- }
-
-
- public void Clear()
- {
- this.Controls.Clear();
- }
-
- public async Task Collapse()
- {
- await Task.Run(() =>
- {
- if (isAnimating) return;
-
- isAnimating = true;
- this.IsExpanded = false;
-
- if (this.EnableAnimation)
- {
- while (this.Height > this.CollapseHeight)
- {
- UIControl.SetHeight(this, (this.Height - collapseIncrement));
-
- Thread.Sleep(10);
- }
- }
-
- UIControl.SetHeight(this, this.CollapseHeight);
-
- isAnimating = false;
-
- this.Invalidate(this.DisplayRectangle, false);
- });
- }
-
- public async Task Expand()
- {
- await Task.Run(() =>
- {
- if (isAnimating) return;
-
- isAnimating = true;
- this.IsExpanded = true;
-
- if (this.EnableAnimation)
- {
- while (this.Height < this.ExpandedHeight)
- {
- UIControl.SetHeight(this, (this.Height + expandIncrement));
- Thread.Sleep(10);
- }
- }
-
- UIControl.SetHeight(this, this.ExpandedHeight);
-
- isAnimating = false;
-
- this.Invalidate(this.DisplayRectangle, false);
- });
- }
-
- public new async Task Invalidate()
- {
- base.Invalidate();
-
- if (isAnimating)
- {
- return;
- }
-
- if (this.IsExpanded)
- {
- await this.Expand();
- }
- else
- {
- await this.Collapse();
- }
- }
-
- public void MoveTop()
- {
- if (this.FlowLayoutPanel != null)
- {
- this.FlowLayoutPanel.Controls.SetChildIndex(this, 0);
- }
- }
-
- public void MoveUp()
- {
- if (this.FlowLayoutPanel != null)
- {
- int pos = this.FlowLayoutPanel.Controls.GetChildIndex(this);
- if (pos <= 0)
- {
- return;
- }
-
- this.FlowLayoutPanel.Controls.SetChildIndex(this, (pos - 1));
- }
- }
-
- public void MoveDown()
- {
- if (this.FlowLayoutPanel != null)
- {
- int pos = this.FlowLayoutPanel.Controls.GetChildIndex(this);
- if (pos >= (this.FlowLayoutPanel.Controls.Count - 1))
- {
- return;
- }
-
- this.FlowLayoutPanel.Controls.SetChildIndex(this, (pos + 1));
- }
- }
-
- public void MoveBottom()
- {
- if (this.FlowLayoutPanel != null)
- {
- this.FlowLayoutPanel.Controls.SetChildIndex(this, (this.FlowLayoutPanel.Controls.Count - 1));
- }
- }
-
- public void MoveTile(T panel, int posX, int posY)
- {
- GridTileItem item = this.GridTileItems.Where(x => x.Tile.Equals(panel)).FirstOrDefault();
- if (item == null)
- {
- return;
- }
-
- //Point newPosition = ConvertLocationToNearestCoord(posX, posY);
- //Point newPosition = ConvertLocationToCoord(posX, posY);
- Point newPosition = ConvertLocationToCoord(panel.Location.X, panel.Location.Y);
- if (!IsCoordInBounds(newPosition))
- {
- return;
- }
-
- if (HasTile(newPosition))
- {
- GridTileItem swapItem = this.GridTileItems.Where(x => x.Coord.Equals(newPosition)).FirstOrDefault();
- if (swapItem != null)
- {
- swapItem.Coord = item.Coord;
- swapItem.Tile.Location = ConvertCoordToLocation(item.Coord);
- }
-
- item.Coord = newPosition;
- panel.Location = ConvertCoordToLocation(newPosition);
- }
- else
- {
- item.Coord = newPosition;
- panel.Location = ConvertCoordToLocation(newPosition);
- }
- }
-
- public void Remove()
- {
- if (this.FlowLayoutPanel != null)
- {
- this.FlowLayoutPanel.Controls.Remove(this);
- }
- }
-
- public void Remove(T panel)
- {
- GridTileItem m = this.GridTileItems.Where(x => x.Tile.Equals(panel)).FirstOrDefault();
- if (m != null)
- {
- this.GridTileItems.Remove(m);
- }
-
- this.Controls.Remove(panel);
- }
-
- //protected Point CalcCoordFromPosition(int posX, int posY)
- //{
- // int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
- // int y = (int)Math.Round(decimal.Divide((posY - labelHeight), this.TileSize));
-
- // if (x < 0) x = 0;
- // if (y < 0) y = 0;
-
- // return new Point((x * this.TileSize), ((y * this.TileSize) + labelHeight));
- //}
-
- protected Point ConvertCoordToLocation(Point position)
- => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));
-
- protected Point ConvertLocationToCoord(int posX, int posY)
- {
- int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
- int y = (int)Math.Round(decimal.Divide((posY - labelHeight), this.TileSize));
-
- //int x = (int)Math.Ceiling(decimal.Divide(posX, this.TileSize));
- //int y = (int)Math.Ceiling(decimal.Divide((posY - labelHeight), this.TileSize));
-
- //x--;
- //y--;
-
- if (x < 0) x = 0;
- if (y < 0) y = 0;
-
- return new Point(x, y);
- }
-
- //protected Point ConvertLocationToNearestCoord(int posX, int posY)
- //{
- // int x = (int)Math.Round(decimal.Divide(posX, this.TileSize));
- // int y = (int)Math.Round(decimal.Divide((posY - labelHeight), this.TileSize));
-
- // if (x < 0) x = 0;
- // if (y < 0) y = 0;
-
- // return new Point(x, y);
- //}
-
- protected bool HasTile(Point position)
- {
- if (GridTileItems == null)
- {
- return false;
- }
-
- if (GridTileItems.Count <= 0)
- {
- return false;
- }
-
- return GridTileItems.Any(x => x.Coord.Equals(position));
- }
-
- protected bool IsCoordInBounds(Point position)
- {
- if (position.X >= this.GridSize.X)
- {
- return false;
- }
-
- if (position.Y >= this.GridSize.Y)
- {
- return false;
- }
-
- return true;
- }
-
- protected Point? FindFirstFreeCoord()
- {
- for (int y = 0; y < this.GridSize.Y; y++)
- {
- for (int x = 0; x < this.GridSize.X; x++)
- {
- if (HasTile(new Point(x, y)))
- {
- continue;
- }
-
- return new Point(x, y);
- }
- }
-
- return null;
- }
-
- protected Point? FindLastFreeCoord()
- {
- Point gridSize = this.GridSize;
-
- // none available
- if (GridTileItems.Count >= (gridSize.X * gridSize.Y))
- {
- return null;
- }
-
- if (GridTileItems.Count <= 0)
- {
- return FindFirstFreeCoord();
- }
-
- // only one available
- if (GridTileItems.Count >= ((gridSize.X * gridSize.Y) - 1))
- {
- return FindFirstFreeCoord();
- }
-
- Point? rv = null;
-
- for (int y = (gridSize.Y - 1); y >= 0; y--)
- {
- for (int x = (gridSize.X - 1); x >= 0; x--)
- {
- if (HasTile(new Point(x, y)))
- {
- if (rv.HasValue)
- {
- return rv;
- }
- }
- else
- {
- rv = new Point(x, y);
- }
- }
- }
-
- return null;
- }
-
- protected Point? FindNextFreeCoord(Point coord)
- {
- Point newCoord = coord;
-
- while (true)
- {
- newCoord.X++;
-
- if (newCoord.X >= this.GridSize.X)
- {
- newCoord.Y++;
- newCoord.X = 0;
- }
-
- if (!IsCoordInBounds(newCoord))
- {
- return null;
- }
-
- if (HasTile(newCoord))
- {
- continue;
- }
-
- return newCoord;
- }
- }
-
- protected Point? ResolveCoord(Point coord)
- {
- if (!IsCoordInBounds(coord))
- {
- return null;
- }
-
- if (!HasTile(coord))
- {
- return coord;
- }
-
- return FindNextFreeCoord(coord);
- }
-
- }
-}