Archived
WIP: Upgrade to .NET 8
Upgrade to RyzStudio8 Rewrite
This commit is contained in:
1 parent
22d4f15bc9
commit
f06d311f40
32 files changed
+4058
-2679
No files matched your search
@@ -1,43 +1,49 @@
|
||||
using FizzyLauncher.Models;
|
||||
using System.Windows.Forms;
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using System;
|
||||
|
||||
namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
public class EditGroupForm : TDialogForm
|
||||
public class EditGroupForm : TDialog
|
||||
{
|
||||
public static void ShowDialog(TilePanelLayout control)
|
||||
{
|
||||
EditGroupForm form = new EditGroupForm();
|
||||
form.TilePanelLayout = control;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private TButton button1;
|
||||
private TPickerBox pickerBox1;
|
||||
private ThButton button1;
|
||||
private ThPickerBox pickerBox1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
|
||||
private TTextBox textBox1;
|
||||
private ThTextBox textBox1;
|
||||
|
||||
|
||||
public EditGroupForm() : base()
|
||||
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 (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 RyzStudio.Windows.ThemedForms.TTextBox();
|
||||
this.textBox1 = new ThTextBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
|
||||
this.pickerBox1 = new RyzStudio.Windows.ThemedForms.TPickerBox();
|
||||
this.button1 = new ThButton();
|
||||
this.pickerBox1 = new ThPickerBox();
|
||||
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@@ -97,7 +103,6 @@ namespace FizzyLauncher.Windows.Forms
|
||||
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;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// pickerBox1
|
||||
//
|
||||
@@ -145,31 +150,15 @@ namespace FizzyLauncher.Windows.Forms
|
||||
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
if (this.TilePanelLayout != null)
|
||||
public TileGroupModel Result
|
||||
{
|
||||
get => new TileGroupModel()
|
||||
{
|
||||
textBox1.Text = this.TilePanelLayout.Model.Title;
|
||||
pickerBox1.ComboBox.SelectedIndex = (this.TilePanelLayout.Model.IsExclusive ? 1 : 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TilePanelLayout TilePanelLayout { get; set; } = null;
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
TileGroupModel model = this.TilePanelLayout.Model;
|
||||
model.Title = textBox1.Text?.Trim();
|
||||
model.IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1);
|
||||
|
||||
this.TilePanelLayout.UpdateModel(model);
|
||||
|
||||
this.Close();
|
||||
Title = textBox1.Text?.Trim() ?? string.Empty,
|
||||
IsExclusive = (pickerBox1.ComboBox.SelectedIndex == 1)
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
+176
-247
@@ -1,309 +1,232 @@
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using System;
|
||||
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;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
|
||||
namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
public class EditTileFolderForm : TDialogForm
|
||||
public class EditTileFolderForm : TDialog
|
||||
{
|
||||
public static void ShowAddDialog(TilePanelLayout control, Point coord)
|
||||
{
|
||||
EditTileFolderForm form = new EditTileFolderForm(DialogModeType.Add);
|
||||
form.TilePanelLayout = control;
|
||||
form.AimCoord = coord;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowEditDialog(TilePanel control)
|
||||
{
|
||||
EditTileFolderForm form = new EditTileFolderForm(DialogModeType.Edit);
|
||||
form.TilePanel = control;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private System.Windows.Forms.Label label1;
|
||||
private TButton button1;
|
||||
private ThButton button1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
|
||||
private TTextBox textBox1;
|
||||
private TListBox listBox1;
|
||||
private ThTextBox textBox1;
|
||||
private ThListBox listBox1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator tHorizontalSeparator1;
|
||||
private System.Windows.Forms.Label label2;
|
||||
|
||||
|
||||
public enum DialogModeType
|
||||
{
|
||||
Add = 0,
|
||||
Edit
|
||||
}
|
||||
|
||||
|
||||
protected DialogModeType dialogMode = DialogModeType.Add;
|
||||
|
||||
|
||||
public EditTileFolderForm(DialogModeType dialogMode) : base()
|
||||
public EditTileFolderForm(TileModel model = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DialogMode = dialogMode;
|
||||
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
|
||||
this.OkButton = button1;
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
this.Text = "Edit Folder";
|
||||
|
||||
textBox1.Text = model?.Title ?? string.Empty;
|
||||
|
||||
foreach (TileModel item in model.Items ?? new System.Collections.Generic.List<TileModel>())
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
listBox1.ListBox.Items.Add(item);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text = "Add Folder";
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.textBox1 = new RyzStudio.Windows.ThemedForms.TTextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.button1 = new RyzStudio.Windows.ThemedForms.TButton();
|
||||
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.listBox1 = new RyzStudio.Windows.ThemedForms.TListBox();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.SuspendLayout();
|
||||
textBox1 = new ThTextBox();
|
||||
label1 = new Label();
|
||||
button1 = new ThButton();
|
||||
horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
listBox1 = new ThListBox();
|
||||
label2 = new Label();
|
||||
tHorizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
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;
|
||||
textBox1.AcceptButton = null;
|
||||
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox1.BackColor = Color.Transparent;
|
||||
textBox1.EnableReactiveVisual = true;
|
||||
textBox1.Font = new Font("Microsoft Sans Serif", 8.25F);
|
||||
textBox1.Location = new Point(109, 20);
|
||||
textBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox1.ReadOnly = false;
|
||||
textBox1.Size = new Size(260, 35);
|
||||
textBox1.TabIndex = 152;
|
||||
textBox1.TabStop = false;
|
||||
textBox1.UseSystemPasswordChar = false;
|
||||
//
|
||||
// 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;
|
||||
label1.AutoSize = true;
|
||||
label1.BackColor = Color.Transparent;
|
||||
label1.ForeColor = SystemColors.ControlText;
|
||||
label1.Location = new Point(10, 21);
|
||||
label1.Margin = new Padding(0);
|
||||
label1.Name = "label1";
|
||||
label1.Padding = new Padding(0, 9, 0, 10);
|
||||
label1.Size = new Size(29, 34);
|
||||
label1.TabIndex = 153;
|
||||
label1.Text = "Title";
|
||||
label1.TextAlign = 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;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
button1.AcceptButton = null;
|
||||
button1.ActiveImage = null;
|
||||
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button1.BackColor = Color.Transparent;
|
||||
button1.EnableMenuOnClick = false;
|
||||
button1.EnableReactiveVisual = true;
|
||||
button1.HoverImage = null;
|
||||
button1.IdleImage = null;
|
||||
button1.LabelText = "&Save";
|
||||
button1.Location = new 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 Size(128, 32);
|
||||
button1.TabIndex = 173;
|
||||
button1.TabStop = false;
|
||||
//
|
||||
// horizontalSeparator2
|
||||
//
|
||||
this.horizontalSeparator2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | 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, 61);
|
||||
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 = 177;
|
||||
horizontalSeparator2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
horizontalSeparator2.AutoScrollMargin = new Size(0, 0);
|
||||
horizontalSeparator2.AutoScrollMinSize = new Size(0, 0);
|
||||
horizontalSeparator2.BackColor = Color.Transparent;
|
||||
horizontalSeparator2.Location = new Point(10, 61);
|
||||
horizontalSeparator2.Margin = new Padding(0, 10, 0, 0);
|
||||
horizontalSeparator2.MaximumSize = new Size(4920, 2);
|
||||
horizontalSeparator2.MinimumSize = new Size(0, 22);
|
||||
horizontalSeparator2.Name = "horizontalSeparator2";
|
||||
horizontalSeparator2.Size = new Size(364, 22);
|
||||
horizontalSeparator2.TabIndex = 177;
|
||||
horizontalSeparator2.TabStop = false;
|
||||
//
|
||||
// listBox1
|
||||
//
|
||||
this.listBox1.AllowDrop = true;
|
||||
this.listBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.listBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.listBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.listBox1.Location = new System.Drawing.Point(109, 87);
|
||||
this.listBox1.Margin = new System.Windows.Forms.Padding(10, 4, 10, 4);
|
||||
this.listBox1.Name = "listBox1";
|
||||
this.listBox1.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.listBox1.Size = new System.Drawing.Size(260, 346);
|
||||
this.listBox1.AcceptButton = null;
|
||||
this.listBox1.TabIndex = 180;
|
||||
this.listBox1.OnAdd += new System.EventHandler(this.listBox1_OnAdd);
|
||||
this.listBox1.OnEdit += new System.EventHandler(this.listBox1_OnEdit);
|
||||
this.listBox1.DragDrop += new System.Windows.Forms.DragEventHandler(this.listBox1_DragDrop);
|
||||
this.listBox1.DragOver += new System.Windows.Forms.DragEventHandler(this.listBox1_DragOver);
|
||||
listBox1.AcceptButton = null;
|
||||
listBox1.AllowDrop = true;
|
||||
listBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
listBox1.BackColor = Color.Transparent;
|
||||
listBox1.EnableReactiveVisual = true;
|
||||
listBox1.Font = new Font("Microsoft Sans Serif", 8.25F);
|
||||
listBox1.Location = new Point(109, 87);
|
||||
listBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
listBox1.Name = "listBox1";
|
||||
listBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
listBox1.Size = new Size(260, 346);
|
||||
listBox1.TabIndex = 180;
|
||||
listBox1.OnAdd += listBox1_OnAdd;
|
||||
listBox1.OnEdit += listBox1_OnEdit;
|
||||
listBox1.DragDrop += listBox1_DragDrop;
|
||||
listBox1.DragOver += listBox1_DragOver;
|
||||
//
|
||||
// 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(8, 87);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label2.Size = new System.Drawing.Size(25, 34);
|
||||
this.label2.TabIndex = 181;
|
||||
this.label2.Text = "List";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label2.AutoSize = true;
|
||||
label2.BackColor = Color.Transparent;
|
||||
label2.ForeColor = SystemColors.ControlText;
|
||||
label2.Location = new Point(8, 87);
|
||||
label2.Name = "label2";
|
||||
label2.Padding = new Padding(0, 9, 0, 10);
|
||||
label2.Size = new Size(30, 34);
|
||||
label2.TabIndex = 181;
|
||||
label2.Text = "Tiles";
|
||||
label2.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// tHorizontalSeparator1
|
||||
//
|
||||
this.tHorizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.tHorizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.tHorizontalSeparator1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.tHorizontalSeparator1.Location = new System.Drawing.Point(10, 437);
|
||||
this.tHorizontalSeparator1.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||
this.tHorizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
|
||||
this.tHorizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22);
|
||||
this.tHorizontalSeparator1.Name = "tHorizontalSeparator1";
|
||||
this.tHorizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.tHorizontalSeparator1.Size = new System.Drawing.Size(364, 22);
|
||||
this.tHorizontalSeparator1.TabIndex = 182;
|
||||
tHorizontalSeparator1.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
tHorizontalSeparator1.AutoScrollMargin = new Size(0, 0);
|
||||
tHorizontalSeparator1.AutoScrollMinSize = new Size(0, 0);
|
||||
tHorizontalSeparator1.BackColor = Color.Transparent;
|
||||
tHorizontalSeparator1.Location = new Point(10, 437);
|
||||
tHorizontalSeparator1.Margin = new Padding(0, 10, 0, 0);
|
||||
tHorizontalSeparator1.MaximumSize = new Size(4920, 2);
|
||||
tHorizontalSeparator1.MinimumSize = new Size(0, 22);
|
||||
tHorizontalSeparator1.Name = "tHorizontalSeparator1";
|
||||
tHorizontalSeparator1.Size = new Size(364, 22);
|
||||
tHorizontalSeparator1.TabIndex = 182;
|
||||
tHorizontalSeparator1.TabStop = false;
|
||||
//
|
||||
// EditTileFolderForm
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(384, 521);
|
||||
this.Controls.Add(this.tHorizontalSeparator1);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.listBox1);
|
||||
this.Controls.Add(this.horizontalSeparator2);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.textBox1);
|
||||
this.MinimumSize = new System.Drawing.Size(400, 560);
|
||||
this.Name = "EditTileFolderForm";
|
||||
this.Text = "Add List Tile";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
ClientSize = new Size(384, 521);
|
||||
Controls.Add(tHorizontalSeparator1);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(listBox1);
|
||||
Controls.Add(horizontalSeparator2);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBox1);
|
||||
MinimumSize = new Size(400, 560);
|
||||
Name = "EditTileFolderForm";
|
||||
Text = "Add List Tile";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
|
||||
public TileModel Result
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
if (this.DialogMode == DialogModeType.Edit)
|
||||
get
|
||||
{
|
||||
listBox1.ListBox.Items.Clear();
|
||||
|
||||
if (this.TilePanel == null) return;
|
||||
if (this.TilePanel.ModelInfo == null) return;
|
||||
|
||||
textBox1.Text = this.TilePanel.ModelInfo.Title;
|
||||
|
||||
if (this.TilePanel.ModelInfo.Items != null)
|
||||
var result = new TileModel()
|
||||
{
|
||||
foreach (TileModel item in this.TilePanel.ModelInfo.Items)
|
||||
Title = textBox1.Text?.Trim() ?? string.Empty,
|
||||
IsGroup = true,
|
||||
Items = new List<TileModel>()
|
||||
};
|
||||
|
||||
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
listBox1.ListBox.Items.Add(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
result.Items.Add(item);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public TilePanelLayout TilePanelLayout { get; set; } = null;
|
||||
|
||||
public TilePanel TilePanel { get; set; } = null;
|
||||
|
||||
public Point AimCoord { get; set; } = new Point(-1, -1);
|
||||
|
||||
public DialogModeType DialogMode
|
||||
private void listBox1_OnAdd(object sender, EventArgs e)
|
||||
{
|
||||
get => dialogMode;
|
||||
set
|
||||
var form = new EditTileForm();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
dialogMode = value;
|
||||
|
||||
switch (dialogMode)
|
||||
{
|
||||
case DialogModeType.Add:
|
||||
this.Text = "Add Folder";
|
||||
textBox1.Text = "New Folder";
|
||||
break;
|
||||
case DialogModeType.Edit:
|
||||
this.Text = "Edit Folder";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
TileModel model = new TileModel()
|
||||
{
|
||||
Title = textBox1.Text?.Trim(),
|
||||
IsGroup = true
|
||||
listBox1.ListBox.Items.Add(form.Result);
|
||||
};
|
||||
|
||||
switch (this.DialogMode)
|
||||
{
|
||||
case DialogModeType.Add:
|
||||
if (!this.AimCoord.Equals(new Point(-1, -1)))
|
||||
{
|
||||
model.Position = this.AimCoord;
|
||||
}
|
||||
|
||||
model.Items = new System.Collections.Generic.List<TileModel>();
|
||||
|
||||
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
model.Items.Add(item);
|
||||
}
|
||||
|
||||
this.TilePanelLayout.AddTile(model);
|
||||
|
||||
break;
|
||||
case DialogModeType.Edit:
|
||||
model.Items = new System.Collections.Generic.List<TileModel>();
|
||||
|
||||
foreach (TileModel item in listBox1.ListBox.Items.OfType<TileModel>())
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
model.Items.Add(item);
|
||||
}
|
||||
|
||||
this.TilePanel.LoadInfo(model);
|
||||
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void listBox1_OnAdd(object sender, EventArgs e) => EditTileForm.ShowAddDialog(listBox1);
|
||||
|
||||
private void listBox1_OnEdit(object sender, EventArgs e)
|
||||
{
|
||||
if (listBox1.ListBox.Items.Count <= 0)
|
||||
@@ -311,7 +234,8 @@ namespace FizzyLauncher.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (listBox1.ListBox.SelectedIndex < 0)
|
||||
var n = listBox1.ListBox.SelectedIndex;
|
||||
if (n < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -321,7 +245,12 @@ namespace FizzyLauncher.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
EditTileForm.ShowEditDialog(listBox1);
|
||||
var form = new EditTileForm((TileModel)listBox1.ListBox.SelectedItem);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
listBox1.ListBox.Items.RemoveAt(n);
|
||||
listBox1.ListBox.Items.Insert(n, form.Result);
|
||||
};
|
||||
}
|
||||
|
||||
private void listBox1_DragOver(object sender, System.Windows.Forms.DragEventArgs e)
|
||||
@@ -338,7 +267,7 @@ namespace FizzyLauncher.Windows.Forms
|
||||
|
||||
private void listBox1_DragDrop(object sender, DragEventArgs e)
|
||||
{
|
||||
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
var fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
if (fileList == null)
|
||||
{
|
||||
return;
|
||||
@@ -354,7 +283,7 @@ namespace FizzyLauncher.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
TileModel model = new TileModel()
|
||||
var model = new TileModel()
|
||||
{
|
||||
ProcessFilename = fileList[0],
|
||||
Title = Path.GetFileName(fileList[0])
|
||||
|
||||
@@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
|
||||
+275
-393
@@ -1,482 +1,364 @@
|
||||
using FizzyLauncher.Models;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
|
||||
namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
public class EditTileForm : TDialogForm
|
||||
public class EditTileForm : TDialog
|
||||
{
|
||||
public static void ShowAddDialog(TilePanelLayout control, Point coord)
|
||||
{
|
||||
EditTileForm form = new EditTileForm(DialogModeType.Add);
|
||||
form.TilePanelLayout = control;
|
||||
form.AimCoord = coord;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowAddDialog(TListBox control)
|
||||
{
|
||||
EditTileForm form = new EditTileForm(DialogModeType.Add);
|
||||
form.ListBox = control;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowEditDialog(TilePanel control)
|
||||
{
|
||||
EditTileForm form = new EditTileForm(DialogModeType.Edit);
|
||||
form.TilePanel = control;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
public static void ShowEditDialog(TListBox control)
|
||||
{
|
||||
EditTileForm form = new EditTileForm(DialogModeType.Edit);
|
||||
form.ListBox = control;
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
|
||||
private System.Windows.Forms.Label label6;
|
||||
private System.Windows.Forms.Label label7;
|
||||
private System.Windows.Forms.Label label4;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private TOpenFileTextBox textBox2;
|
||||
private TTextBox textBox3;
|
||||
private TFolderTextBox textBox4;
|
||||
private TButton button1;
|
||||
private TPickerBox pickerBox1;
|
||||
private TPickerBox pickerBox2;
|
||||
private ThPathDialogTextBox textBox2;
|
||||
private ThTextBox textBox3;
|
||||
private ThPathDialogTextBox textBox4;
|
||||
private ThButton button1;
|
||||
private ThPickerBox pickerBox1;
|
||||
private ThPickerBox pickerBox2;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator1;
|
||||
private RyzStudio.Windows.Forms.THorizontalSeparator horizontalSeparator2;
|
||||
private TTextBox textBox1;
|
||||
private ThTextBox textBox1;
|
||||
|
||||
|
||||
public enum DialogModeType
|
||||
{
|
||||
Add = 0,
|
||||
Edit
|
||||
}
|
||||
|
||||
|
||||
protected DialogModeType dialogMode = DialogModeType.Add;
|
||||
|
||||
|
||||
public EditTileForm(DialogModeType dialogMode) : base()
|
||||
public EditTileForm(TileModel model = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.DialogMode = dialogMode;
|
||||
this.StartPosition = FormStartPosition.WindowsDefaultLocation;
|
||||
this.OkButton = button1;
|
||||
|
||||
pickerBox1.ComboBox.Items.Clear();
|
||||
pickerBox1.ComboBox.Items.AddRange(new string[] { "Normal", "Hidden", "Minimized", "Maximized" });
|
||||
if (pickerBox1.ComboBox.Items.Count > 0) pickerBox1.ComboBox.SelectedIndex = 0;
|
||||
if (pickerBox1.ComboBox.Items.Count > 0)
|
||||
{
|
||||
pickerBox1.ComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
pickerBox2.ComboBox.Items.Clear();
|
||||
pickerBox2.ComboBox.Items.AddRange(new string[] { "No", "Yes" });
|
||||
if (pickerBox2.ComboBox.Items.Count > 0) pickerBox2.ComboBox.SelectedIndex = 0;
|
||||
if (pickerBox2.ComboBox.Items.Count > 0)
|
||||
{
|
||||
pickerBox2.ComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
if (model != null)
|
||||
{
|
||||
this.Text = "Edit Tile";
|
||||
|
||||
textBox1.Text = model?.Title ?? string.Empty;
|
||||
textBox2.Text = model?.ProcessFilename ?? string.Empty;
|
||||
textBox3.Text = model?.ProcessArgument ?? string.Empty;
|
||||
textBox4.Text = model?.ProcessWorkingDirectory ?? string.Empty;
|
||||
pickerBox1.ComboBox.SelectedIndex = (int)model.ProcessWindowStyle;
|
||||
pickerBox2.ComboBox.SelectedIndex = (model.ProcessAsAdmin ? 1 : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text = "Add Tile";
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditTileForm));
|
||||
this.textBox1 = new TTextBox();
|
||||
this.label6 = new System.Windows.Forms.Label();
|
||||
this.label7 = new System.Windows.Forms.Label();
|
||||
this.label4 = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.textBox2 = new TOpenFileTextBox();
|
||||
this.textBox3 = new TTextBox();
|
||||
this.textBox4 = new TFolderTextBox();
|
||||
this.button1 = new TButton();
|
||||
this.pickerBox1 = new TPickerBox();
|
||||
this.pickerBox2 = new TPickerBox();
|
||||
this.horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
this.SuspendLayout();
|
||||
textBox1 = new ThTextBox();
|
||||
label6 = new Label();
|
||||
label7 = new Label();
|
||||
label4 = new Label();
|
||||
label3 = new Label();
|
||||
label2 = new Label();
|
||||
label1 = new Label();
|
||||
textBox2 = new ThPathDialogTextBox();
|
||||
textBox3 = new ThTextBox();
|
||||
textBox4 = new ThPathDialogTextBox();
|
||||
button1 = new ThButton();
|
||||
pickerBox1 = new ThPickerBox();
|
||||
pickerBox2 = new ThPickerBox();
|
||||
horizontalSeparator1 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
horizontalSeparator2 = new RyzStudio.Windows.Forms.THorizontalSeparator();
|
||||
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("Segoe UI", 9F, 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;
|
||||
textBox1.AcceptButton = null;
|
||||
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox1.BackColor = Color.Transparent;
|
||||
textBox1.EnableReactiveVisual = true;
|
||||
textBox1.Font = new Font("Segoe UI", 9F);
|
||||
textBox1.Location = new Point(126, 20);
|
||||
textBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox1.ReadOnly = false;
|
||||
textBox1.Size = new Size(243, 35);
|
||||
textBox1.TabIndex = 152;
|
||||
textBox1.TabStop = false;
|
||||
textBox1.UseSystemPasswordChar = false;
|
||||
//
|
||||
// label6
|
||||
//
|
||||
this.label6.AutoSize = true;
|
||||
this.label6.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label6.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label6.Location = new System.Drawing.Point(10, 250);
|
||||
this.label6.Name = "label6";
|
||||
this.label6.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label6.Size = new System.Drawing.Size(83, 34);
|
||||
this.label6.TabIndex = 163;
|
||||
this.label6.Text = "Run As Admin";
|
||||
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label6.AutoSize = true;
|
||||
label6.BackColor = Color.Transparent;
|
||||
label6.ForeColor = SystemColors.ControlText;
|
||||
label6.Location = new Point(10, 250);
|
||||
label6.Name = "label6";
|
||||
label6.Padding = new Padding(0, 9, 0, 10);
|
||||
label6.Size = new Size(83, 34);
|
||||
label6.TabIndex = 163;
|
||||
label6.Text = "Run As Admin";
|
||||
label6.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label7
|
||||
//
|
||||
this.label7.AutoSize = true;
|
||||
this.label7.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label7.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label7.Location = new System.Drawing.Point(10, 209);
|
||||
this.label7.Name = "label7";
|
||||
this.label7.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label7.Size = new System.Drawing.Size(79, 34);
|
||||
this.label7.TabIndex = 161;
|
||||
this.label7.Text = "Window Style";
|
||||
this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label7.AutoSize = true;
|
||||
label7.BackColor = Color.Transparent;
|
||||
label7.ForeColor = SystemColors.ControlText;
|
||||
label7.Location = new Point(10, 209);
|
||||
label7.Name = "label7";
|
||||
label7.Padding = new Padding(0, 9, 0, 10);
|
||||
label7.Size = new Size(79, 34);
|
||||
label7.TabIndex = 161;
|
||||
label7.Text = "Window Style";
|
||||
label7.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label4
|
||||
//
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label4.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label4.Location = new System.Drawing.Point(10, 144);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label4.Size = new System.Drawing.Size(103, 34);
|
||||
this.label4.TabIndex = 159;
|
||||
this.label4.Text = "Working Directory";
|
||||
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label4.AutoSize = true;
|
||||
label4.BackColor = Color.Transparent;
|
||||
label4.ForeColor = SystemColors.ControlText;
|
||||
label4.Location = new Point(10, 144);
|
||||
label4.Name = "label4";
|
||||
label4.Padding = new Padding(0, 9, 0, 10);
|
||||
label4.Size = new Size(103, 34);
|
||||
label4.TabIndex = 159;
|
||||
label4.Text = "Working Directory";
|
||||
label4.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.label3.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
this.label3.Location = new System.Drawing.Point(10, 103);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Padding = new System.Windows.Forms.Padding(0, 9, 0, 10);
|
||||
this.label3.Size = new System.Drawing.Size(61, 34);
|
||||
this.label3.TabIndex = 157;
|
||||
this.label3.Text = "Argument";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label3.AutoSize = true;
|
||||
label3.BackColor = Color.Transparent;
|
||||
label3.ForeColor = SystemColors.ControlText;
|
||||
label3.Location = new Point(10, 103);
|
||||
label3.Name = "label3";
|
||||
label3.Padding = new Padding(0, 9, 0, 10);
|
||||
label3.Size = new Size(61, 34);
|
||||
label3.TabIndex = 157;
|
||||
label3.Text = "Argument";
|
||||
label3.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// 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(55, 34);
|
||||
this.label2.TabIndex = 155;
|
||||
this.label2.Text = "Filename";
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
label2.AutoSize = true;
|
||||
label2.BackColor = Color.Transparent;
|
||||
label2.ForeColor = SystemColors.ControlText;
|
||||
label2.Location = new Point(10, 62);
|
||||
label2.Name = "label2";
|
||||
label2.Padding = new Padding(0, 9, 0, 10);
|
||||
label2.Size = new Size(55, 34);
|
||||
label2.TabIndex = 155;
|
||||
label2.Text = "Filename";
|
||||
label2.TextAlign = 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;
|
||||
label1.AutoSize = true;
|
||||
label1.BackColor = Color.Transparent;
|
||||
label1.ForeColor = SystemColors.ControlText;
|
||||
label1.Location = new Point(10, 21);
|
||||
label1.Margin = new Padding(0);
|
||||
label1.Name = "label1";
|
||||
label1.Padding = new Padding(0, 9, 0, 10);
|
||||
label1.Size = new Size(29, 34);
|
||||
label1.TabIndex = 153;
|
||||
label1.Text = "Title";
|
||||
label1.TextAlign = ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// textBox2
|
||||
//
|
||||
this.textBox2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.textBox2.FileDialog = null;
|
||||
this.textBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.textBox2.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox2.HighlightImage")));
|
||||
this.textBox2.Location = new System.Drawing.Point(192, 61);
|
||||
this.textBox2.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
|
||||
this.textBox2.Name = "textBox2";
|
||||
this.textBox2.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox2.NormalImage")));
|
||||
this.textBox2.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
||||
this.textBox2.Size = new System.Drawing.Size(177, 35);
|
||||
this.textBox2.AcceptButton = null;
|
||||
this.textBox2.TabIndex = 170;
|
||||
this.textBox2.UseSystemPasswordChar = false;
|
||||
textBox2.AcceptButton = null;
|
||||
textBox2.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox2.BackColor = Color.Transparent;
|
||||
textBox2.DialogMode = ThPathDialogTextBox.DialogType.OpenFile;
|
||||
textBox2.EnableReactiveVisual = true;
|
||||
textBox2.FolderBrowserDialog = null;
|
||||
textBox2.Font = new Font("Segoe UI", 9F);
|
||||
textBox2.HighlightImage = null;
|
||||
textBox2.Location = new Point(126, 61);
|
||||
textBox2.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox2.Name = "textBox2";
|
||||
textBox2.NormalImage = null;
|
||||
textBox2.OpenFileDialog = null;
|
||||
textBox2.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox2.SaveFileDialog = null;
|
||||
textBox2.Size = new Size(243, 32);
|
||||
textBox2.TabIndex = 170;
|
||||
textBox2.TabStop = false;
|
||||
textBox2.UseSystemPasswordChar = false;
|
||||
//
|
||||
// textBox3
|
||||
//
|
||||
this.textBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox3.BackColor = System.Drawing.Color.Transparent;
|
||||
this.textBox3.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.textBox3.Location = new System.Drawing.Point(192, 102);
|
||||
this.textBox3.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
||||
this.textBox3.Name = "textBox3";
|
||||
this.textBox3.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
||||
this.textBox3.Size = new System.Drawing.Size(177, 35);
|
||||
this.textBox3.AcceptButton = null;
|
||||
this.textBox3.TabIndex = 171;
|
||||
this.textBox3.UseSystemPasswordChar = false;
|
||||
textBox3.AcceptButton = null;
|
||||
textBox3.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox3.BackColor = Color.Transparent;
|
||||
textBox3.EnableReactiveVisual = true;
|
||||
textBox3.Font = new Font("Segoe UI", 9F);
|
||||
textBox3.Location = new Point(147, 102);
|
||||
textBox3.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox3.Name = "textBox3";
|
||||
textBox3.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox3.ReadOnly = false;
|
||||
textBox3.Size = new Size(222, 35);
|
||||
textBox3.TabIndex = 171;
|
||||
textBox3.TabStop = false;
|
||||
textBox3.UseSystemPasswordChar = false;
|
||||
//
|
||||
// textBox4
|
||||
//
|
||||
this.textBox4.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.textBox4.BackColor = System.Drawing.Color.Transparent;
|
||||
this.textBox4.FolderDialog = null;
|
||||
this.textBox4.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.textBox4.HighlightImage = ((System.Drawing.Image)(resources.GetObject("textBox4.HighlightImage")));
|
||||
this.textBox4.Location = new System.Drawing.Point(192, 143);
|
||||
this.textBox4.Margin = new System.Windows.Forms.Padding(10, 3, 3, 3);
|
||||
this.textBox4.Name = "textBox4";
|
||||
this.textBox4.NormalImage = ((System.Drawing.Image)(resources.GetObject("textBox4.NormalImage")));
|
||||
this.textBox4.Padding = new System.Windows.Forms.Padding(10, 10, 9, 9);
|
||||
this.textBox4.Size = new System.Drawing.Size(177, 35);
|
||||
this.textBox4.AcceptButton = null;
|
||||
this.textBox4.TabIndex = 172;
|
||||
this.textBox4.UseSystemPasswordChar = false;
|
||||
textBox4.AcceptButton = null;
|
||||
textBox4.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox4.BackColor = Color.Transparent;
|
||||
textBox4.DialogMode = ThPathDialogTextBox.DialogType.FolderBrowser;
|
||||
textBox4.EnableReactiveVisual = true;
|
||||
textBox4.FolderBrowserDialog = null;
|
||||
textBox4.Font = new Font("Segoe UI", 9F);
|
||||
textBox4.HighlightImage = null;
|
||||
textBox4.Location = new Point(147, 143);
|
||||
textBox4.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox4.Name = "textBox4";
|
||||
textBox4.NormalImage = null;
|
||||
textBox4.OpenFileDialog = null;
|
||||
textBox4.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox4.SaveFileDialog = null;
|
||||
textBox4.Size = new Size(222, 32);
|
||||
textBox4.TabIndex = 172;
|
||||
textBox4.TabStop = false;
|
||||
textBox4.UseSystemPasswordChar = false;
|
||||
//
|
||||
// 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;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
button1.AcceptButton = null;
|
||||
button1.ActiveImage = null;
|
||||
button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
||||
button1.BackColor = Color.Transparent;
|
||||
button1.EnableMenuOnClick = false;
|
||||
button1.EnableReactiveVisual = true;
|
||||
button1.HoverImage = null;
|
||||
button1.IdleImage = null;
|
||||
button1.LabelText = "&Save";
|
||||
button1.Location = new 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 Size(128, 32);
|
||||
button1.TabIndex = 173;
|
||||
button1.TabStop = false;
|
||||
//
|
||||
// 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("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox1.Location = new System.Drawing.Point(241, 209);
|
||||
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(128, 34);
|
||||
this.pickerBox1.AcceptButton = null;
|
||||
this.pickerBox1.TabIndex = 174;
|
||||
pickerBox1.AcceptButton = null;
|
||||
pickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
pickerBox1.BackColor = Color.Transparent;
|
||||
pickerBox1.EnableReactiveVisual = true;
|
||||
pickerBox1.Font = new Font("Segoe UI", 9F);
|
||||
pickerBox1.Location = new Point(241, 209);
|
||||
pickerBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
pickerBox1.Name = "pickerBox1";
|
||||
pickerBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
pickerBox1.SelectedIndex = -1;
|
||||
pickerBox1.Size = new Size(128, 34);
|
||||
pickerBox1.TabIndex = 174;
|
||||
pickerBox1.TabStop = false;
|
||||
//
|
||||
// pickerBox2
|
||||
//
|
||||
this.pickerBox2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.pickerBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
this.pickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
|
||||
this.pickerBox2.Location = new System.Drawing.Point(285, 250);
|
||||
this.pickerBox2.Margin = new System.Windows.Forms.Padding(10, 6, 10, 6);
|
||||
this.pickerBox2.Name = "pickerBox2";
|
||||
this.pickerBox2.Padding = new System.Windows.Forms.Padding(10, 6, 7, 5);
|
||||
this.pickerBox2.Size = new System.Drawing.Size(84, 34);
|
||||
this.pickerBox2.AcceptButton = null;
|
||||
this.pickerBox2.TabIndex = 175;
|
||||
pickerBox2.AcceptButton = null;
|
||||
pickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
pickerBox2.BackColor = Color.Transparent;
|
||||
pickerBox2.EnableReactiveVisual = true;
|
||||
pickerBox2.Font = new Font("Segoe UI", 9F);
|
||||
pickerBox2.Location = new Point(285, 250);
|
||||
pickerBox2.Margin = new Padding(10, 10, 10, 0);
|
||||
pickerBox2.Name = "pickerBox2";
|
||||
pickerBox2.Padding = new Padding(4, 4, 3, 3);
|
||||
pickerBox2.SelectedIndex = -1;
|
||||
pickerBox2.Size = new Size(84, 34);
|
||||
pickerBox2.TabIndex = 175;
|
||||
pickerBox2.TabStop = false;
|
||||
//
|
||||
// horizontalSeparator1
|
||||
//
|
||||
this.horizontalSeparator1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.horizontalSeparator1.AutoScrollMargin = new System.Drawing.Size(0, 0);
|
||||
this.horizontalSeparator1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
|
||||
this.horizontalSeparator1.BackColor = System.Drawing.Color.Transparent;
|
||||
this.horizontalSeparator1.Location = new System.Drawing.Point(10, 181);
|
||||
this.horizontalSeparator1.Margin = new System.Windows.Forms.Padding(10, 0, 10, 0);
|
||||
this.horizontalSeparator1.MaximumSize = new System.Drawing.Size(4920, 2);
|
||||
this.horizontalSeparator1.MinimumSize = new System.Drawing.Size(0, 22);
|
||||
this.horizontalSeparator1.Name = "horizontalSeparator1";
|
||||
this.horizontalSeparator1.Padding = new System.Windows.Forms.Padding(0, 10, 0, 10);
|
||||
this.horizontalSeparator1.Size = new System.Drawing.Size(364, 22);
|
||||
this.horizontalSeparator1.TabIndex = 176;
|
||||
horizontalSeparator1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
horizontalSeparator1.AutoScrollMargin = new Size(0, 0);
|
||||
horizontalSeparator1.AutoScrollMinSize = new Size(0, 0);
|
||||
horizontalSeparator1.BackColor = Color.Transparent;
|
||||
horizontalSeparator1.Location = new Point(10, 181);
|
||||
horizontalSeparator1.Margin = new Padding(0, 10, 0, 0);
|
||||
horizontalSeparator1.MaximumSize = new Size(4920, 2);
|
||||
horizontalSeparator1.MinimumSize = new Size(0, 22);
|
||||
horizontalSeparator1.Name = "horizontalSeparator1";
|
||||
horizontalSeparator1.Size = new Size(364, 22);
|
||||
horizontalSeparator1.TabIndex = 176;
|
||||
horizontalSeparator1.TabStop = false;
|
||||
//
|
||||
// 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 = 177;
|
||||
horizontalSeparator2.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
|
||||
horizontalSeparator2.AutoScrollMargin = new Size(0, 0);
|
||||
horizontalSeparator2.AutoScrollMinSize = new Size(0, 0);
|
||||
horizontalSeparator2.BackColor = Color.Transparent;
|
||||
horizontalSeparator2.Location = new Point(10, 437);
|
||||
horizontalSeparator2.Margin = new Padding(0, 10, 0, 0);
|
||||
horizontalSeparator2.MaximumSize = new Size(4920, 2);
|
||||
horizontalSeparator2.MinimumSize = new Size(0, 22);
|
||||
horizontalSeparator2.Name = "horizontalSeparator2";
|
||||
horizontalSeparator2.Size = new Size(364, 22);
|
||||
horizontalSeparator2.TabIndex = 177;
|
||||
horizontalSeparator2.TabStop = false;
|
||||
//
|
||||
// EditTileForm
|
||||
//
|
||||
this.ClientSize = new System.Drawing.Size(384, 521);
|
||||
this.Controls.Add(this.horizontalSeparator2);
|
||||
this.Controls.Add(this.horizontalSeparator1);
|
||||
this.Controls.Add(this.pickerBox2);
|
||||
this.Controls.Add(this.pickerBox1);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.textBox4);
|
||||
this.Controls.Add(this.textBox3);
|
||||
this.Controls.Add(this.textBox2);
|
||||
this.Controls.Add(this.label6);
|
||||
this.Controls.Add(this.label7);
|
||||
this.Controls.Add(this.label4);
|
||||
this.Controls.Add(this.label3);
|
||||
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 = "EditTileForm";
|
||||
this.Text = "Add Tile";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
protected override void OnShown(EventArgs e)
|
||||
{
|
||||
base.OnShown(e);
|
||||
|
||||
if (this.DialogMode == DialogModeType.Edit)
|
||||
{
|
||||
if (this.TilePanel != null)
|
||||
{
|
||||
updateModel(this.TilePanel.ModelInfo);
|
||||
}
|
||||
else if (this.ListBox != null)
|
||||
{
|
||||
if (this.ListBox.ListBox.SelectedItem != null)
|
||||
{
|
||||
TileModel model = (this.ListBox.ListBox.SelectedItem as TileModel);
|
||||
if (model != null)
|
||||
{
|
||||
updateModel(model);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ClientSize = new Size(384, 521);
|
||||
Controls.Add(horizontalSeparator2);
|
||||
Controls.Add(horizontalSeparator1);
|
||||
Controls.Add(pickerBox2);
|
||||
Controls.Add(pickerBox1);
|
||||
Controls.Add(button1);
|
||||
Controls.Add(textBox4);
|
||||
Controls.Add(textBox3);
|
||||
Controls.Add(textBox2);
|
||||
Controls.Add(label6);
|
||||
Controls.Add(label7);
|
||||
Controls.Add(label4);
|
||||
Controls.Add(label3);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBox1);
|
||||
MinimumSize = new Size(400, 560);
|
||||
Name = "EditTileForm";
|
||||
Text = "Add Tile";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
|
||||
public TilePanelLayout TilePanelLayout { get; set; } = null;
|
||||
|
||||
public TilePanel TilePanel { get; set; } = null;
|
||||
|
||||
public TListBox ListBox { get; set; } = null;
|
||||
|
||||
public Point AimCoord { get; set; } = new Point(-1, -1);
|
||||
|
||||
public DialogModeType DialogMode
|
||||
public TileModel Result
|
||||
{
|
||||
get => dialogMode;
|
||||
set
|
||||
get => new TileModel()
|
||||
{
|
||||
dialogMode = value;
|
||||
|
||||
switch (dialogMode)
|
||||
{
|
||||
case DialogModeType.Add:
|
||||
this.Text = "Add Tile";
|
||||
break;
|
||||
case DialogModeType.Edit:
|
||||
this.Text = "Edit Tile";
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
TileModel model = buildModel();
|
||||
|
||||
switch (this.DialogMode)
|
||||
{
|
||||
case DialogModeType.Add:
|
||||
if (this.TilePanelLayout != null)
|
||||
{
|
||||
this.TilePanelLayout.AddTile(model);
|
||||
}
|
||||
else if (this.ListBox != null)
|
||||
{
|
||||
int n = this.ListBox.ListBox.Items.Add(model);
|
||||
this.ListBox.ListBox.SelectedIndex = n;
|
||||
}
|
||||
|
||||
break;
|
||||
case DialogModeType.Edit:
|
||||
if (this.TilePanel != null)
|
||||
{
|
||||
this.TilePanel.LoadInfo(model);
|
||||
}
|
||||
else if (this.ListBox != null)
|
||||
{
|
||||
int n = this.ListBox.ListBox.SelectedIndex;
|
||||
if (n >= 0)
|
||||
{
|
||||
this.ListBox.ListBox.Items.RemoveAt(n);
|
||||
this.ListBox.ListBox.Items.Insert(n, model);
|
||||
this.ListBox.ListBox.SelectedIndex = n;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
protected TileModel buildModel()
|
||||
{
|
||||
TileModel rs = new TileModel()
|
||||
{
|
||||
Title = textBox1.Text?.Trim(),
|
||||
ProcessFilename = textBox2.Text?.Trim(),
|
||||
ProcessArgument = textBox3.Text?.Trim(),
|
||||
Title = textBox1.Text?.Trim() ?? string.Empty,
|
||||
ProcessFilename = textBox2.Text?.Trim() ?? string.Empty,
|
||||
ProcessArgument = textBox3.Text?.Trim() ?? string.Empty,
|
||||
ProcessWorkingDirectory = textBox4.Text?.Trim(),
|
||||
ProcessWindowStyle = (System.Diagnostics.ProcessWindowStyle)pickerBox1.ComboBox.SelectedIndex,
|
||||
ProcessAsAdmin = (pickerBox2.ComboBox.SelectedIndex == 1)
|
||||
};
|
||||
|
||||
if (this.DialogMode == DialogModeType.Add)
|
||||
{
|
||||
if (!this.AimCoord.Equals(new Point(-1, -1)))
|
||||
{
|
||||
rs.Position = this.AimCoord;
|
||||
}
|
||||
}
|
||||
|
||||
return rs;
|
||||
}
|
||||
|
||||
protected void updateModel(TileModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
textBox1.Text = model.Title;
|
||||
textBox2.Text = model.ProcessFilename;
|
||||
textBox3.Text = model.ProcessArgument;
|
||||
textBox4.Text = model.ProcessWorkingDirectory;
|
||||
pickerBox1.ComboBox.SelectedIndex = (int)model.ProcessWindowStyle;
|
||||
pickerBox2.ComboBox.SelectedIndex = (model.ProcessAsAdmin ? 1 : 0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,64 @@
|
||||
<root>
|
||||
<?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">
|
||||
@@ -57,41 +117,4 @@
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="textBox2.HighlightImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vgAADr4B6kKxwAAAAK9JREFUOE/t0zsKwkAURuGp1BWJK3EhIrgAV+EOLLWwtRQLwQdiIbbiIkwynj+O
|
||||
IVwnyhR2XvjyInNIkXHee8f0cEQBPbDOaKEarSvXhsAJO4wirlB4jipiA3phoIvIrLFChhnKiA3o8Ckw
|
||||
RR93LNBODVwwwRL62kNKYIxNzQ1FSsDOEHk08HrYJMw/8KtA06/cCef6KJDZgDbTFrHNZO3x9idqOyui
|
||||
m2+07bvPgHcPXOhtG3D6cUIAAAAASUVORK5CYII=
|
||||
</value>
|
||||
</data>
|
||||
<data name="textBox2.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
vgAADr4B6kKxwAAAAMZJREFUOE/tk7sNwjAQQF3BRohJGAQhMQBTsAElFLSUiAKJTxIXhBZlCILNuyRG
|
||||
iXEQKeg46fmsO/slhU9Za5XWehiXYcD6JElygZ6qhdwTioVDGo4wDXDjsohXdYkvMDTHVa8R9Hb0tpCz
|
||||
XzqJL5Df/CRYRFE0Yn8nr9M07XcSwBXmXN6QDfncRTCjt6+Rgfla4Adfn3D+ERS4Yht/wY8FxVN2xTac
|
||||
gLP5qyYLAhmmA4SGyeeEoPkSq3EWydsoB4gRDEqBVU/p15ajstHKCgAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="textBox4.HighlightImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wAAADsABataJCQAAAJtJREFUOE/t0zEKwkAQheEpvILHSLySlTeJ6AnEzpPYi0ERPIKWKtZKNv9LNS5x
|
||||
E6xS+OCDJew8tsgYmeCECsGZo1dKXLBwtnghQ2fe0JDPGHecsW6xwgwjNM8tdIgyxQ0qij2gORV9LejK
|
||||
Bk8dfi3QjGY/C0IISS7/gkEVtP3KfbKEZm0PLZM++IVK0d0rdrAcR8TrnKK7BzPLa7Wb+WX/Nb8PAAAA
|
||||
AElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<data name="textBox4.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
|
||||
wAAADsABataJCQAAALZJREFUOE/tkzEKwjAYRjt4BY9hvZKTN1HsCYqbJzGzKBGb9gY6qjgrxvdJK7ZS
|
||||
Gpwc/ODBnzTvg0AT5Xk+hB3cwVc456ZRSIqi2MAeafbGEq5Zlg3KY+1Bvkkql89Ya/vsnUCZN8FJYWyM
|
||||
6ekKnsWkdF9hb8S3I6ioyRnkpa0FXcFbwOXrAjlyawXe+06q/At+qoDh41cOCU4iV8OaQY8pUVEgOnuA
|
||||
VcSzjRm2UHvOHeisdc7FDwDnJKIbLgP9AAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,10 +1,10 @@
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using System;
|
||||
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
|
||||
{
|
||||
|
||||
Generated
-7
@@ -61,16 +61,9 @@
|
||||
// TilePanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(234)))), ((int)(((byte)(234)))), ((int)(((byte)(234)))));
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 0, 0);
|
||||
this.MaximumSize = new System.Drawing.Size(82, 81);
|
||||
this.MinimumSize = new System.Drawing.Size(82, 81);
|
||||
this.Name = "TilePanel";
|
||||
this.Size = new System.Drawing.Size(82, 81);
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
+91
-326
@@ -4,130 +4,43 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Linq;
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
|
||||
namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
public partial class TilePanel : RyzStudio.Windows.Forms.TC1UserControl
|
||||
public partial class TilePanel : RyzStudio.Windows.TileForms.Tile
|
||||
{
|
||||
protected bool isDragging = false;
|
||||
protected Point startPosition = new Point();
|
||||
|
||||
protected int imageLeft = 0;
|
||||
protected int imageTop = 11;
|
||||
protected int labelMargin = 3;
|
||||
protected int labelTop = 47;
|
||||
protected Rectangle labelRectangle = new Rectangle();
|
||||
|
||||
protected string title = "";
|
||||
protected Image icon = null;
|
||||
protected ContextMenuStrip groupContextMenu = null;
|
||||
protected TileModel modelInfo = new TileModel();
|
||||
|
||||
|
||||
public TilePanel() : base()
|
||||
public TilePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.AllowDrop = true;
|
||||
this.AutoSize = false;
|
||||
this.BackColor = Color.FromArgb(250, 250, 250);
|
||||
this.ContextMenuStrip = contextMenuStrip1;
|
||||
this.DoubleBuffered = true;
|
||||
this.Font = new Font(this.Font.FontFamily, 8.25F);
|
||||
this.ForeColor = Color.FromArgb(99, 105, 119);
|
||||
this.Size = new Size(70, 70);
|
||||
this.MaximumSize = this.MinimumSize = this.Size;
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
this.AllowDrop = true;
|
||||
this.AutoSize = false;
|
||||
this.BackColor = Color.FromArgb(250, 250, 250);
|
||||
this.ContextMenuStrip = contextMenuStrip1;
|
||||
this.DoubleBuffered = true;
|
||||
this.Font = new Font(this.Font.FontFamily, 8.25F);
|
||||
this.Size = new Size(70, 70);
|
||||
this.MaximumSize = this.MinimumSize = this.Size;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs e)
|
||||
{
|
||||
base.OnPaint(e);
|
||||
|
||||
Graphics g = e.Graphics;
|
||||
|
||||
|
||||
if (this.Image != null)
|
||||
{
|
||||
g.DrawImage(this.Image, new Point(imageLeft, imageTop));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(this.Title))
|
||||
{
|
||||
TextRenderer.DrawText(e.Graphics, this.Title, this.Font, labelRectangle, this.ForeColor, TextFormatFlags.HorizontalCenter | TextFormatFlags.NoPadding | TextFormatFlags.EndEllipsis);
|
||||
}
|
||||
|
||||
g.DrawRectangle(new Pen(Color.FromArgb(204, 206, 218), 1), new Rectangle(this.DisplayRectangle.X, this.DisplayRectangle.Y, (this.DisplayRectangle.Width - 1), (this.DisplayRectangle.Height - 1)));
|
||||
|
||||
}
|
||||
|
||||
[Category("Tile"), Browsable(true)]
|
||||
public Image Image
|
||||
{
|
||||
get => icon;
|
||||
protected set
|
||||
{
|
||||
icon = value;
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
imageLeft = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
imageLeft = (this.Width - icon.Width) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Category("Tile"), Browsable(true)]
|
||||
public string Title
|
||||
{
|
||||
get => title;
|
||||
protected set
|
||||
{
|
||||
title = value;
|
||||
|
||||
labelRectangle = new Rectangle(labelMargin, labelTop, (this.Width - (labelMargin * 2)), (this.Height - labelTop - 1));
|
||||
|
||||
this.Invalidate();
|
||||
}
|
||||
this.EnableMovable = true;
|
||||
}
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
public TileModel ModelInfo => modelInfo;
|
||||
|
||||
public TilePanelLayout PanelContainer
|
||||
public RyzStudio.Windows.TileForms.TileContainer TileContainer { get => UIControl.GetParentsUntil<RyzStudio.Windows.TileForms.TileContainer>(this); }
|
||||
|
||||
protected MainForm MainForm { get => UIControl.GetParentsUntil<MainForm>(this); }
|
||||
|
||||
|
||||
protected override void OnDragOver(DragEventArgs e)
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.Parent == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
base.OnDragDrop(e);
|
||||
|
||||
if (this.Parent.GetType() != typeof(TilePanelLayout))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return (TilePanelLayout)this.Parent;
|
||||
}
|
||||
e.Effect = (e.Data.GetDataPresent(DataFormats.FileDrop)) ? DragDropEffects.Link : DragDropEffects.None;
|
||||
}
|
||||
|
||||
protected override void OnDragDrop(DragEventArgs e)
|
||||
@@ -138,67 +51,34 @@ namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
this.DropFileList(fileList);
|
||||
|
||||
invalidateGroupMenu(this.ModelInfo);
|
||||
InvalidateGroupMenu(this.ModelInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.PanelContainer != null)
|
||||
{
|
||||
this.PanelContainer.DropFileList(fileList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
TilePanelLayout container = this.PanelContainer;
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.BringToFront();
|
||||
|
||||
if (((e.Button == MouseButtons.Left) && (Control.ModifierKeys == Keys.Control)) || (e.Button == MouseButtons.Right))
|
||||
{
|
||||
isDragging = true;
|
||||
startPosition = e.Location;
|
||||
//if (this.PanelContainer != null)
|
||||
//{
|
||||
// this.PanelContainer.LoadShortcuts(fileList);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseClick(MouseEventArgs e)
|
||||
{
|
||||
base.OnMouseClick(e);
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Control.ModifierKeys == Keys.Control) return;
|
||||
if (this.ModelInfo == null) return;
|
||||
if (this.ModelInfo == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
if (groupContextMenu != null)
|
||||
{
|
||||
invalidateGroupMenuSize();
|
||||
|
||||
groupContextMenu.Show(this, e.Location);
|
||||
}
|
||||
this.LeftContextMenuStrip?.Show(this, e.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -211,33 +91,57 @@ namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
base.OnMouseDoubleClick(e);
|
||||
|
||||
if (Control.ModifierKeys == Keys.Control) return;
|
||||
if (Control.ModifierKeys == Keys.Control)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
execute(this.ModelInfo);
|
||||
Execute(this.ModelInfo);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(MouseEventArgs e)
|
||||
|
||||
#region Context Menu
|
||||
|
||||
/// <summary>
|
||||
/// Edit
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void editToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
base.OnMouseMove(e);
|
||||
|
||||
if (isDragging)
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
TilePanelLayout layoutPanel = this.PanelContainer;
|
||||
if (layoutPanel == null)
|
||||
var form = new EditTileFolderForm(this.ModelInfo);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int x = (this.Location.X + (e.Location.X - startPosition.X));
|
||||
int y = (this.Location.Y + (e.Location.Y - startPosition.Y));
|
||||
|
||||
layoutPanel.MoveTile(this, x, y);
|
||||
this.LoadInfo(form.Result);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
var form = new EditTileForm(this.ModelInfo);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
this.LoadInfo(form.Result);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.TileContainer?.Controls?.Remove(this);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
public void DropFileList(string[] fileList)
|
||||
{
|
||||
@@ -294,46 +198,24 @@ namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
this.modelInfo = model;
|
||||
|
||||
this.Image = null;
|
||||
this.LargeIcon = null;
|
||||
this.Title = model.Title;
|
||||
|
||||
if (this.modelInfo.IsGroup)
|
||||
{
|
||||
this.Image = AppResource.folder_32;
|
||||
this.LargeIcon = AppResource.folder_32;
|
||||
|
||||
invalidateGroupMenu(this.modelInfo);
|
||||
InvalidateGroupMenu(this.modelInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Image = getIcon(model);
|
||||
this.LargeIcon = RyzStudio.IO.File.GetIcon(model.CleanProcessFilename);
|
||||
}
|
||||
|
||||
toolTip1.SetToolTip(this, this.Title);
|
||||
}
|
||||
|
||||
private void editToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
EditTileFolderForm.ShowEditDialog(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditTileForm.ShowEditDialog(this);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (this.PanelContainer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.PanelContainer.Remove(this);
|
||||
}
|
||||
|
||||
protected void execute(TileModel model)
|
||||
protected void Execute(TileModel model)
|
||||
{
|
||||
if (model == null)
|
||||
{
|
||||
@@ -345,159 +227,42 @@ namespace FizzyLauncher.Windows.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.CleanProcessFilename))
|
||||
if (this.MainForm != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!File.Exists(model.CleanProcessFilename))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessStartInfo p = new ProcessStartInfo();
|
||||
p.FileName = model.CleanProcessFilename;
|
||||
p.WindowStyle = model.ProcessWindowStyle;
|
||||
p.UseShellExecute = true;
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.CleanProcessArgument))
|
||||
{
|
||||
p.Arguments = model.CleanProcessArgument;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(model.CleanProcessWorkingDirectory))
|
||||
{
|
||||
p.WorkingDirectory = model.CleanProcessWorkingDirectory;
|
||||
}
|
||||
|
||||
if (model.ProcessAsAdmin)
|
||||
{
|
||||
p.Verb = "runas";
|
||||
}
|
||||
|
||||
MainForm parentForm = findMainForm();
|
||||
if (parentForm != null)
|
||||
{
|
||||
if (parentForm.CurrentSession != null)
|
||||
if (this.MainForm.CurrentSession?.HideOnExecute ?? true)
|
||||
{
|
||||
if (parentForm.CurrentSession.HideOnClick)
|
||||
{
|
||||
parentForm.Visible = false;
|
||||
}
|
||||
this.MainForm.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
Process.Start(p);
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
MessageBox.Show(exc.Message);
|
||||
}
|
||||
RyzStudio.Diagnostics.Process.Execute(model.CleanProcessFilename, model.CleanProcessWorkingDirectory, model.CleanProcessArgument, model.ProcessWindowStyle, model.ProcessAsAdmin);
|
||||
}
|
||||
|
||||
protected Image getIcon(TileModel model)
|
||||
protected void InvalidateGroupMenu(TileModel model)
|
||||
{
|
||||
if (!File.Exists(model.CleanProcessFilename))
|
||||
//var iconSize = ((this.PanelContainer?.MainForm?.CurrentSession?.EnableBigIconInFolder ?? true) ? 24 : 16);
|
||||
var iconSize = 24;
|
||||
|
||||
if (this.LeftContextMenuStrip == null)
|
||||
{
|
||||
return null;
|
||||
this.LeftContextMenuStrip = new ContextMenuStrip();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
return Icon.ExtractAssociatedIcon(model.CleanProcessFilename)?.ToBitmap();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
this.LeftContextMenuStrip.ImageScalingSize = new Size(iconSize, iconSize);
|
||||
this.LeftContextMenuStrip.Items.Clear();
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void invalidateGroupMenu(TileModel model)
|
||||
{
|
||||
if (groupContextMenu == null)
|
||||
foreach (TileModel item in model?.Items ?? new System.Collections.Generic.List<TileModel>())
|
||||
{
|
||||
groupContextMenu = new ContextMenuStrip();
|
||||
}
|
||||
|
||||
groupContextMenu.Items.Clear();
|
||||
|
||||
if (model.Items == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (TileModel item in model.Items)
|
||||
{
|
||||
ToolStripItem toolItem = groupContextMenu.Items.Add(item.Title);
|
||||
toolItem.Image = getIcon(item);
|
||||
ToolStripItem toolItem = this.LeftContextMenuStrip.Items.Add(item.Title);
|
||||
toolItem.Image = RyzStudio.IO.File.GetIcon(item.CleanProcessFilename);
|
||||
toolItem.Tag = item;
|
||||
toolItem.Click += toolItem_Click;
|
||||
}
|
||||
}
|
||||
|
||||
protected void invalidateGroupMenuSize()
|
||||
{
|
||||
if (this.PanelContainer != null)
|
||||
{
|
||||
if (this.PanelContainer.MainForm != null)
|
||||
toolItem.Click += (object sender, EventArgs e) =>
|
||||
{
|
||||
if (this.PanelContainer.MainForm.CurrentSession != null)
|
||||
{
|
||||
if (this.PanelContainer.MainForm.CurrentSession.EnableBigIconInFolder)
|
||||
{
|
||||
groupContextMenu.ImageScalingSize = new Size(24, 24);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
var result = UIControl.GetTag<TileModel>((Control)sender);
|
||||
|
||||
Execute(result);
|
||||
};
|
||||
}
|
||||
|
||||
groupContextMenu.ImageScalingSize = new Size(16, 16);
|
||||
}
|
||||
|
||||
protected MainForm findMainForm()
|
||||
{
|
||||
Control item = this;
|
||||
|
||||
while (true)
|
||||
{
|
||||
item = item.Parent;
|
||||
if (item == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (item.GetType() == typeof(MainForm))
|
||||
{
|
||||
return (item as MainForm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void toolItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (sender.GetType() != typeof(ToolStripMenuItem))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ToolStripMenuItem item = (sender as ToolStripMenuItem);
|
||||
if (item.Tag == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (item.Tag.GetType() != typeof(TileModel))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
TileModel model = (item.Tag as TileModel);
|
||||
execute(model);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
-18
@@ -45,7 +45,6 @@
|
||||
this.bottomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.toolStripMenuItem7 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -174,21 +173,6 @@
|
||||
this.toolStripMenuItem3.Text = "&Remove";
|
||||
this.toolStripMenuItem3.Click += new System.EventHandler(this.removeGroupMenuItem3_Click);
|
||||
//
|
||||
// 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(265, 83);
|
||||
this.label1.Margin = 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);
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
@@ -222,7 +206,6 @@
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.Transparent;
|
||||
this.Controls.Add(this.label1);
|
||||
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||
this.Name = "TilePanelLayout";
|
||||
this.Size = new System.Drawing.Size(432, 173);
|
||||
@@ -248,7 +231,6 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripMenuItem6;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
|
||||
@@ -4,125 +4,35 @@ using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using FizzyLauncher.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
|
||||
namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
public partial class TilePanelLayout : RyzStudio.Windows.Forms.TC1UserControl
|
||||
public partial class TilePanelLayout : TileGridPanelLayout<TilePanel>
|
||||
{
|
||||
public static int CalcWidth(int tileCount) => (tileCount * tileSize) + ((tileCount - 1) * margin);
|
||||
|
||||
|
||||
public class Item
|
||||
{
|
||||
public TilePanel 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 TileGroupModel groupModel = null;
|
||||
protected List<Item> items = new List<Item>();
|
||||
|
||||
protected int collapseHeight = 0;
|
||||
protected int expandedHeight = 0;
|
||||
|
||||
protected bool isAnimating = false;
|
||||
protected bool isChecked = true;
|
||||
protected Point lastMousePosition = new Point();
|
||||
protected Point gridSize = new Point();
|
||||
|
||||
|
||||
public TilePanelLayout(TileGroupModel model) : base()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.AllowDrop = true;
|
||||
this.BackColor = Color.Transparent;
|
||||
this.TitleContextMenuStrip = contextMenuStrip2;
|
||||
this.ContainerContextMenuStrip = contextMenuStrip1;
|
||||
|
||||
this.LoadModel(model);
|
||||
|
||||
label1.Location = new Point(0, 4);
|
||||
label1.Margin = new Padding(0);
|
||||
label1.Padding = new Padding(0);
|
||||
}
|
||||
|
||||
protected override void OnDragDrop(DragEventArgs e)
|
||||
{
|
||||
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
|
||||
this.DropFileList(fileList);
|
||||
this.LoadShortcuts(fileList);
|
||||
}
|
||||
|
||||
protected override void OnDragOver(DragEventArgs e)
|
||||
{
|
||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||
{
|
||||
e.Effect = DragDropEffects.Link;
|
||||
}
|
||||
else
|
||||
{
|
||||
e.Effect = DragDropEffects.None;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnLoad(EventArgs e)
|
||||
{
|
||||
base.OnLoad(e);
|
||||
|
||||
this.Margin = new Padding(0);
|
||||
this.Padding = new Padding(0, 0, 0, 10);
|
||||
}
|
||||
|
||||
protected override async void OnResize(EventArgs e)
|
||||
{
|
||||
base.OnResize(e);
|
||||
|
||||
await this.InvalidateContainer();
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
contextMenuStrip2.Show(this, e.Location);
|
||||
}
|
||||
else
|
||||
{
|
||||
contextMenuStrip1.Show(this, e.Location);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDoubleClick(MouseEventArgs e) => base.OnMouseClick(e);
|
||||
|
||||
public Point GridSize
|
||||
{
|
||||
get => gridSize;
|
||||
}
|
||||
|
||||
public bool EnableAnimation
|
||||
public new bool EnableAnimation
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -137,15 +47,14 @@ namespace FizzyLauncher.Windows.Forms
|
||||
return false;
|
||||
}
|
||||
|
||||
return mainForm.CurrentSession.EnableAnimation;
|
||||
base.EnableAnimation = mainForm.CurrentSession.EnableAnimation;
|
||||
|
||||
return base.EnableAnimation;
|
||||
}
|
||||
set => base.EnableAnimation = value;
|
||||
}
|
||||
|
||||
public int CollapseHeight => labelHeight + collapseHeight;
|
||||
|
||||
public int ExpandedHeight => expandedHeight + this.Padding.Bottom;
|
||||
|
||||
public void DropFileList(string[] fileList)
|
||||
public void LoadShortcuts(string[] fileList)
|
||||
{
|
||||
if (fileList == null)
|
||||
{
|
||||
@@ -204,7 +113,7 @@ namespace FizzyLauncher.Windows.Forms
|
||||
{
|
||||
Title = groupModel.Title,
|
||||
GridSize = new Size(this.GridSize.X, this.GridSize.Y),
|
||||
IsExpanded = isChecked,
|
||||
IsExpanded = this.IsExpanded,
|
||||
IsExclusive = groupModel.IsExclusive,
|
||||
Items = this.Tiles
|
||||
};
|
||||
@@ -213,82 +122,39 @@ namespace FizzyLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public FlowLayoutPanel FlowLayoutPanel
|
||||
{
|
||||
get
|
||||
{
|
||||
Control parentControl = this.Parent;
|
||||
while (true)
|
||||
{
|
||||
if (parentControl == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parentControl.GetType() == typeof(FlowLayoutPanel))
|
||||
{
|
||||
return parentControl as FlowLayoutPanel;
|
||||
}
|
||||
|
||||
parentControl = parentControl.Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public MainForm MainForm
|
||||
{
|
||||
get
|
||||
{
|
||||
Control parentControl = this.FlowLayoutPanel;
|
||||
while (true)
|
||||
{
|
||||
if (parentControl == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (parentControl.GetType() == typeof(MainForm))
|
||||
{
|
||||
return parentControl as MainForm;
|
||||
}
|
||||
|
||||
parentControl = parentControl.Parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
public MainForm MainForm { get => UIControl.GetParentsUntil<MainForm>(this.Parent); }
|
||||
|
||||
public List<TileModel> Tiles
|
||||
{
|
||||
get
|
||||
{
|
||||
List<TileModel> rs = new List<TileModel>();
|
||||
foreach (Item item in items)
|
||||
List<TileModel> result = new List<TileModel>();
|
||||
foreach (GridTileItem item in this.GridTileItems.Where(x => x.Tile.GetType() == typeof(TilePanel)))
|
||||
{
|
||||
TileModel model = item.Tile.ModelInfo;
|
||||
TileModel model = (item.Tile as TilePanel).ModelInfo;
|
||||
model.Position = item.Coord;
|
||||
|
||||
rs.Add(model);
|
||||
result.Add(model);
|
||||
}
|
||||
|
||||
return rs;
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public int TileSize => (tileSize + margin);
|
||||
|
||||
public void AddTile(TileModel tile)
|
||||
{
|
||||
Point gridSize = this.GridSize;
|
||||
|
||||
if (items.Count >= (gridSize.X * gridSize.Y))
|
||||
if (GridTileItems.Count >= (gridSize.X * gridSize.Y))
|
||||
{
|
||||
this.SetGridSize(gridSize.X, (gridSize.Y + 1));
|
||||
}
|
||||
|
||||
Point? newCoord = tile.Position;
|
||||
if ((newCoord == null) || hasTile(tile.Position))
|
||||
if ((newCoord == null) || HasTile(tile.Position))
|
||||
{
|
||||
newCoord = findLastFreeCoord();
|
||||
newCoord = FindLastFreeCoord();
|
||||
}
|
||||
|
||||
if (newCoord == null)
|
||||
@@ -300,9 +166,9 @@ namespace FizzyLauncher.Windows.Forms
|
||||
|
||||
TilePanel panel = new TilePanel();
|
||||
panel.LoadInfo(tile);
|
||||
panel.Location = convertCoordToLocation(tile.Position);
|
||||
panel.Location = ConvertCoordToLocation(tile.Position);
|
||||
|
||||
items.Add(new Item()
|
||||
GridTileItems.Add(new GridTileItem()
|
||||
{
|
||||
Tile = panel,
|
||||
Coord = tile.Position
|
||||
@@ -311,92 +177,6 @@ namespace FizzyLauncher.Windows.Forms
|
||||
this.Controls.Add(panel);
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
this.Controls.Clear();
|
||||
}
|
||||
|
||||
public async Task Collapse()
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
if (isAnimating) return;
|
||||
|
||||
isAnimating = true;
|
||||
isChecked = 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;
|
||||
isChecked = 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 Point GetTilePosition(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));
|
||||
}
|
||||
|
||||
public async Task InvalidateContainer()
|
||||
{
|
||||
if (isAnimating)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (isChecked)
|
||||
{
|
||||
await this.Expand();
|
||||
}
|
||||
else
|
||||
{
|
||||
await this.Collapse();
|
||||
}
|
||||
}
|
||||
|
||||
public void AddGroup()
|
||||
{
|
||||
if (this.FlowLayoutPanel == null)
|
||||
@@ -411,34 +191,37 @@ namespace FizzyLauncher.Windows.Forms
|
||||
}));
|
||||
}
|
||||
|
||||
public void AddRow() => this.SetGridSize(gridSize.X, (gridSize.Y + 1));
|
||||
public void AddRow() => this.SetGridSize(this.GridSize.X, (this.GridSize.Y + 1));
|
||||
|
||||
public void EditGroup() => EditGroupForm.ShowDialog(this);
|
||||
public void EditGroup()
|
||||
{
|
||||
//EditGroupForm.ShowDialog(this);
|
||||
}
|
||||
|
||||
public void LoadModel(TileGroupModel model)
|
||||
public async void LoadModel(TileGroupModel model)
|
||||
{
|
||||
groupModel = model;
|
||||
|
||||
isChecked = groupModel.IsExpanded;
|
||||
this.Title = groupModel?.Title ?? string.Empty;
|
||||
this.IsExpanded = groupModel.IsExpanded;
|
||||
|
||||
label1.Text = " " + groupModel?.Title;
|
||||
label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
|
||||
//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);
|
||||
|
||||
this.Invalidate();
|
||||
await this.Invalidate();
|
||||
}
|
||||
|
||||
public void UpdateModel(TileGroupModel model)
|
||||
public async void UpdateModel(TileGroupModel model)
|
||||
{
|
||||
groupModel = model;
|
||||
isChecked = groupModel.IsExpanded;
|
||||
|
||||
label1.Text = " " + groupModel?.Title;
|
||||
this.Title = groupModel?.Title ?? string.Empty;
|
||||
this.IsExpanded = groupModel.IsExpanded;
|
||||
|
||||
this.Invalidate();
|
||||
await this.Invalidate();
|
||||
}
|
||||
|
||||
public void LoadTiles(List<TileModel> tiles)
|
||||
@@ -456,7 +239,7 @@ namespace FizzyLauncher.Windows.Forms
|
||||
foreach (TileModel item in tiles)
|
||||
{
|
||||
// resolve final grid position
|
||||
Point? confirmedPosition = resolveCoord(item.Position);
|
||||
Point? confirmedPosition = ResolveCoord(item.Position);
|
||||
if (confirmedPosition == null)
|
||||
{
|
||||
continue;
|
||||
@@ -465,9 +248,9 @@ namespace FizzyLauncher.Windows.Forms
|
||||
// place control
|
||||
TilePanel panel = new TilePanel();
|
||||
panel.LoadInfo(item);
|
||||
panel.Location = convertCoordToLocation(confirmedPosition.Value);
|
||||
panel.Location = ConvertCoordToLocation(confirmedPosition.Value);
|
||||
|
||||
items.Add(new Item()
|
||||
GridTileItems.Add(new GridTileItem()
|
||||
{
|
||||
Tile = panel,
|
||||
Coord = confirmedPosition.Value
|
||||
@@ -477,308 +260,26 @@ namespace FizzyLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
public void MoveTile(TilePanel panel, int posX, int posY)
|
||||
private void SetGridSize(int width, int height)
|
||||
{
|
||||
Item item = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault();
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Point newPosition = convertLocationToCoord_Nearest(posX, posY);
|
||||
if (!isTileInBounds(newPosition))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasTile(newPosition))
|
||||
{
|
||||
Item swapItem = items.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 MoveTop()
|
||||
{
|
||||
if (this.FlowLayoutPanel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.FlowLayoutPanel.Controls.SetChildIndex(this, 0);
|
||||
}
|
||||
|
||||
public void MoveUp()
|
||||
{
|
||||
if (this.FlowLayoutPanel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.FlowLayoutPanel.Controls.SetChildIndex(this, (this.FlowLayoutPanel.Controls.Count - 1));
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
if (this.FlowLayoutPanel == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.FlowLayoutPanel.Controls.Remove(this);
|
||||
}
|
||||
|
||||
public void Remove(TilePanel panel)
|
||||
{
|
||||
Item m = items.Where(x => x.Tile.Equals(panel)).FirstOrDefault();
|
||||
if (m != null)
|
||||
{
|
||||
items.Remove(m);
|
||||
}
|
||||
|
||||
this.Controls.Remove(panel);
|
||||
}
|
||||
|
||||
public void SetGridSize(int width, int height)
|
||||
{
|
||||
gridSize = new Point(width, height);
|
||||
this.GridSize = new Point(width, height);
|
||||
|
||||
groupModel.GridSize = new Size(groupModel.GridSize.Width, height);
|
||||
|
||||
expandedHeight = (this.TileSize * height) + labelHeight;
|
||||
|
||||
int w = CalcWidth(gridSize.X);
|
||||
|
||||
this.Size = new Size(w, (isChecked ? this.ExpandedHeight : this.CollapseHeight));
|
||||
}
|
||||
|
||||
protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));
|
||||
|
||||
protected Point convertLocationToCoord(int posX, int posY)
|
||||
protected override async void label1_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
int x = (int)Math.Ceiling(decimal.Divide(posX, this.TileSize));
|
||||
int y = (int)Math.Ceiling(decimal.Divide((posY - labelHeight), this.TileSize));
|
||||
base.label1_MouseClick(sender, e);
|
||||
|
||||
x--;
|
||||
y--;
|
||||
|
||||
if (x < 0) x = 0;
|
||||
if (y < 0) y = 0;
|
||||
|
||||
return new Point(x, y);
|
||||
}
|
||||
|
||||
protected Point convertLocationToCoord_Nearest(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 Point? findFirstFreeCoord()
|
||||
{
|
||||
Point gridSize = this.GridSize;
|
||||
|
||||
for (int y = 0; y < gridSize.Y; y++)
|
||||
if (isAnimating)
|
||||
{
|
||||
for (int x = 0; x < gridSize.X; x++)
|
||||
{
|
||||
if (hasTile(new Point(x, y)))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return new Point(x, y);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Point? findLastFreeCoord()
|
||||
{
|
||||
Point gridSize = this.GridSize;
|
||||
|
||||
// none available
|
||||
if (items.Count >= (gridSize.X * gridSize.Y))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (items.Count <= 0)
|
||||
{
|
||||
return findFirstFreeCoord();
|
||||
}
|
||||
|
||||
// only one available
|
||||
if (items.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 bool hasTile(Point position)
|
||||
{
|
||||
if (items == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (items.Count <= 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return (items.Count(x => x.Coord.Equals(position)) > 0);
|
||||
}
|
||||
|
||||
protected bool isTileInBounds(Point position)
|
||||
{
|
||||
Point gridSize = this.GridSize;
|
||||
|
||||
if (position.X >= gridSize.X)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (position.Y >= gridSize.Y)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
protected Point? resolveCoord(Point coord)
|
||||
{
|
||||
if (!isTileInBounds(coord))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!hasTile(coord))
|
||||
{
|
||||
return coord;
|
||||
}
|
||||
|
||||
return resolveNextCoord(coord);
|
||||
}
|
||||
|
||||
protected Point? resolveNextCoord(Point coord)
|
||||
{
|
||||
Point gridSize = this.GridSize;
|
||||
Point newCoord = coord;
|
||||
|
||||
while (true)
|
||||
{
|
||||
newCoord.X++;
|
||||
|
||||
if (newCoord.X >= gridSize.X)
|
||||
{
|
||||
newCoord.Y++;
|
||||
newCoord.X = 0;
|
||||
}
|
||||
|
||||
if (!isTileInBounds(newCoord))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (hasTile(newCoord))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
return newCoord;
|
||||
}
|
||||
}
|
||||
|
||||
private async void label1_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (isAnimating) return;
|
||||
|
||||
if (e.Button == MouseButtons.Left)
|
||||
{
|
||||
isChecked = !isChecked;
|
||||
|
||||
label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
|
||||
|
||||
this.Invalidate();
|
||||
|
||||
await this.InvalidateContainer();
|
||||
|
||||
// exclusivity
|
||||
if (isChecked)
|
||||
if (this.IsExpanded)
|
||||
{
|
||||
if (this.Model.IsExclusive)
|
||||
{
|
||||
@@ -796,12 +297,6 @@ namespace FizzyLauncher.Windows.Forms
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
label1.Image = (isChecked ? AppResource.toggle_right_ea_16 : AppResource.toggle_left_ea_16);
|
||||
}
|
||||
else if (e.Button == MouseButtons.Right)
|
||||
{
|
||||
contextMenuStrip2.Show(this, e.Location);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -814,9 +309,9 @@ namespace FizzyLauncher.Windows.Forms
|
||||
/// <param name="e"></param>
|
||||
private void addTileMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
|
||||
Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
|
||||
|
||||
EditTileForm.ShowAddDialog(this, coord);
|
||||
//EditTileForm.ShowAddDialog(this, coord);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -826,9 +321,9 @@ namespace FizzyLauncher.Windows.Forms
|
||||
/// <param name="e"></param>
|
||||
private void addListTileMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
Point coord = convertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
|
||||
Point coord = ConvertLocationToCoord(lastMousePosition.X, lastMousePosition.Y);
|
||||
|
||||
EditTileFolderForm.ShowAddDialog(this, coord);
|
||||
//EditTileFolderForm.ShowAddDialog(this, coord);
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -872,18 +367,18 @@ namespace FizzyLauncher.Windows.Forms
|
||||
/// <param name="e"></param>
|
||||
private void removeRowToolStripMenuItem_Click_1(object sender, EventArgs e)
|
||||
{
|
||||
if (gridSize.Y <= 1)
|
||||
if (this.GridSize.Y <= 1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool rs = items.Exists(x => x.Coord.Y.Equals(gridSize.Y - 1));
|
||||
bool rs = GridTileItems.Exists(x => x.Coord.Y.Equals(this.GridSize.Y - 1));
|
||||
if (rs)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.SetGridSize(gridSize.X, (gridSize.Y - 1));
|
||||
this.SetGridSize(this.GridSize.X, (this.GridSize.Y - 1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -938,5 +433,6 @@ namespace FizzyLauncher.Windows.Forms
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user