release/0.3.6 #2
@ -6,7 +6,7 @@ using RyzStudio.Windows.ThemedForms.PickerBox;
|
||||
|
||||
namespace RokettoLaunch
|
||||
{
|
||||
public class EditGroupForm : Form
|
||||
public class EditSectionForm : Form
|
||||
{
|
||||
private Label label2;
|
||||
private Label label1;
|
||||
@ -18,7 +18,7 @@ namespace RokettoLaunch
|
||||
private TileGroupModel result = null;
|
||||
|
||||
|
||||
public EditGroupForm(TileGroupModel model = null)
|
||||
public EditSectionForm(TileGroupModel model = null)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
@ -62,6 +62,7 @@ namespace RokettoLaunch
|
||||
textBox1.IconSize = 13F;
|
||||
textBox1.Location = new System.Drawing.Point(192, 20);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox1.Size = new System.Drawing.Size(177, 32);
|
||||
textBox1.TabIndex = 152;
|
||||
textBox1.TabStop = false;
|
||||
@ -103,6 +104,7 @@ namespace RokettoLaunch
|
||||
pickerBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F);
|
||||
pickerBox1.Location = new System.Drawing.Point(285, 62);
|
||||
pickerBox1.Name = "pickerBox1";
|
||||
pickerBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
pickerBox1.SelectedIndex = 0;
|
||||
pickerBox1.Size = new System.Drawing.Size(84, 34);
|
||||
pickerBox1.TabIndex = 174;
|
||||
@ -115,11 +117,12 @@ namespace RokettoLaunch
|
||||
dialogFooter1.Button1Text = "&Save";
|
||||
dialogFooter1.Dialog = this;
|
||||
dialogFooter1.Dock = DockStyle.Bottom;
|
||||
dialogFooter1.IsBusy = false;
|
||||
dialogFooter1.Location = new System.Drawing.Point(0, 437);
|
||||
dialogFooter1.Name = "dialogFooter1";
|
||||
dialogFooter1.Size = new System.Drawing.Size(384, 84);
|
||||
//
|
||||
// EditGroupForm
|
||||
// EditSectionForm
|
||||
//
|
||||
BackColor = System.Drawing.Color.White;
|
||||
ClientSize = new System.Drawing.Size(384, 521);
|
||||
@ -129,8 +132,8 @@ namespace RokettoLaunch
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBox1);
|
||||
MinimumSize = new System.Drawing.Size(400, 560);
|
||||
Name = "EditGroupForm";
|
||||
Text = "Edit Group";
|
||||
Name = "EditSectionForm";
|
||||
Text = "Edit Section";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -34,11 +34,8 @@ namespace RokettoLaunch
|
||||
|
||||
result = model;
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
textBox1.Text = result?.Title ?? string.Empty;
|
||||
|
||||
foreach (TileModel item in result.Items ?? new List<TileModel>())
|
||||
textBox1.Text = result?.Title ?? "New Folder";
|
||||
foreach (TileModel item in result?.Items ?? new List<TileModel>())
|
||||
{
|
||||
if (item.IsGroup)
|
||||
{
|
||||
@ -48,7 +45,6 @@ namespace RokettoLaunch
|
||||
listBox1.ListBox.Items.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
@ -70,6 +66,7 @@ namespace RokettoLaunch
|
||||
textBox1.IconSize = 13F;
|
||||
textBox1.Location = new Point(109, 20);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox1.Size = new Size(260, 32);
|
||||
textBox1.TabIndex = 152;
|
||||
textBox1.TabStop = false;
|
||||
@ -98,6 +95,7 @@ namespace RokettoLaunch
|
||||
listBox1.Font = new Font("Microsoft Sans Serif", 8.25F);
|
||||
listBox1.Location = new Point(109, 62);
|
||||
listBox1.Name = "listBox1";
|
||||
listBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
listBox1.Size = new Size(260, 366);
|
||||
listBox1.TabIndex = 180;
|
||||
listBox1.OnAdd += listBox1_OnAdd;
|
||||
@ -131,7 +129,7 @@ namespace RokettoLaunch
|
||||
dialogFooter1.Name = "dialogFooter1";
|
||||
dialogFooter1.Size = new Size(384, 84);
|
||||
//
|
||||
// EditTileFolderForm
|
||||
// EditFolderForm
|
||||
//
|
||||
BackColor = Color.White;
|
||||
ClientSize = new Size(384, 521);
|
||||
@ -141,8 +139,8 @@ namespace RokettoLaunch
|
||||
Controls.Add(label1);
|
||||
Controls.Add(textBox1);
|
||||
MinimumSize = new Size(400, 560);
|
||||
Name = "EditTileFolderForm";
|
||||
Text = "Add List Tile";
|
||||
Name = "EditFolderForm";
|
||||
Text = "Add Tile Folder";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
@ -240,25 +238,27 @@ namespace RokettoLaunch
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(fileList[0]))
|
||||
foreach (var item in fileList)
|
||||
{
|
||||
return;
|
||||
if (string.IsNullOrWhiteSpace(item))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var model = new TileModel()
|
||||
{
|
||||
ProcessFilename = fileList[0],
|
||||
Title = Path.GetFileName(fileList[0])
|
||||
ProcessFilename = item,
|
||||
Title = Path.GetFileName(item)
|
||||
};
|
||||
|
||||
// exe
|
||||
if (Path.GetExtension(fileList[0]).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (Path.GetExtension(item).Equals(".exe", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (File.Exists(fileList[0]))
|
||||
if (File.Exists(item))
|
||||
{
|
||||
try
|
||||
{
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileList[0]);
|
||||
FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(item);
|
||||
if (fvi != null)
|
||||
{
|
||||
model.Title = fvi.ProductName;
|
||||
@ -270,15 +270,12 @@ namespace RokettoLaunch
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (string.IsNullOrWhiteSpace(model.Title))
|
||||
{
|
||||
model.Title = Path.GetFileNameWithoutExtension(fileList[0]);
|
||||
}
|
||||
model.Title = (string.IsNullOrWhiteSpace(model.Title) ? "Untitled" : Path.GetFileNameWithoutExtension(item));
|
||||
}
|
||||
|
||||
listBox1.ListBox.Items.Add(model);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,4 +1,5 @@
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using RokettoLaunch.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
@ -46,15 +47,12 @@ namespace RokettoLaunch
|
||||
pickerBox1.ComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
if (result != null)
|
||||
{
|
||||
textBox1.Text = result?.Title ?? string.Empty;
|
||||
textBox1.Text = result?.Title ?? "New Tile";
|
||||
textBox2.Text = result?.ProcessFilename ?? string.Empty;
|
||||
textBox3.Text = result?.ProcessArgument ?? string.Empty;
|
||||
textBox4.Text = result?.ProcessWorkingDirectory ?? string.Empty;
|
||||
pickerBox1.ComboBox.SelectedIndex = (int)result.ProcessWindowStyle;
|
||||
pickerBox2.Value = result.ProcessAsAdmin;
|
||||
}
|
||||
pickerBox1.ComboBox.SelectedIndex = (int)(result?.ProcessWindowStyle ?? ProcessWindowStyle.Normal);
|
||||
pickerBox2.Value = result?.ProcessAsAdmin ?? false;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
|
||||
103
MainForm.Designer.cs
generated
103
MainForm.Designer.cs
generated
@ -65,10 +65,6 @@ namespace RokettoLaunch
|
||||
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem2 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
addRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
removeRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
|
||||
toolStripMenuItem3 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
topToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
upToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@ -142,7 +138,7 @@ namespace RokettoLaunch
|
||||
newToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
newToolStripMenuItem.Name = "newToolStripMenuItem";
|
||||
newToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N;
|
||||
newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
newToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
newToolStripMenuItem.Text = "&New";
|
||||
newToolStripMenuItem.Click += newToolStripMenuItem_Click;
|
||||
//
|
||||
@ -151,52 +147,52 @@ namespace RokettoLaunch
|
||||
openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
openToolStripMenuItem.Name = "openToolStripMenuItem";
|
||||
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
|
||||
openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
openToolStripMenuItem.Text = "&Open";
|
||||
openToolStripMenuItem.Click += openToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItem13
|
||||
//
|
||||
toolStripMenuItem13.Name = "toolStripMenuItem13";
|
||||
toolStripMenuItem13.Size = new System.Drawing.Size(177, 6);
|
||||
toolStripMenuItem13.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// closeToolStripMenuItem
|
||||
//
|
||||
closeToolStripMenuItem.Name = "closeToolStripMenuItem";
|
||||
closeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
closeToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
closeToolStripMenuItem.Text = "&Close";
|
||||
closeToolStripMenuItem.Click += closeToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItem14
|
||||
//
|
||||
toolStripMenuItem14.Name = "toolStripMenuItem14";
|
||||
toolStripMenuItem14.Size = new System.Drawing.Size(177, 6);
|
||||
toolStripMenuItem14.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// saveToolStripMenuItem
|
||||
//
|
||||
saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
|
||||
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
|
||||
saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
saveToolStripMenuItem.Text = "&Save";
|
||||
saveToolStripMenuItem.Click += saveToolStripMenuItem_Click;
|
||||
//
|
||||
// saveAsToolStripMenuItem
|
||||
//
|
||||
saveAsToolStripMenuItem.Name = "saveAsToolStripMenuItem";
|
||||
saveAsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
saveAsToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
|
||||
saveAsToolStripMenuItem.Text = "Save &As...";
|
||||
saveAsToolStripMenuItem.Click += saveAsToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItem15
|
||||
//
|
||||
toolStripMenuItem15.Name = "toolStripMenuItem15";
|
||||
toolStripMenuItem15.Size = new System.Drawing.Size(177, 6);
|
||||
toolStripMenuItem15.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// exitToolStripMenuItem2
|
||||
//
|
||||
exitToolStripMenuItem2.Name = "exitToolStripMenuItem2";
|
||||
exitToolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
|
||||
exitToolStripMenuItem2.Size = new System.Drawing.Size(146, 22);
|
||||
exitToolStripMenuItem2.Text = "E&xit";
|
||||
exitToolStripMenuItem2.Click += exitToolStripMenuItem2_Click;
|
||||
//
|
||||
@ -210,8 +206,8 @@ namespace RokettoLaunch
|
||||
// addGroupToolStripMenuItem
|
||||
//
|
||||
addGroupToolStripMenuItem.Name = "addGroupToolStripMenuItem";
|
||||
addGroupToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
addGroupToolStripMenuItem.Text = "&Add Group";
|
||||
addGroupToolStripMenuItem.Size = new System.Drawing.Size(138, 22);
|
||||
addGroupToolStripMenuItem.Text = "&Add Section";
|
||||
addGroupToolStripMenuItem.Click += addGroupToolStripMenuItem_Click;
|
||||
//
|
||||
// viewToolStripMenuItem
|
||||
@ -224,14 +220,14 @@ namespace RokettoLaunch
|
||||
// showBigIconsToolStripMenuItem
|
||||
//
|
||||
showBigIconsToolStripMenuItem.Name = "showBigIconsToolStripMenuItem";
|
||||
showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
showBigIconsToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
showBigIconsToolStripMenuItem.Text = "Show &Big Icons";
|
||||
showBigIconsToolStripMenuItem.Click += showBigIconsToolStripMenuItem_Click;
|
||||
//
|
||||
// alwaysOnTopToolStripMenuItem
|
||||
//
|
||||
alwaysOnTopToolStripMenuItem.Name = "alwaysOnTopToolStripMenuItem";
|
||||
alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
alwaysOnTopToolStripMenuItem.Size = new System.Drawing.Size(154, 22);
|
||||
alwaysOnTopToolStripMenuItem.Text = "Always On &Top";
|
||||
alwaysOnTopToolStripMenuItem.Click += alwaysOnTopToolStripMenuItem_Click;
|
||||
//
|
||||
@ -247,7 +243,7 @@ namespace RokettoLaunch
|
||||
optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
|
||||
optionsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12;
|
||||
optionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
|
||||
optionsToolStripMenuItem.Text = "&Options";
|
||||
optionsToolStripMenuItem.Click += optionsToolStripMenuItem_Click;
|
||||
//
|
||||
@ -263,131 +259,105 @@ namespace RokettoLaunch
|
||||
viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
|
||||
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
|
||||
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
|
||||
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
||||
viewHelpToolStripMenuItem1.Text = "&View Help";
|
||||
viewHelpToolStripMenuItem1.Click += viewHelpToolStripMenuItem1_Click;
|
||||
//
|
||||
// toolStripMenuItem16
|
||||
//
|
||||
toolStripMenuItem16.Name = "toolStripMenuItem16";
|
||||
toolStripMenuItem16.Size = new System.Drawing.Size(177, 6);
|
||||
toolStripMenuItem16.Size = new System.Drawing.Size(143, 6);
|
||||
//
|
||||
// aboutToolStripMenuItem1
|
||||
//
|
||||
aboutToolStripMenuItem1.Name = "aboutToolStripMenuItem1";
|
||||
aboutToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
aboutToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
|
||||
aboutToolStripMenuItem1.Text = "&About";
|
||||
aboutToolStripMenuItem1.Click += aboutToolStripMenuItem1_Click;
|
||||
//
|
||||
// tileContainerMenu1
|
||||
//
|
||||
tileContainerMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addGroupToolStripMenuItem1, toolStripMenuItem4, editToolStripMenuItem, toolStripMenuItem5, toolStripSeparator1, toolStripMenuItem2, toolStripSeparator2, toolStripMenuItem3, toolStripSeparator3, removeToolStripMenuItem });
|
||||
tileContainerMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addGroupToolStripMenuItem1, toolStripMenuItem4, editToolStripMenuItem, toolStripMenuItem5, toolStripSeparator1, toolStripMenuItem3, toolStripSeparator3, removeToolStripMenuItem });
|
||||
tileContainerMenu1.Name = "tileContainerMenu1";
|
||||
tileContainerMenu1.Size = new System.Drawing.Size(133, 176);
|
||||
tileContainerMenu1.Size = new System.Drawing.Size(181, 170);
|
||||
//
|
||||
// addGroupToolStripMenuItem1
|
||||
//
|
||||
addGroupToolStripMenuItem1.Name = "addGroupToolStripMenuItem1";
|
||||
addGroupToolStripMenuItem1.Size = new System.Drawing.Size(132, 22);
|
||||
addGroupToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
|
||||
addGroupToolStripMenuItem1.Text = "&Add Tile";
|
||||
addGroupToolStripMenuItem1.Click += addGroupToolStripMenuItem1_Click;
|
||||
//
|
||||
// toolStripMenuItem4
|
||||
//
|
||||
toolStripMenuItem4.Name = "toolStripMenuItem4";
|
||||
toolStripMenuItem4.Size = new System.Drawing.Size(132, 22);
|
||||
toolStripMenuItem4.Text = "Add &Group";
|
||||
toolStripMenuItem4.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem4.Text = "Add &Folder";
|
||||
toolStripMenuItem4.Click += toolStripMenuItem4_Click;
|
||||
//
|
||||
// editToolStripMenuItem
|
||||
//
|
||||
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||
editToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
||||
editToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
editToolStripMenuItem.Text = "&Edit";
|
||||
editToolStripMenuItem.Click += editToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
toolStripMenuItem5.Size = new System.Drawing.Size(132, 22);
|
||||
toolStripMenuItem5.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem5.Text = "&Duplicate";
|
||||
toolStripMenuItem5.Click += toolStripMenuItem5_Click;
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(129, 6);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
toolStripMenuItem2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { addRowToolStripMenuItem, removeRowToolStripMenuItem });
|
||||
toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
toolStripMenuItem2.Size = new System.Drawing.Size(132, 22);
|
||||
toolStripMenuItem2.Text = "Ro&w";
|
||||
//
|
||||
// addRowToolStripMenuItem
|
||||
//
|
||||
addRowToolStripMenuItem.Name = "addRowToolStripMenuItem";
|
||||
addRowToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
|
||||
addRowToolStripMenuItem.Text = "A&dd Row";
|
||||
addRowToolStripMenuItem.Click += addRowToolStripMenuItem_Click;
|
||||
//
|
||||
// removeRowToolStripMenuItem
|
||||
//
|
||||
removeRowToolStripMenuItem.Name = "removeRowToolStripMenuItem";
|
||||
removeRowToolStripMenuItem.Size = new System.Drawing.Size(143, 22);
|
||||
removeRowToolStripMenuItem.Text = "Remo&ve Row";
|
||||
removeRowToolStripMenuItem.Click += removeRowToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripSeparator2
|
||||
//
|
||||
toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
toolStripSeparator2.Size = new System.Drawing.Size(129, 6);
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// toolStripMenuItem3
|
||||
//
|
||||
toolStripMenuItem3.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { topToolStripMenuItem, upToolStripMenuItem, downToolStripMenuItem, bottomToolStripMenuItem });
|
||||
toolStripMenuItem3.Name = "toolStripMenuItem3";
|
||||
toolStripMenuItem3.Size = new System.Drawing.Size(132, 22);
|
||||
toolStripMenuItem3.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem3.Text = "&Move";
|
||||
//
|
||||
// topToolStripMenuItem
|
||||
//
|
||||
topToolStripMenuItem.Name = "topToolStripMenuItem";
|
||||
topToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
|
||||
topToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
topToolStripMenuItem.Text = "&Top";
|
||||
topToolStripMenuItem.Click += topToolStripMenuItem_Click;
|
||||
//
|
||||
// upToolStripMenuItem
|
||||
//
|
||||
upToolStripMenuItem.Name = "upToolStripMenuItem";
|
||||
upToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
|
||||
upToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
upToolStripMenuItem.Text = "&Up";
|
||||
upToolStripMenuItem.Click += upToolStripMenuItem_Click;
|
||||
//
|
||||
// downToolStripMenuItem
|
||||
//
|
||||
downToolStripMenuItem.Name = "downToolStripMenuItem";
|
||||
downToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
|
||||
downToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
downToolStripMenuItem.Text = "&Down";
|
||||
downToolStripMenuItem.Click += downToolStripMenuItem_Click;
|
||||
//
|
||||
// bottomToolStripMenuItem
|
||||
//
|
||||
bottomToolStripMenuItem.Name = "bottomToolStripMenuItem";
|
||||
bottomToolStripMenuItem.Size = new System.Drawing.Size(114, 22);
|
||||
bottomToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
bottomToolStripMenuItem.Text = "&Bottom";
|
||||
bottomToolStripMenuItem.Click += bottomToolStripMenuItem_Click;
|
||||
//
|
||||
// toolStripSeparator3
|
||||
//
|
||||
toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
toolStripSeparator3.Size = new System.Drawing.Size(129, 6);
|
||||
toolStripSeparator3.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// removeToolStripMenuItem
|
||||
//
|
||||
removeToolStripMenuItem.Name = "removeToolStripMenuItem";
|
||||
removeToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
|
||||
removeToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
removeToolStripMenuItem.Text = "&Remove";
|
||||
removeToolStripMenuItem.Click += removeToolStripMenuItem_Click;
|
||||
//
|
||||
@ -397,10 +367,10 @@ namespace RokettoLaunch
|
||||
flowLayoutPanel1.BackColor = System.Drawing.Color.Transparent;
|
||||
flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
|
||||
flowLayoutPanel1.Location = new System.Drawing.Point(6, 0);
|
||||
flowLayoutPanel1.Location = new System.Drawing.Point(0, 0);
|
||||
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
flowLayoutPanel1.Name = "flowLayoutPanel1";
|
||||
flowLayoutPanel1.Size = new System.Drawing.Size(398, 417);
|
||||
flowLayoutPanel1.Size = new System.Drawing.Size(404, 417);
|
||||
flowLayoutPanel1.TabIndex = 8;
|
||||
flowLayoutPanel1.WrapContents = false;
|
||||
//
|
||||
@ -412,7 +382,6 @@ namespace RokettoLaunch
|
||||
panel1.Location = new System.Drawing.Point(0, 24);
|
||||
panel1.Margin = new System.Windows.Forms.Padding(0);
|
||||
panel1.Name = "panel1";
|
||||
panel1.Padding = new System.Windows.Forms.Padding(6, 0, 0, 0);
|
||||
panel1.Size = new System.Drawing.Size(404, 417);
|
||||
panel1.TabIndex = 9;
|
||||
//
|
||||
@ -508,13 +477,9 @@ namespace RokettoLaunch
|
||||
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
|
||||
private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem2;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator2;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem3;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator3;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem4;
|
||||
private System.Windows.Forms.ToolStripMenuItem addRowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem removeRowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem topToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem upToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
|
||||
|
||||
300
MainForm.cs
300
MainForm.cs
@ -4,7 +4,6 @@ using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text.Json;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
@ -20,6 +19,8 @@ namespace RokettoLaunch
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
private const int MIN_ITEMS_PER_ROW = 4;
|
||||
|
||||
private readonly FileSessionManager _fileSessionManager;
|
||||
|
||||
private bool _isBusy = false;
|
||||
@ -33,6 +34,12 @@ namespace RokettoLaunch
|
||||
this.AutoScaleMode = AutoScaleMode.None;
|
||||
this.Text = Application.ProductName;
|
||||
|
||||
this.CurrentSession = new AppOptions();
|
||||
|
||||
#if DEBUG
|
||||
flowLayoutPanel1.BackColor = Color.LightGreen;
|
||||
#endif
|
||||
|
||||
newToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("a", Color.Black, 2);
|
||||
openToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("b", Color.Black, 2);
|
||||
saveToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.GetImage("c", Color.Black, 2);
|
||||
@ -69,10 +76,10 @@ namespace RokettoLaunch
|
||||
}
|
||||
else
|
||||
{
|
||||
this.CurrentSession = new AppOptions();
|
||||
|
||||
InvalidateOptions();
|
||||
await _fileSessionManager.NewSession();
|
||||
}
|
||||
|
||||
UIControl.SetFocus(this);
|
||||
}
|
||||
|
||||
protected async override void OnClosing(CancelEventArgs e)
|
||||
@ -131,8 +138,21 @@ namespace RokettoLaunch
|
||||
public AppOptions CurrentSession { get; set; } = null;
|
||||
|
||||
|
||||
private void InvalidateOptions()
|
||||
private void InvalidateOptions(bool resize)
|
||||
{
|
||||
if (resize)
|
||||
{
|
||||
if (!this.CurrentSession.StartPosition.IsEmpty)
|
||||
{
|
||||
UIControl.SetLocation(this, this.CurrentSession.StartPosition);
|
||||
}
|
||||
|
||||
if (this.CurrentSession.Height > 0)
|
||||
{
|
||||
UIControl.SetClientHeight(this, this.CurrentSession.Height);
|
||||
}
|
||||
}
|
||||
|
||||
/// todo: big icons
|
||||
|
||||
#if !DEBUG
|
||||
@ -150,6 +170,8 @@ namespace RokettoLaunch
|
||||
}
|
||||
#endif
|
||||
|
||||
AutoResizeWidth();
|
||||
|
||||
UIControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
|
||||
}
|
||||
|
||||
@ -202,6 +224,7 @@ namespace RokettoLaunch
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
|
||||
#region Main Menu
|
||||
|
||||
/// <summary>
|
||||
@ -304,7 +327,7 @@ namespace RokettoLaunch
|
||||
/// <param name="e"></param>
|
||||
private async void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
await AddNewTileGroup();
|
||||
await AddNewSection();
|
||||
}
|
||||
|
||||
|
||||
@ -353,7 +376,7 @@ namespace RokettoLaunch
|
||||
{
|
||||
this.CurrentSession = form.Result;
|
||||
|
||||
InvalidateOptions();
|
||||
InvalidateOptions(false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -411,83 +434,50 @@ namespace RokettoLaunch
|
||||
|
||||
private async Task<bool> fileSessionManager_OnNewSession(FileSessionManager sender)
|
||||
{
|
||||
return await Task.Run(async () =>
|
||||
{
|
||||
var form = new NewForm();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var result = form.Result;
|
||||
// Enforce minimum number of rows
|
||||
this.CurrentSession.TilesPerRow = Math.Max(this.CurrentSession.TilesPerRow, MIN_ITEMS_PER_ROW);
|
||||
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
|
||||
this.CurrentSession.TilesPerRow = result.ColumnCount;
|
||||
await AddNewSection();
|
||||
|
||||
for (var i = 0; i < result.GroupCount; i++)
|
||||
{
|
||||
await AddNewTileGroup();
|
||||
}
|
||||
}
|
||||
|
||||
AutoResize();
|
||||
InvalidateOptions(false);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private async Task<bool> fileSessionManager_OnLoadSession(FileSessionManager sender, string filename, int formatType)
|
||||
{
|
||||
return await Task.Run(async () =>
|
||||
{
|
||||
var result = GenericResult.Create();
|
||||
var newSession = new AppOptions();
|
||||
|
||||
switch (Path.GetExtension(filename?.ToLower()?.Trim() ?? string.Empty))
|
||||
{
|
||||
case ".json":
|
||||
case ".jsonfig":
|
||||
this.CurrentSession = RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
|
||||
newSession = await RyzStudio.Text.Json.JsonSerialiser.DeserialiseFile<AppOptions>(filename);
|
||||
break;
|
||||
case ".jsnx":
|
||||
this.CurrentSession = await RyzStudio.IO.Compression.ZFile.ReadFile<AppOptions>(filename, "Document.json");
|
||||
newSession = await RyzStudio.IO.Compression.ZFile.ReadFile<AppOptions>(filename, "Document.json");
|
||||
break;
|
||||
default:
|
||||
this.CurrentSession = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (this.CurrentSession == null)
|
||||
{
|
||||
ThMessageBox.Show(this, "Unable to read session", "Load session");
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.CurrentSession == null)
|
||||
{
|
||||
this.CurrentSession = new AppOptions();
|
||||
}
|
||||
|
||||
// Reposition + resize
|
||||
if (!this.CurrentSession.StartPosition.IsEmpty)
|
||||
{
|
||||
UIControl.SetLocation(this, this.CurrentSession.StartPosition);
|
||||
}
|
||||
|
||||
if (this.CurrentSession.Height > 0)
|
||||
{
|
||||
UIControl.SetClientHeight(this, this.CurrentSession.Height);
|
||||
}
|
||||
|
||||
InvalidateOptions();
|
||||
if (newSession == null) newSession = new AppOptions();
|
||||
|
||||
// Load tiles
|
||||
await LoadTileGroups(this.CurrentSession.Groups);
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
|
||||
AutoResize();
|
||||
foreach (var item in newSession.Groups ?? new List<TileGroupModel>())
|
||||
{
|
||||
await AddSection(item);
|
||||
}
|
||||
|
||||
UIControl.SetFocus(this);
|
||||
this.CurrentSession = newSession;
|
||||
|
||||
InvalidateOptions(true);
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
private async Task<bool> fileSessionManager_OnSaveSession(FileSessionManager sender, string filename, int formatType, bool showNotices)
|
||||
@ -521,22 +511,11 @@ namespace RokettoLaunch
|
||||
this.CurrentSession.Height = this.Height;
|
||||
|
||||
this.CurrentSession.Groups = new List<TileGroupModel>();
|
||||
foreach (var container in flowLayoutPanel1.Controls.OfType<RyzStudio.Windows.TileForms.TileContainer>())
|
||||
foreach (var section in flowLayoutPanel1.Controls.OfType<RyzStudio.Windows.TileForms.TileContainer>())
|
||||
{
|
||||
var newTag = (TileGroupModel)container.Tag;
|
||||
if (newTag == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
var newTag = GetSectionTag(section);
|
||||
|
||||
newTag.Items = new List<TileModel>();
|
||||
|
||||
foreach (var tile in container.Controls.OfType<TilePanel>())
|
||||
{
|
||||
tile.ModelInfo.Position = container.GetCoord(tile);
|
||||
|
||||
newTag.Items.Add(tile.ModelInfo);
|
||||
}
|
||||
section.Tag = newTag;
|
||||
|
||||
this.CurrentSession.Groups.Add(newTag);
|
||||
}
|
||||
@ -588,11 +567,8 @@ namespace RokettoLaunch
|
||||
}
|
||||
|
||||
private async Task<bool> fileSessionManager_OnClearSession(FileSessionManager sender)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -629,8 +605,8 @@ namespace RokettoLaunch
|
||||
/// <param name="e"></param>
|
||||
private void addGroupToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var container = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripMenuItem)sender);
|
||||
if (container == null)
|
||||
var section = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripMenuItem)sender);
|
||||
if (section == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -639,13 +615,13 @@ namespace RokettoLaunch
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var result = form.Result;
|
||||
var newCoord = container.GetNextCoord();
|
||||
var newCoord = section.GetNextCoord();
|
||||
|
||||
var newTile = new RokettoLaunch.Windows.Forms.TilePanel();
|
||||
var newTile = new TilePanel();
|
||||
newTile.ContextMenuStrip = tileMenu1;
|
||||
newTile.LoadInfo(result);
|
||||
|
||||
container.Add(newTile, newCoord.X, newCoord.Y);
|
||||
section.Add(newTile, newCoord.X, newCoord.Y);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
};
|
||||
@ -695,7 +671,7 @@ namespace RokettoLaunch
|
||||
|
||||
var model = UIControl.GetTag<TileGroupModel>(container);
|
||||
|
||||
var form = new EditGroupForm(model);
|
||||
var form = new EditSectionForm(model);
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
var result = form.Result;
|
||||
@ -716,20 +692,22 @@ namespace RokettoLaunch
|
||||
/// <param name="e"></param>
|
||||
private async void toolStripMenuItem5_Click(object sender, EventArgs e)
|
||||
{
|
||||
var container = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripMenuItem)sender);
|
||||
if (container == null)
|
||||
var section = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripMenuItem)sender);
|
||||
if (section == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var model = UIControl.GetTag<TileGroupModel>(container);
|
||||
model.IsExpanded = true;
|
||||
var newTag = GetSectionTag(section);
|
||||
section.Tag = newTag;
|
||||
|
||||
try
|
||||
{
|
||||
var newModel = JsonSerializer.Deserialize<TileGroupModel>(JsonSerializer.Serialize(model));
|
||||
var newerTag = JsonSerializer.Deserialize<TileGroupModel>(JsonSerializer.Serialize(newTag));
|
||||
newerTag.IsExpanded = true;
|
||||
newerTag.Title = (string.IsNullOrWhiteSpace(newerTag.Title) ? "New Section" : newerTag.Title?.Trim()) + " (Copy)";
|
||||
|
||||
await AddTileGroups(newModel);
|
||||
await AddSection(newerTag);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
@ -739,43 +717,6 @@ namespace RokettoLaunch
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Row - Add Row
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void addRowToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var container = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripDropDownItem)sender);
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
container.AddRow();
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Row - Remove Row
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void removeRowToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var container = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripDropDownItem)sender);
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
container.RemoveRow();
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move Top
|
||||
/// </summary>
|
||||
@ -855,13 +796,19 @@ namespace RokettoLaunch
|
||||
/// <param name="e"></param>
|
||||
private void removeToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you want to remove section?", "Remove Section", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (result != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var container = UIControl.GetOwner<RyzStudio.Windows.TileForms.TileContainer>((ToolStripMenuItem)sender);
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
flowLayoutPanel1.Controls.Remove(container);
|
||||
container?.Parent.Controls?.Remove(container);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
@ -918,32 +865,7 @@ namespace RokettoLaunch
|
||||
return;
|
||||
}
|
||||
|
||||
var container = UIControl.GetParentsUntil<TileContainer>(tile);
|
||||
if (container == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newModel = new TileModel();
|
||||
|
||||
try
|
||||
{
|
||||
newModel = JsonSerializer.Deserialize<TileModel>(JsonSerializer.Serialize(tile.ModelInfo));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newCoord = container.GetNextCoord();
|
||||
|
||||
var newTile = new RokettoLaunch.Windows.Forms.TilePanel();
|
||||
newTile.ContextMenuStrip = tileMenu1;
|
||||
newTile.LoadInfo(newModel);
|
||||
|
||||
container.Add(newTile, newCoord.X, newCoord.Y);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
DuplicateTile(tile);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -953,6 +875,12 @@ namespace RokettoLaunch
|
||||
/// <param name="e"></param>
|
||||
private void removeToolStripMenuItem1_Click(object sender, EventArgs e)
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you want to remove tile?", "Remove Tile", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (result != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var tile = UIControl.GetOwner<RokettoLaunch.Windows.Forms.TilePanel>((ToolStripMenuItem)sender);
|
||||
if (tile == null)
|
||||
{
|
||||
@ -973,31 +901,31 @@ namespace RokettoLaunch
|
||||
#endregion
|
||||
|
||||
|
||||
private async Task AddNewTileGroup()
|
||||
private async Task AddNewSection()
|
||||
{
|
||||
var group = new TileGroupModel();
|
||||
group.Title = "New Group";
|
||||
group.Title = "New Section";
|
||||
group.IsExpanded = true;
|
||||
group.GridSize = new System.Drawing.Size(this.CurrentSession.TilesPerRow, 1);
|
||||
|
||||
await AddTileGroups(group);
|
||||
await AddSection(group);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
private async Task AddTileGroups(TileGroupModel model)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
private async Task AddSection(TileGroupModel model)
|
||||
{
|
||||
var panel = new RyzStudio.Windows.TileForms.TileContainer();
|
||||
panel.Title = model.Title;
|
||||
panel.IsOpen = model.IsExpanded;
|
||||
panel.TitleContextMenuStrip = tileContainerMenu1;
|
||||
panel.PaddingBottom = 0;
|
||||
panel.AutoSizeHeight = true;
|
||||
panel.Tag = model;
|
||||
panel.AutoSize(model.GridSize.Width, model.GridSize.Height);
|
||||
panel.Height += 4;
|
||||
|
||||
#if DEBUG
|
||||
panel.BackColor = Color.LightSteelBlue;
|
||||
#endif
|
||||
|
||||
panel.MouseClick += tileContainer_MouseClick;
|
||||
|
||||
@ -1012,33 +940,73 @@ namespace RokettoLaunch
|
||||
|
||||
panel.Add(newTile, item2.Position.X, item2.Position.Y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void AutoResize()
|
||||
private void AutoResizeWidth()
|
||||
{
|
||||
if (flowLayoutPanel1.Controls.Count <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var width = 0;
|
||||
var width = MIN_ITEMS_PER_ROW;
|
||||
foreach (var item in flowLayoutPanel1.Controls.OfType<TileContainer>())
|
||||
{
|
||||
width = Math.Max(width, item.Width);
|
||||
}
|
||||
|
||||
UIControl.SetClientWidth(this, width + panel1.Padding.Horizontal + this.Padding.Horizontal + SystemInformation.VerticalScrollBarWidth);
|
||||
var padding = panel1.Padding.Horizontal + this.Padding.Horizontal + SystemInformation.VerticalScrollBarWidth;
|
||||
|
||||
UIControl.SetClientWidth(this, width + padding);
|
||||
}
|
||||
|
||||
private async Task LoadTileGroups(List<TileGroupModel> groupList)
|
||||
public void DuplicateTile(TilePanel tile)
|
||||
{
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
|
||||
foreach (var item in groupList ?? new List<TileGroupModel>())
|
||||
var container = UIControl.GetParentsUntil<TileContainer>(tile);
|
||||
if (container == null)
|
||||
{
|
||||
await AddTileGroups(item);
|
||||
return;
|
||||
}
|
||||
|
||||
var newModel = new TileModel();
|
||||
|
||||
try
|
||||
{
|
||||
newModel = JsonSerializer.Deserialize<TileModel>(JsonSerializer.Serialize(tile.ModelInfo));
|
||||
newModel.Title = (string.IsNullOrWhiteSpace(newModel.Title) ? "New Tile" : newModel.Title?.Trim()) + " (Copy)";
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var newCoord = container.GetNextCoord();
|
||||
|
||||
var newTile = new RokettoLaunch.Windows.Forms.TilePanel();
|
||||
newTile.ContextMenuStrip = tileMenu1;
|
||||
newTile.LoadInfo(newModel);
|
||||
|
||||
container.Add(newTile, newCoord.X, newCoord.Y);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
private TileGroupModel GetSectionTag(TileContainer section)
|
||||
{
|
||||
var newTag = new TileGroupModel();
|
||||
newTag.Title = section.Title ?? "New Section";
|
||||
newTag.IsExpanded = section.IsOpen;
|
||||
newTag.GridSize = section.GridSize;
|
||||
newTag.Items = new List<TileModel>();
|
||||
|
||||
foreach (var tile in section?.Controls?.OfType<TilePanel>() ?? new List<TilePanel>())
|
||||
{
|
||||
tile.ModelInfo.Position = section.GetCoord(tile);
|
||||
|
||||
newTag.Items.Add(tile.ModelInfo);
|
||||
}
|
||||
|
||||
return newTag;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
136
NewForm.cs
136
NewForm.cs
@ -1,136 +0,0 @@
|
||||
using System.Windows.Forms;
|
||||
using RokettoLaunch.Models;
|
||||
using RyzStudio.Windows.Forms;
|
||||
using RyzStudio.Windows.ThemedForms;
|
||||
|
||||
namespace RokettoLaunch
|
||||
{
|
||||
public class NewForm : Form
|
||||
{
|
||||
private System.Windows.Forms.Label label1;
|
||||
private ThNumericBox numericBox1;
|
||||
private ThNumericBox numericBox2;
|
||||
private RyzStudio.Windows.ThemedForms.Composite.DialogFooter dialogFooter1;
|
||||
private Label label2;
|
||||
|
||||
|
||||
public NewForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
UISetup.Dialog(this);
|
||||
|
||||
numericBox1.Minimum = 4;
|
||||
numericBox1.Maximum = 24;
|
||||
numericBox1.Value = 8;
|
||||
numericBox2.Minimum = 1;
|
||||
numericBox2.Maximum = 8;
|
||||
numericBox2.Value = 1;
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
label1 = new Label();
|
||||
numericBox1 = new ThNumericBox();
|
||||
numericBox2 = new ThNumericBox();
|
||||
label2 = new Label();
|
||||
dialogFooter1 = new RyzStudio.Windows.ThemedForms.Composite.DialogFooter();
|
||||
SuspendLayout();
|
||||
//
|
||||
// label1
|
||||
//
|
||||
label1.AutoSize = true;
|
||||
label1.BackColor = System.Drawing.Color.Transparent;
|
||||
label1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
label1.Location = new System.Drawing.Point(10, 20);
|
||||
label1.Margin = new Padding(0);
|
||||
label1.Name = "label1";
|
||||
label1.Padding = new Padding(0, 9, 0, 0);
|
||||
label1.Size = new System.Drawing.Size(76, 24);
|
||||
label1.TabIndex = 153;
|
||||
label1.Text = "Tiles Per Row";
|
||||
label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// numericBox1
|
||||
//
|
||||
numericBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
numericBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
numericBox1.EnableReactiveVisual = true;
|
||||
numericBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
numericBox1.Location = new System.Drawing.Point(285, 20);
|
||||
numericBox1.Maximum = 100;
|
||||
numericBox1.Minimum = 1;
|
||||
numericBox1.Name = "numericBox1";
|
||||
numericBox1.Size = new System.Drawing.Size(84, 32);
|
||||
numericBox1.TabIndex = 189;
|
||||
numericBox1.TabStop = false;
|
||||
numericBox1.Value = 1;
|
||||
//
|
||||
// numericBox2
|
||||
//
|
||||
numericBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
numericBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
numericBox2.EnableReactiveVisual = true;
|
||||
numericBox2.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
numericBox2.Location = new System.Drawing.Point(285, 63);
|
||||
numericBox2.Maximum = 100;
|
||||
numericBox2.Minimum = 1;
|
||||
numericBox2.Name = "numericBox2";
|
||||
numericBox2.Size = new System.Drawing.Size(84, 32);
|
||||
numericBox2.TabIndex = 191;
|
||||
numericBox2.TabStop = false;
|
||||
numericBox2.Value = 1;
|
||||
//
|
||||
// label2
|
||||
//
|
||||
label2.AutoSize = true;
|
||||
label2.BackColor = System.Drawing.Color.Transparent;
|
||||
label2.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
label2.Location = new System.Drawing.Point(10, 63);
|
||||
label2.Margin = new Padding(0);
|
||||
label2.Name = "label2";
|
||||
label2.Padding = new Padding(0, 9, 0, 0);
|
||||
label2.Size = new System.Drawing.Size(106, 24);
|
||||
label2.TabIndex = 190;
|
||||
label2.Text = "Number of Groups";
|
||||
label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
//
|
||||
// dialogFooter1
|
||||
//
|
||||
dialogFooter1.BackColor = System.Drawing.Color.FromArgb(240, 240, 240);
|
||||
dialogFooter1.Button1Text = "&OK";
|
||||
dialogFooter1.Dialog = this;
|
||||
dialogFooter1.Dock = DockStyle.Bottom;
|
||||
dialogFooter1.Location = new System.Drawing.Point(0, 337);
|
||||
dialogFooter1.Name = "dialogFooter1";
|
||||
dialogFooter1.Size = new System.Drawing.Size(384, 84);
|
||||
//
|
||||
// NewForm
|
||||
//
|
||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
AutoScaleMode = AutoScaleMode.Font;
|
||||
BackColor = System.Drawing.Color.White;
|
||||
ClientSize = new System.Drawing.Size(384, 421);
|
||||
Controls.Add(dialogFooter1);
|
||||
Controls.Add(numericBox2);
|
||||
Controls.Add(label2);
|
||||
Controls.Add(numericBox1);
|
||||
Controls.Add(label1);
|
||||
MinimumSize = new System.Drawing.Size(400, 200);
|
||||
Name = "NewForm";
|
||||
Text = "New";
|
||||
ResumeLayout(false);
|
||||
PerformLayout();
|
||||
}
|
||||
|
||||
public NewFormModel Result
|
||||
{
|
||||
get => new NewFormModel()
|
||||
{
|
||||
ColumnCount = numericBox1.Value,
|
||||
GroupCount = numericBox2.Value
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
120
NewForm.resx
120
NewForm.resx
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@ -94,13 +94,11 @@ namespace RokettoLaunch
|
||||
//
|
||||
// yesNoPickerBox2
|
||||
//
|
||||
yesNoPickerBox2.AcceptButton = null;
|
||||
yesNoPickerBox2.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
yesNoPickerBox2.BackColor = System.Drawing.Color.Transparent;
|
||||
yesNoPickerBox2.EnableReactiveVisual = true;
|
||||
yesNoPickerBox2.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
yesNoPickerBox2.Location = new System.Drawing.Point(307, 63);
|
||||
yesNoPickerBox2.Margin = new Padding(10, 10, 10, 0);
|
||||
yesNoPickerBox2.Name = "yesNoPickerBox2";
|
||||
yesNoPickerBox2.Padding = new Padding(4, 4, 3, 3);
|
||||
yesNoPickerBox2.SelectedIndex = 1;
|
||||
@ -125,13 +123,11 @@ namespace RokettoLaunch
|
||||
//
|
||||
// yesNoPickerBox3
|
||||
//
|
||||
yesNoPickerBox3.AcceptButton = null;
|
||||
yesNoPickerBox3.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
yesNoPickerBox3.BackColor = System.Drawing.Color.Transparent;
|
||||
yesNoPickerBox3.EnableReactiveVisual = true;
|
||||
yesNoPickerBox3.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
yesNoPickerBox3.Location = new System.Drawing.Point(307, 107);
|
||||
yesNoPickerBox3.Margin = new Padding(10, 10, 10, 0);
|
||||
yesNoPickerBox3.Name = "yesNoPickerBox3";
|
||||
yesNoPickerBox3.Padding = new Padding(4, 4, 3, 3);
|
||||
yesNoPickerBox3.SelectedIndex = 1;
|
||||
@ -156,7 +152,6 @@ namespace RokettoLaunch
|
||||
//
|
||||
// textBox1
|
||||
//
|
||||
textBox1.AcceptButton = null;
|
||||
textBox1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
||||
textBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
textBox1.EnableReactiveVisual = true;
|
||||
@ -169,7 +164,6 @@ namespace RokettoLaunch
|
||||
results1.Key = Keys.None;
|
||||
textBox1.KeyCodeResults = results1;
|
||||
textBox1.Location = new System.Drawing.Point(192, 21);
|
||||
textBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
textBox1.Name = "textBox1";
|
||||
textBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
textBox1.Size = new System.Drawing.Size(199, 32);
|
||||
@ -179,13 +173,11 @@ namespace RokettoLaunch
|
||||
//
|
||||
// numericBox1
|
||||
//
|
||||
numericBox1.AcceptButton = null;
|
||||
numericBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
numericBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
numericBox1.EnableReactiveVisual = true;
|
||||
numericBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
numericBox1.Location = new System.Drawing.Point(252, 22);
|
||||
numericBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
numericBox1.Maximum = 100;
|
||||
numericBox1.Minimum = 1;
|
||||
numericBox1.Name = "numericBox1";
|
||||
@ -232,15 +224,14 @@ namespace RokettoLaunch
|
||||
tTogglePanel1.Controls.Add(label2);
|
||||
tTogglePanel1.Controls.Add(label4);
|
||||
tTogglePanel1.Controls.Add(numericBox1);
|
||||
tTogglePanel1.ExpandedHeight = 100;
|
||||
tTogglePanel1.ExpandedHeight = 119;
|
||||
tTogglePanel1.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
|
||||
tTogglePanel1.HeaderPadding = new Padding(4, 0, 0, 2);
|
||||
tTogglePanel1.IsOpen = true;
|
||||
tTogglePanel1.Location = new System.Drawing.Point(0, 0);
|
||||
tTogglePanel1.Margin = new Padding(0);
|
||||
tTogglePanel1.Name = "tTogglePanel1";
|
||||
tTogglePanel1.Padding = new Padding(0, 22, 0, 0);
|
||||
tTogglePanel1.PaddingBottom = 0;
|
||||
tTogglePanel1.PaddingLeft = 4;
|
||||
tTogglePanel1.Size = new System.Drawing.Size(401, 119);
|
||||
tTogglePanel1.TabIndex = 0;
|
||||
tTogglePanel1.Title = "Appearance";
|
||||
@ -249,13 +240,11 @@ namespace RokettoLaunch
|
||||
//
|
||||
// yesNoPickerBox1
|
||||
//
|
||||
yesNoPickerBox1.AcceptButton = null;
|
||||
yesNoPickerBox1.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
yesNoPickerBox1.BackColor = System.Drawing.Color.Transparent;
|
||||
yesNoPickerBox1.EnableReactiveVisual = true;
|
||||
yesNoPickerBox1.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
yesNoPickerBox1.Location = new System.Drawing.Point(307, 64);
|
||||
yesNoPickerBox1.Margin = new Padding(10, 10, 10, 0);
|
||||
yesNoPickerBox1.Name = "yesNoPickerBox1";
|
||||
yesNoPickerBox1.Padding = new Padding(4, 4, 3, 3);
|
||||
yesNoPickerBox1.SelectedIndex = 1;
|
||||
@ -290,15 +279,14 @@ namespace RokettoLaunch
|
||||
tTogglePanel2.Controls.Add(yesNoPickerBox3);
|
||||
tTogglePanel2.Controls.Add(label6);
|
||||
tTogglePanel2.Controls.Add(label7);
|
||||
tTogglePanel2.ExpandedHeight = 100;
|
||||
tTogglePanel2.ExpandedHeight = 206;
|
||||
tTogglePanel2.ForeColor = System.Drawing.Color.FromArgb(99, 105, 119);
|
||||
tTogglePanel2.HeaderPadding = new Padding(4, 0, 0, 2);
|
||||
tTogglePanel2.IsOpen = true;
|
||||
tTogglePanel2.Location = new System.Drawing.Point(0, 119);
|
||||
tTogglePanel2.Margin = new Padding(0);
|
||||
tTogglePanel2.Name = "tTogglePanel2";
|
||||
tTogglePanel2.Padding = new Padding(0, 22, 0, 0);
|
||||
tTogglePanel2.PaddingBottom = 0;
|
||||
tTogglePanel2.PaddingLeft = 4;
|
||||
tTogglePanel2.Size = new System.Drawing.Size(401, 206);
|
||||
tTogglePanel2.TabIndex = 1;
|
||||
tTogglePanel2.Title = "Behaviour";
|
||||
@ -307,13 +295,11 @@ namespace RokettoLaunch
|
||||
//
|
||||
// yesNoPickerBox4
|
||||
//
|
||||
yesNoPickerBox4.AcceptButton = null;
|
||||
yesNoPickerBox4.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||
yesNoPickerBox4.BackColor = System.Drawing.Color.Transparent;
|
||||
yesNoPickerBox4.EnableReactiveVisual = true;
|
||||
yesNoPickerBox4.Font = new System.Drawing.Font("Segoe UI", 9F);
|
||||
yesNoPickerBox4.Location = new System.Drawing.Point(307, 151);
|
||||
yesNoPickerBox4.Margin = new Padding(10, 10, 10, 0);
|
||||
yesNoPickerBox4.Name = "yesNoPickerBox4";
|
||||
yesNoPickerBox4.Padding = new Padding(4, 4, 3, 3);
|
||||
yesNoPickerBox4.SelectedIndex = 1;
|
||||
@ -342,6 +328,7 @@ namespace RokettoLaunch
|
||||
dialogFooter1.Button1Text = "&Save";
|
||||
dialogFooter1.Dialog = this;
|
||||
dialogFooter1.Dock = DockStyle.Bottom;
|
||||
dialogFooter1.IsBusy = false;
|
||||
dialogFooter1.Location = new System.Drawing.Point(0, 437);
|
||||
dialogFooter1.Name = "dialogFooter1";
|
||||
dialogFooter1.Size = new System.Drawing.Size(444, 84);
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<Copyright>Ray Lam</Copyright>
|
||||
<AssemblyVersion>1.0.0.0</AssemblyVersion>
|
||||
<FileVersion>1.0.0.0</FileVersion>
|
||||
<Version>0.3.5.0335</Version>
|
||||
<Version>0.3.6.0604</Version>
|
||||
<EnableNETAnalyzers>False</EnableNETAnalyzers>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<PackageIcon>icon-128.png</PackageIcon>
|
||||
@ -79,8 +79,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="RyzStudio" Version="8.1.2.366" />
|
||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.3.689" />
|
||||
<PackageReference Include="RyzStudio" Version="8.1.6.125" />
|
||||
<PackageReference Include="RyzStudio.Windows.Forms" Version="8.1.6.25" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -89,7 +89,6 @@
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>AppResource.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="NewForm.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
|
||||
using System;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@ -12,9 +11,6 @@ namespace RokettoLaunch.Windows.Forms
|
||||
{
|
||||
public partial class TilePanel : RyzStudio.Windows.TileForms.Tile
|
||||
{
|
||||
protected TileModel modelInfo = new TileModel();
|
||||
|
||||
|
||||
public TilePanel()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -29,7 +25,7 @@ namespace RokettoLaunch.Windows.Forms
|
||||
|
||||
|
||||
[Browsable(false)]
|
||||
public TileModel ModelInfo => modelInfo;
|
||||
public TileModel ModelInfo { get; protected set; } = new TileModel();
|
||||
|
||||
public RyzStudio.Windows.TileForms.TileContainer TileContainer { get => UIControl.GetParentsUntil<RyzStudio.Windows.TileForms.TileContainer>(this); }
|
||||
|
||||
@ -46,10 +42,16 @@ namespace RokettoLaunch.Windows.Forms
|
||||
protected override void OnDragDrop(DragEventArgs e)
|
||||
{
|
||||
string[] fileList = e.Data.GetData(DataFormats.FileDrop) as string[];
|
||||
fileList = fileList ?? new string[0];
|
||||
|
||||
if (fileList.Length <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
foreach (var item in fileList ?? new string[0])
|
||||
foreach (var item in fileList)
|
||||
{
|
||||
var model = GetTileModel(item);
|
||||
if (model == null)
|
||||
@ -60,11 +62,37 @@ namespace RokettoLaunch.Windows.Forms
|
||||
this.ModelInfo.Items.Add(model);
|
||||
}
|
||||
|
||||
InvalidateGroupMenu(this.ModelInfo);
|
||||
InvalidateGroupMenu();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((fileList?.Length ?? 0) > 0)
|
||||
if (fileList.Length > 1)
|
||||
{
|
||||
var result = MessageBox.Show("Do you want to add this as a folder ?", "Convert to Folder", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
this.ModelInfo.Title = "New Folder";
|
||||
this.ModelInfo.IsGroup = true;
|
||||
|
||||
foreach (var item in fileList)
|
||||
{
|
||||
var model = GetTileModel(item);
|
||||
if (model == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
this.ModelInfo.Items.Add(model);
|
||||
}
|
||||
|
||||
InvalidateGroupMenu();
|
||||
}
|
||||
else if (result == DialogResult.No)
|
||||
{
|
||||
LoadInfo(fileList[0]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LoadInfo(fileList[0]);
|
||||
}
|
||||
@ -98,6 +126,25 @@ namespace RokettoLaunch.Windows.Forms
|
||||
OnMouseDoubleClick(e);
|
||||
}
|
||||
}
|
||||
else if (e.Button == MouseButtons.Middle)
|
||||
{
|
||||
var mainForm = UIControl.GetParentsUntil<MainForm>(this);
|
||||
if (mainForm == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
var result = MessageBox.Show("Are you sure you want to duplicate tile?", "Duplicate Tile", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||
if (result != DialogResult.Yes)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mainForm.DuplicateTile(this);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnMouseDoubleClick(MouseEventArgs e)
|
||||
@ -118,23 +165,9 @@ namespace RokettoLaunch.Windows.Forms
|
||||
|
||||
public void LoadInfo(TileModel model)
|
||||
{
|
||||
this.modelInfo = model;
|
||||
this.ModelInfo = model;
|
||||
|
||||
this.LargeIcon = null;
|
||||
this.Title = model.Title;
|
||||
|
||||
if (this.modelInfo.IsGroup)
|
||||
{
|
||||
this.LargeIcon = AppResource.folder_32;
|
||||
|
||||
InvalidateGroupMenu(this.modelInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.LargeIcon = RyzStudio.IO.File.GetIcon(model.CleanProcessFilename);
|
||||
}
|
||||
|
||||
toolTip1.SetToolTip(this, this.Title);
|
||||
InvalidateGroupMenu();
|
||||
}
|
||||
|
||||
public void LoadInfo(string filename)
|
||||
@ -171,16 +204,24 @@ namespace RokettoLaunch.Windows.Forms
|
||||
RyzStudio.Diagnostics.Process.Execute(model.CleanProcessFilename, model.CleanProcessWorkingDirectory, model.CleanProcessArgument, model.ProcessWindowStyle, model.ProcessAsAdmin);
|
||||
}
|
||||
|
||||
private void InvalidateGroupMenu(TileModel model)
|
||||
private void InvalidateGroupMenu()
|
||||
{
|
||||
if (this.LeftContextMenuStrip == null)
|
||||
{
|
||||
this.LeftContextMenuStrip = new ContextMenuStrip();
|
||||
}
|
||||
this.Title = this.ModelInfo.Title;
|
||||
this.LargeIcon = (this.ModelInfo.IsGroup ? AppResource.folder_32 : RyzStudio.IO.File.GetIcon(this.ModelInfo.CleanProcessFilename));
|
||||
|
||||
if (this.ModelInfo.IsGroup)
|
||||
{
|
||||
this.ModelInfo.ProcessFilename = "";
|
||||
this.ModelInfo.ProcessArgument = "";
|
||||
this.ModelInfo.ProcessAsAdmin = false;
|
||||
this.ModelInfo.ProcessWindowStyle = ProcessWindowStyle.Normal;
|
||||
this.ModelInfo.ProcessWorkingDirectory = "";
|
||||
this.ModelInfo.Version = "";
|
||||
|
||||
if (this.LeftContextMenuStrip == null) this.LeftContextMenuStrip = new ContextMenuStrip();
|
||||
this.LeftContextMenuStrip.Items.Clear();
|
||||
|
||||
foreach (TileModel item in model?.Items ?? new System.Collections.Generic.List<TileModel>())
|
||||
foreach (var item in this.ModelInfo?.Items ?? new System.Collections.Generic.List<TileModel>())
|
||||
{
|
||||
ToolStripItem toolItem = this.LeftContextMenuStrip.Items.Add(item.Title);
|
||||
toolItem.Image = RyzStudio.IO.File.GetIcon(item.CleanProcessFilename);
|
||||
@ -204,6 +245,9 @@ namespace RokettoLaunch.Windows.Forms
|
||||
}
|
||||
}
|
||||
|
||||
toolTip1.SetToolTip(this, this.Title);
|
||||
}
|
||||
|
||||
private TileModel GetTileModel(string filename)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(filename))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user