release/0.3.0.153 #2

Merged
Ray merged 6 commits from release/0.3.0.153 into master 2024-07-07 18:43:10 +00:00
29 changed files with 662 additions and 3257 deletions
Showing only changes of commit 2e3b2998e7 - Show all commits

186
EditGroupForm.cs Normal file
View File

@ -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;
}
}
}
}

View File

@ -18,7 +18,7 @@
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing"">Blue</data> <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value> <value>[base64 mime encoded serialized .NET Framework object]</value>
</data> </data>
@ -117,4 +117,25 @@
<resheader name="writer"> <resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader> </resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="textBox1.HighlightImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAAN5JREFUOE/tUzsKwkAUXLCyFMHjeIvdB4Gk8ALamU4rsbLaTWz0AOYGOYMewTqe
QLEQnZc8WRMSsBYHhrzPzJBin2pC60PPGLs3xl3Bp5DrHe9E1g2tHUH8QMjKmGReketyZkRWh9abfhTZ
YRimI4jWRPYSBMngkzzjHWtYyx6xK4X0Anz/7rcsxM4BdoxBTuTOqCdEaUyU6DrTuNqxxuXsEXsFDLfg
UdpOsIa10nr8A34p4CRtJ1jTGoC3PsPiBi78ETXplqzBwU3F5sHHgWWGJ3rHt+3tg+Uu84ek1AsYYd8q
EsfwCwAAAABJRU5ErkJggg==
</value>
</data>
<data name="textBox1.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
wQAADsEBuJFr7QAAANFJREFUOE/tkzEKAjEURANWliJ4HG+h9l5AO7fTSjyCxWpCIBB2b+AZ9AjW6wlc
LGSdWb9Elw1YiwOP/Pw/E1Ikqqksyzpa670x5goqgfWOM7HFhfAE5jvWNdYFkZq9sdg+laZp13vfBwOY
NjBfnHO9d9jjjB56mZG4UhgW4HXdbykkXl97iMYBnFFPrbUJGDVIOKOHXmYk/hSaW3CUbVT00CvboP8B
v3TASbZR0RM7YA5KsAT1J2phBUq8wpnEgvg5MMwxvGFte/uVzPLwkZR6AInAKK6aICfTAAAAAElFTkSu
QmCC
</value>
</data>
</root> </root>

View File

@ -6,36 +6,43 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using FizzyLauncher.Models; using FizzyLauncher.Models;
using FizzyLauncher.Windows.Forms;
using RyzStudio.Windows.Forms; using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms; 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 public class EditTileFolderForm : TDialog
{ {
private System.Windows.Forms.Label label1; private Label label1;
private ThButton button1; private ThButton button1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private THorizontalSeparator horizontalSeparator2;
private ThTextBox textBox1; private ThClearableTextBox textBox1;
private ThListBox listBox1; private ThListBox listBox1;
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1; private THorizontalSeparator tHorizontalSeparator1;
private System.Windows.Forms.Label label2; private Label label2;
private TileModel result = null;
public EditTileFolderForm(TileModel model = null) public EditTileFolderForm(TileModel model = null)
{ {
InitializeComponent(); InitializeComponent();
this.StartPosition = FormStartPosition.WindowsDefaultLocation; StartPosition = FormStartPosition.WindowsDefaultLocation;
this.OkButton = button1; 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<TileModel>()) foreach (TileModel item in result.Items ?? new List<TileModel>())
{ {
if (item.IsGroup) if (item.IsGroup)
{ {
@ -47,33 +54,29 @@ namespace FizzyLauncher.Windows.Forms
} }
else else
{ {
this.Text = "Add Folder"; Text = "Add Folder";
} }
} }
private void InitializeComponent() private void InitializeComponent()
{ {
textBox1 = new ThTextBox(); textBox1 = new ThClearableTextBox();
label1 = new Label(); label1 = new Label();
button1 = new ThButton(); button1 = new ThButton();
horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); horizontalSeparator2 = new THorizontalSeparator();
listBox1 = new ThListBox(); listBox1 = new ThListBox();
label2 = new Label(); label2 = new Label();
tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); tHorizontalSeparator1 = new THorizontalSeparator();
SuspendLayout(); SuspendLayout();
// //
// textBox1 // textBox1
// //
textBox1.AcceptButton = null;
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = Color.Transparent; textBox1.BackColor = Color.Transparent;
textBox1.EnableReactiveVisual = true; textBox1.EnableReactiveVisual = true;
textBox1.Font = new Font("Microsoft Sans Serif", 8.25F); textBox1.Font = new Font("Microsoft Sans Serif", 8.25F);
textBox1.Location = new Point(109, 20); textBox1.Location = new Point(109, 20);
textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1"; textBox1.Name = "textBox1";
textBox1.Padding = new Padding(4, 4, 3, 3);
textBox1.ReadOnly = false;
textBox1.Size = new Size(260, 35); textBox1.Size = new Size(260, 35);
textBox1.TabIndex = 152; textBox1.TabIndex = 152;
textBox1.TabStop = false; textBox1.TabStop = false;
@ -196,12 +199,14 @@ namespace FizzyLauncher.Windows.Forms
{ {
get get
{ {
var result = new TileModel() if (result == null)
{ {
Title = textBox1.Text?.Trim() ?? string.Empty, result = new TileModel();
IsGroup = true, }
Items = new List<TileModel>()
}; result.Title = textBox1.Text?.Trim() ?? string.Empty;
result.IsGroup = true;
result.Items = new List<TileModel>();
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>()) foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
{ {
@ -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)) if (e.Data.GetDataPresent(DataFormats.FileDrop))
{ {

View File

@ -4,34 +4,40 @@ using FizzyLauncher.Models;
using RyzStudio.Windows.Forms; using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms; using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox; 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 public class EditTileForm : TDialog
{ {
private System.Windows.Forms.Label label6; private Label label6;
private System.Windows.Forms.Label label7; private Label label7;
private System.Windows.Forms.Label label4; private Label label4;
private System.Windows.Forms.Label label3; private Label label3;
private System.Windows.Forms.Label label2; private Label label2;
private System.Windows.Forms.Label label1; private Label label1;
private ThPathDialogTextBox textBox2; private ThPathDialogTextBox textBox2;
private ThTextBox textBox3; private ThClearableTextBox textBox3;
private ThPathDialogTextBox textBox4; private ThPathDialogTextBox textBox4;
private ThButton button1; private ThButton button1;
private ThPickerBox pickerBox1; private ThPickerBox pickerBox1;
private ThPickerBox pickerBox2; private ThYesNoPickerBox pickerBox2;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1; private THorizontalSeparator horizontalSeparator1;
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2; private THorizontalSeparator horizontalSeparator2;
private ThTextBox textBox1; private ThClearableTextBox textBox1;
private TileModel result = null;
public EditTileForm(TileModel model = null) public EditTileForm(TileModel model = null)
{ {
InitializeComponent(); InitializeComponent();
this.StartPosition = FormStartPosition.WindowsDefaultLocation; StartPosition = FormStartPosition.WindowsDefaultLocation;
this.OkButton = button1; OkButton = button1;
result = model;
pickerBox1.ComboBox.Items.Clear(); pickerBox1.ComboBox.Items.Clear();
pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" }); pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" });
@ -40,33 +46,26 @@ namespace FizzyLauncher.Windows.Forms
pickerBox1.ComboBox.SelectedIndex = 0; pickerBox1.ComboBox.SelectedIndex = 0;
} }
pickerBox2.ComboBox.Items.Clear(); if (result != null)
pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
if (pickerBox2.ComboBox.Items.Count > 0)
{ {
pickerBox2.ComboBox.SelectedIndex = 0; Text = "Edit Tile";
}
if (model != null) textBox1.Text = result?.Title ?? string.Empty;
{ textBox2.Text = result?.ProcessFilename ?? string.Empty;
this.Text = "Edit Tile"; textBox3.Text = result?.ProcessArgument ?? string.Empty;
textBox4.Text = result?.ProcessWorkingDirectory ?? string.Empty;
textBox1.Text = model?.Title ?? string.Empty; pickerBox1.ComboBox.SelectedIndex = (int)result.ProcessWindowStyle;
textBox2.Text = model?.ProcessFilename ?? string.Empty; pickerBox2.Value = result.ProcessAsAdmin;
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);
} }
else else
{ {
this.Text = "Add Tile"; Text = "Add Tile";
} }
} }
private void InitializeComponent() private void InitializeComponent()
{ {
textBox1 = new ThTextBox(); textBox1 = new ThClearableTextBox();
label6 = new Label(); label6 = new Label();
label7 = new Label(); label7 = new Label();
label4 = new Label(); label4 = new Label();
@ -74,27 +73,23 @@ namespace FizzyLauncher.Windows.Forms
label2 = new Label(); label2 = new Label();
label1 = new Label(); label1 = new Label();
textBox2 = new ThPathDialogTextBox(); textBox2 = new ThPathDialogTextBox();
textBox3 = new ThTextBox(); textBox3 = new ThClearableTextBox();
textBox4 = new ThPathDialogTextBox(); textBox4 = new ThPathDialogTextBox();
button1 = new ThButton(); button1 = new ThButton();
pickerBox1 = new ThPickerBox(); pickerBox1 = new ThPickerBox();
pickerBox2 = new ThPickerBox(); pickerBox2 = new ThYesNoPickerBox();
horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator(); horizontalSeparator1 = new THorizontalSeparator();
horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator(); horizontalSeparator2 = new THorizontalSeparator();
SuspendLayout(); SuspendLayout();
// //
// textBox1 // textBox1
// //
textBox1.AcceptButton = null;
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox1.BackColor = Color.Transparent; textBox1.BackColor = Color.Transparent;
textBox1.EnableReactiveVisual = true; textBox1.EnableReactiveVisual = true;
textBox1.Font = new Font("Segoe UI", 9F); textBox1.Font = new Font("Segoe UI", 9F);
textBox1.Location = new Point(126, 20); textBox1.Location = new Point(126, 20);
textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1"; textBox1.Name = "textBox1";
textBox1.Padding = new Padding(4, 4, 3, 3);
textBox1.ReadOnly = false;
textBox1.Size = new Size(243, 35); textBox1.Size = new Size(243, 35);
textBox1.TabIndex = 152; textBox1.TabIndex = 152;
textBox1.TabStop = false; textBox1.TabStop = false;
@ -181,21 +176,14 @@ namespace FizzyLauncher.Windows.Forms
// //
// textBox2 // textBox2
// //
textBox2.AcceptButton = null;
textBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox2.BackColor = Color.Transparent; textBox2.BackColor = Color.Transparent;
textBox2.DialogMode = ThPathDialogTextBox.DialogType.OpenFile; textBox2.DialogMode = ThPathDialogTextBox.DialogType.OpenFile;
textBox2.EnableReactiveVisual = true; textBox2.EnableReactiveVisual = true;
textBox2.FolderBrowserDialog = null;
textBox2.Font = new Font("Segoe UI", 9F); textBox2.Font = new Font("Segoe UI", 9F);
textBox2.HighlightImage = null;
textBox2.Location = new Point(126, 61); textBox2.Location = new Point(126, 61);
textBox2.Margin = new Padding(10, 10, 10, 0); textBox2.Margin = new Padding(10, 10, 10, 0);
textBox2.Name = "textBox2"; 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.Size = new Size(243, 32);
textBox2.TabIndex = 170; textBox2.TabIndex = 170;
textBox2.TabStop = false; textBox2.TabStop = false;
@ -203,38 +191,25 @@ namespace FizzyLauncher.Windows.Forms
// //
// textBox3 // textBox3
// //
textBox3.AcceptButton = null;
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox3.BackColor = Color.Transparent; textBox3.BackColor = Color.Transparent;
textBox3.EnableReactiveVisual = true; textBox3.EnableReactiveVisual = true;
textBox3.Font = new Font("Segoe UI", 9F); textBox3.Font = new Font("Segoe UI", 9F);
textBox3.Location = new Point(147, 102); textBox3.Location = new Point(147, 102);
textBox3.Margin = new Padding(10, 10, 10, 0);
textBox3.Name = "textBox3"; textBox3.Name = "textBox3";
textBox3.Padding = new Padding(4, 4, 3, 3);
textBox3.ReadOnly = false;
textBox3.Size = new Size(222, 35); textBox3.Size = new Size(222, 35);
textBox3.TabIndex = 171; textBox3.TabIndex = 171;
textBox3.TabStop = false; textBox3.TabStop = false;
textBox3.UseSystemPasswordChar = false;
// //
// textBox4 // textBox4
// //
textBox4.AcceptButton = null;
textBox4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; textBox4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
textBox4.BackColor = Color.Transparent; textBox4.BackColor = Color.Transparent;
textBox4.DialogMode = ThPathDialogTextBox.DialogType.FolderBrowser; textBox4.DialogMode = ThPathDialogTextBox.DialogType.FolderBrowser;
textBox4.EnableReactiveVisual = true; textBox4.EnableReactiveVisual = true;
textBox4.FolderBrowserDialog = null;
textBox4.Font = new Font("Segoe UI", 9F); textBox4.Font = new Font("Segoe UI", 9F);
textBox4.HighlightImage = null;
textBox4.Location = new Point(147, 143); textBox4.Location = new Point(147, 143);
textBox4.Margin = new Padding(10, 10, 10, 0);
textBox4.Name = "textBox4"; 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.Size = new Size(222, 32);
textBox4.TabIndex = 172; textBox4.TabIndex = 172;
textBox4.TabStop = false; textBox4.TabStop = false;
@ -277,16 +252,12 @@ namespace FizzyLauncher.Windows.Forms
// //
// pickerBox2 // pickerBox2
// //
pickerBox2.AcceptButton = null;
pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right; pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
pickerBox2.BackColor = Color.Transparent; pickerBox2.BackColor = Color.Transparent;
pickerBox2.EnableReactiveVisual = true; pickerBox2.EnableReactiveVisual = true;
pickerBox2.Font = new Font("Segoe UI", 9F); pickerBox2.Font = new Font("Segoe UI", 9F);
pickerBox2.Location = new Point(285, 250); pickerBox2.Location = new Point(285, 250);
pickerBox2.Margin = new Padding(10, 10, 10, 0);
pickerBox2.Name = "pickerBox2"; pickerBox2.Name = "pickerBox2";
pickerBox2.Padding = new Padding(4, 4, 3, 3);
pickerBox2.SelectedIndex = -1;
pickerBox2.Size = new Size(84, 34); pickerBox2.Size = new Size(84, 34);
pickerBox2.TabIndex = 175; pickerBox2.TabIndex = 175;
pickerBox2.TabStop = false; pickerBox2.TabStop = false;
@ -349,15 +320,22 @@ namespace FizzyLauncher.Windows.Forms
public TileModel Result public TileModel Result
{ {
get => new TileModel() get
{ {
Title = textBox1.Text?.Trim() ?? string.Empty, if (result == null)
ProcessFilename = textBox2.Text?.Trim() ?? string.Empty, {
ProcessArgument = textBox3.Text?.Trim() ?? string.Empty, result = new TileModel();
ProcessWorkingDirectory = textBox4.Text?.Trim(), }
ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex,
ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1) 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;
}
} }
} }

View File

@ -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<bool> OnSaveSessionEvent(FileSessionManager sender, string filename, bool showNotices = true);
public delegate Task<bool> 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<bool> 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<bool> PerformSaveSession(string filename, bool showNotices = true)
{
if (this.OnSaveSession == null)
{
return false;
}
return await this.OnSaveSession?.Invoke(this, filename, showNotices);
}
private async Task<bool> PerformLoadSession(string filename)
{
if (this.OnLoadSession == null)
{
return false;
}
return await this.OnLoadSession?.Invoke(this, filename);
}
private async Task PerformClearSession() => this.OnClearSession?.Invoke(this);
}
}

View File

@ -14,7 +14,7 @@
<Copyright>Ray Lam</Copyright> <Copyright>Ray Lam</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion> <AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion> <FileVersion>1.0.0.0</FileVersion>
<Version>0.2.5.058</Version> <Version>0.3.0.153</Version>
<EnableNETAnalyzers>False</EnableNETAnalyzers> <EnableNETAnalyzers>False</EnableNETAnalyzers>
<PlatformTarget>x64</PlatformTarget> <PlatformTarget>x64</PlatformTarget>
</PropertyGroup> </PropertyGroup>

36
MainForm.Designer.cs generated
View File

@ -76,9 +76,11 @@ namespace FizzyLauncher
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator(); toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
panel1 = new System.Windows.Forms.Panel();
contextMenuStrip2.SuspendLayout(); contextMenuStrip2.SuspendLayout();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
tileContainerMenu1.SuspendLayout(); tileContainerMenu1.SuspendLayout();
panel1.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// saveFileDialog1 // saveFileDialog1
@ -117,7 +119,7 @@ namespace FizzyLauncher
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, toolStripMenuItem1, viewToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem1 }); menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, toolStripMenuItem1, viewToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem1 });
menuStrip1.Location = new System.Drawing.Point(0, 0); menuStrip1.Location = new System.Drawing.Point(0, 0);
menuStrip1.Name = "menuStrip1"; menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new System.Drawing.Size(873, 24); menuStrip1.Size = new System.Drawing.Size(404, 24);
menuStrip1.TabIndex = 2; menuStrip1.TabIndex = 2;
menuStrip1.MenuActivate += menuStrip1_MenuActivate; menuStrip1.MenuActivate += menuStrip1_MenuActivate;
// //
@ -215,14 +217,14 @@ namespace FizzyLauncher
// showBigIconsToolStripMenuItem // showBigIconsToolStripMenuItem
// //
showBigIconsToolStripMenuItem.Name = "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.Text = "Show &Big Icons";
showBigIconsToolStripMenuItem.Click += showBigIconsToolStripMenuItem_Click; showBigIconsToolStripMenuItem.Click += showBigIconsToolStripMenuItem_Click;
// //
// alwaysOnTopToolStripMenuItem // alwaysOnTopToolStripMenuItem
// //
alwaysOnTopToolStripMenuItem.Name = "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.Text = "Always On &Top";
alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click; alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click;
// //
@ -378,21 +380,35 @@ namespace FizzyLauncher
// flowLayoutPanel1 // flowLayoutPanel1
// //
flowLayoutPanel1.AutoScroll = true; 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.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.Name = "flowLayoutPanel1";
flowLayoutPanel1.Size = new System.Drawing.Size(461, 426); flowLayoutPanel1.Size = new System.Drawing.Size(398, 417);
flowLayoutPanel1.TabIndex = 8; flowLayoutPanel1.TabIndex = 8;
flowLayoutPanel1.WrapContents = false; 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 // MainForm
// //
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.FromArgb(250, 250, 250); BackColor = System.Drawing.Color.FromArgb(250, 250, 250);
BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
ClientSize = new System.Drawing.Size(873, 505); ClientSize = new System.Drawing.Size(404, 441);
Controls.Add(flowLayoutPanel1); Controls.Add(panel1);
Controls.Add(menuStrip1); Controls.Add(menuStrip1);
DoubleBuffered = true; DoubleBuffered = true;
ForeColor = System.Drawing.SystemColors.ControlText; ForeColor = System.Drawing.SystemColors.ControlText;
@ -400,13 +416,14 @@ namespace FizzyLauncher
MainMenuStrip = menuStrip1; MainMenuStrip = menuStrip1;
MaximizeBox = false; MaximizeBox = false;
MinimizeBox = false; MinimizeBox = false;
MinimumSize = new System.Drawing.Size(420, 280); MinimumSize = new System.Drawing.Size(300, 320);
Name = "MainForm"; Name = "MainForm";
Text = "Fizzy Launcher"; Text = "Fizzy Launcher";
contextMenuStrip2.ResumeLayout(false); contextMenuStrip2.ResumeLayout(false);
menuStrip1.ResumeLayout(false); menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout(); menuStrip1.PerformLayout();
tileContainerMenu1.ResumeLayout(false); tileContainerMenu1.ResumeLayout(false);
panel1.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
@ -456,6 +473,7 @@ namespace FizzyLauncher
private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
} }
} }

File diff suppressed because it is too large Load Diff

27
Models/AppOptions.cs Normal file
View File

@ -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<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
public Point StartPosition { get; set; } = Point.Empty;
public int Height { get; set; } = 280;
}
}

View File

@ -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<TileGroupModel> Groups { get; set; } = new List<TileGroupModel>();
public Point StartPosition { get; set; } = Point.Empty;
public int Height { get; set; } = 280;
//public int ColumnCount { get; set; } = 8;
}
}

View File

@ -10,8 +10,6 @@ namespace FizzyLauncher.Models
public bool IsExpanded { get; set; } = false; public bool IsExpanded { get; set; } = false;
public bool IsExclusive { get; set; } = false;
public List<TileModel> Items { get; set; } = new List<TileModel>(); public List<TileModel> Items { get; set; } = new List<TileModel>();
[JsonConverter(typeof(RyzStudio.Text.Json.JsonSizeConverter))] [JsonConverter(typeof(RyzStudio.Text.Json.JsonSizeConverter))]

View File

@ -29,10 +29,10 @@ namespace FizzyLauncher
private ThYesNoPickerBox yesNoPickerBox4; private ThYesNoPickerBox yesNoPickerBox4;
private Label label3; private Label label3;
private LauncherSession _appSession = null; private AppOptions _appSession = null;
public OptionsForm(LauncherSession appSession) public OptionsForm(AppOptions appSession)
{ {
InitializeComponent(); InitializeComponent();
@ -57,7 +57,7 @@ namespace FizzyLauncher
private void InitializeComponent() private void InitializeComponent()
{ {
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(OptionsForm)); 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(); label1 = new Label();
button1 = new ThButton(); button1 = new ThButton();
yesNoPickerBox2 = new ThYesNoPickerBox(); yesNoPickerBox2 = new ThYesNoPickerBox();
@ -198,11 +198,11 @@ namespace FizzyLauncher
textBox1.EnableReactiveVisual = true; textBox1.EnableReactiveVisual = true;
textBox1.Font = new System.Drawing.Font("Segoe UI", 9F); textBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
textBox1.HighlightImage = (System.Drawing.Image)resources.GetObject("textBox1.HighlightImage"); textBox1.HighlightImage = (System.Drawing.Image)resources.GetObject("textBox1.HighlightImage");
results2.IsAlt = false; results1.IsAlt = false;
results2.IsCtrl = false; results1.IsCtrl = false;
results2.IsShift = false; results1.IsShift = false;
results2.Key = Keys.None; results1.Key = Keys.None;
textBox1.KeyCodeResults = results2; textBox1.KeyCodeResults = results1;
textBox1.Location = new System.Drawing.Point(192, 21); textBox1.Location = new System.Drawing.Point(192, 21);
textBox1.Margin = new Padding(10, 10, 10, 0); textBox1.Margin = new Padding(10, 10, 10, 0);
textBox1.Name = "textBox1"; textBox1.Name = "textBox1";
@ -253,9 +253,9 @@ namespace FizzyLauncher
flowLayoutPanel1.Controls.Add(tTogglePanel1); flowLayoutPanel1.Controls.Add(tTogglePanel1);
flowLayoutPanel1.Controls.Add(tTogglePanel2); flowLayoutPanel1.Controls.Add(tTogglePanel2);
flowLayoutPanel1.FlowDirection = FlowDirection.TopDown; flowLayoutPanel1.FlowDirection = FlowDirection.TopDown;
flowLayoutPanel1.Location = new System.Drawing.Point(10, 12); flowLayoutPanel1.Location = new System.Drawing.Point(8, 12);
flowLayoutPanel1.Name = "flowLayoutPanel1"; flowLayoutPanel1.Name = "flowLayoutPanel1";
flowLayoutPanel1.Size = new System.Drawing.Size(424, 412); flowLayoutPanel1.Size = new System.Drawing.Size(436, 412);
flowLayoutPanel1.TabIndex = 194; flowLayoutPanel1.TabIndex = 194;
flowLayoutPanel1.WrapContents = false; flowLayoutPanel1.WrapContents = false;
flowLayoutPanel1.Resize += flowLayoutPanel1_Resize; flowLayoutPanel1.Resize += flowLayoutPanel1_Resize;
@ -268,6 +268,7 @@ namespace FizzyLauncher
tTogglePanel1.Controls.Add(label2); tTogglePanel1.Controls.Add(label2);
tTogglePanel1.Controls.Add(label4); tTogglePanel1.Controls.Add(label4);
tTogglePanel1.Controls.Add(numericBox1); tTogglePanel1.Controls.Add(numericBox1);
tTogglePanel1.ExpandedHeight = 100;
tTogglePanel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119); tTogglePanel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
tTogglePanel1.IsOpen = true; tTogglePanel1.IsOpen = true;
tTogglePanel1.Location = new System.Drawing.Point(0, 0); tTogglePanel1.Location = new System.Drawing.Point(0, 0);
@ -324,6 +325,7 @@ namespace FizzyLauncher
tTogglePanel2.Controls.Add(yesNoPickerBox3); tTogglePanel2.Controls.Add(yesNoPickerBox3);
tTogglePanel2.Controls.Add(label6); tTogglePanel2.Controls.Add(label6);
tTogglePanel2.Controls.Add(label7); tTogglePanel2.Controls.Add(label7);
tTogglePanel2.ExpandedHeight = 100;
tTogglePanel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119); tTogglePanel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
tTogglePanel2.IsOpen = true; tTogglePanel2.IsOpen = true;
tTogglePanel2.Location = new System.Drawing.Point(0, 119); tTogglePanel2.Location = new System.Drawing.Point(0, 119);
@ -394,13 +396,6 @@ namespace FizzyLauncher
flowLayoutPanel1_Resize(null, e); 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) private void flowLayoutPanel1_Resize(object sender, EventArgs e)
{ {
var width = flowLayoutPanel1.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth; var width = flowLayoutPanel1.ClientRectangle.Width - SystemInformation.VerticalScrollBarWidth;
@ -411,13 +406,13 @@ namespace FizzyLauncher
} }
} }
public LauncherSession Result public AppOptions Result
{ {
get get
{ {
if (_appSession == null) if (_appSession == null)
{ {
_appSession = new LauncherSession(); _appSession = new AppOptions();
} }
_appSession.TilesPerRow = numericBox1.Value; _appSession.TilesPerRow = numericBox1.Value;

View File

@ -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)
};
}
}
}

View File

@ -1,60 +0,0 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -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<TilePanelLayout> 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<TileGroupModel> 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<TileGroupModel> 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();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,241 +0,0 @@
namespace FizzyLauncher.Windows.Forms
{
partial class TilePanelLayout
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.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;
}
}

View File

@ -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<TilePanel>
{
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<MainForm>(this.Parent); }
public List<TileModel> Tiles
{
get
{
List<TileModel> result = new List<TileModel>();
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<TileModel> 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<TilePanelLayout>())
{
if (item.Equals(this))
{
continue;
}
await item.Collapse();
}
}
}
}
}
}
#region tile context menu
/// <summary>
/// Add tile
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
//EditTileForm.ShowAddDialog(this, coord);
}
/// <summary>
/// Add folder
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addListTileMenuItem_Click(object sender, EventArgs e)
{
Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
//EditTileFolderForm.ShowAddDialog(this, coord);
}
#endregion
#region group context menu
/// <summary>
/// Add group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addGroupMenuItem_Click(object sender, EventArgs e)
{
this.AddGroup();
}
/// <summary>
/// Edit group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void editGroupMenuItem_Click(object sender, EventArgs e)
{
this.EditGroup();
}
/// <summary>
/// Add row
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void toolStripMenuItem5_Click(object sender, EventArgs e)
{
this.AddRow();
}
/// <summary>
/// Remove row
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
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));
}
/// <summary>
/// Move to top
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveTopMenuItem_Click(object sender, EventArgs e)
{
this.MoveTop();
}
/// <summary>
/// Move up
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveUpMenuItem_Click(object sender, EventArgs e)
{
this.MoveUp();
}
/// <summary>
/// Move down
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveDownMenuItem_Click(object sender, EventArgs e)
{
this.MoveDown();
}
/// <summary>
/// Move to bottom
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void moveBottomMenuItem_Click(object sender, EventArgs e)
{
this.MoveBottom();
}
/// <summary>
/// Remove group
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void removeGroupMenuItem3_Click(object sender, EventArgs e)
{
this.Remove();
}
#endregion
}
}

View File

@ -1,66 +0,0 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="contextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="contextMenuStrip2.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>172, 17</value>
</metadata>
</root>

View File

@ -1,37 +0,0 @@
namespace FizzyLauncher.Windows
{
partial class GridTableLayout
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -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();
}
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,37 +0,0 @@
namespace RyzStudio.Windows.Forms
{
partial class TileGridPanel
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}

View File

@ -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<Control> TileGridLayout { get => UIControl.GetParentsUntil<TileGridPanelLayout<Control>>(this); }
}
}

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -1,67 +0,0 @@
using System.Drawing;
using System.Windows.Forms;
namespace RyzStudio.Windows.Forms
{
partial class TileGridPanelLayout<T>
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
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;
}
}

View File

@ -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<T> : 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<TilePanelLayout>())
// {
// 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<GridTileItem> GridTileItems { get; protected set; } = new List<GridTileItem>();
[Browsable(false), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public FlowLayoutPanel FlowLayoutPanel { get => UIControl.GetParentsUntil<FlowLayoutPanel>(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);
}
}
}