Added duplicate tile group
This commit is contained in:
parent
2098cdf061
commit
3b16677a7b
31
MainForm.Designer.cs
generated
31
MainForm.Designer.cs
generated
@ -77,6 +77,7 @@ namespace FizzyLauncher
|
||||
removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
|
||||
panel1 = new System.Windows.Forms.Panel();
|
||||
toolStripMenuItem5 = new System.Windows.Forms.ToolStripMenuItem();
|
||||
contextMenuStrip2.SuspendLayout();
|
||||
menuStrip1.SuspendLayout();
|
||||
tileContainerMenu1.SuspendLayout();
|
||||
@ -274,41 +275,41 @@ namespace FizzyLauncher
|
||||
//
|
||||
// tileContainerMenu1
|
||||
//
|
||||
tileContainerMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addGroupToolStripMenuItem1, toolStripMenuItem4, editToolStripMenuItem, toolStripSeparator1, toolStripMenuItem2, toolStripSeparator2, toolStripMenuItem3, toolStripSeparator3, removeToolStripMenuItem });
|
||||
tileContainerMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addGroupToolStripMenuItem1, toolStripMenuItem4, editToolStripMenuItem, toolStripMenuItem5, toolStripSeparator1, toolStripMenuItem2, toolStripSeparator2, toolStripMenuItem3, toolStripSeparator3, removeToolStripMenuItem });
|
||||
tileContainerMenu1.Name = "tileContainerMenu1";
|
||||
tileContainerMenu1.Size = new System.Drawing.Size(133, 154);
|
||||
tileContainerMenu1.Size = new System.Drawing.Size(181, 198);
|
||||
//
|
||||
// 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.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem4.Text = "Add &Group";
|
||||
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;
|
||||
//
|
||||
// toolStripSeparator1
|
||||
//
|
||||
toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(129, 6);
|
||||
toolStripSeparator1.Size = new System.Drawing.Size(177, 6);
|
||||
//
|
||||
// toolStripMenuItem2
|
||||
//
|
||||
toolStripMenuItem2.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { addRowToolStripMenuItem, removeRowToolStripMenuItem });
|
||||
toolStripMenuItem2.Name = "toolStripMenuItem2";
|
||||
toolStripMenuItem2.Size = new System.Drawing.Size(132, 22);
|
||||
toolStripMenuItem2.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem2.Text = "Ro&w";
|
||||
//
|
||||
// addRowToolStripMenuItem
|
||||
@ -328,13 +329,13 @@ namespace FizzyLauncher
|
||||
// toolStripSeparator2
|
||||
//
|
||||
toolStripSeparator2.Name = "toolStripSeparator2";
|
||||
toolStripSeparator2.Size = new System.Drawing.Size(129, 6);
|
||||
toolStripSeparator2.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
|
||||
@ -368,12 +369,12 @@ namespace FizzyLauncher
|
||||
// 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;
|
||||
//
|
||||
@ -402,6 +403,13 @@ namespace FizzyLauncher
|
||||
panel1.Size = new System.Drawing.Size(404, 417);
|
||||
panel1.TabIndex = 9;
|
||||
//
|
||||
// toolStripMenuItem5
|
||||
//
|
||||
toolStripMenuItem5.Name = "toolStripMenuItem5";
|
||||
toolStripMenuItem5.Size = new System.Drawing.Size(180, 22);
|
||||
toolStripMenuItem5.Text = "&Duplicate";
|
||||
toolStripMenuItem5.Click += toolStripMenuItem5_Click;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
|
||||
@ -474,6 +482,7 @@ namespace FizzyLauncher
|
||||
private System.Windows.Forms.ToolStripMenuItem downToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
|
||||
private System.Windows.Forms.Panel panel1;
|
||||
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
|
||||
}
|
||||
}
|
||||
|
||||
|
104
MainForm.cs
104
MainForm.cs
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
@ -256,9 +255,9 @@ namespace FizzyLauncher
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private async void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddNewTileGroup();
|
||||
await AddNewTileGroup();
|
||||
}
|
||||
|
||||
|
||||
@ -358,7 +357,7 @@ namespace FizzyLauncher
|
||||
|
||||
private async Task<bool> fileSessionManager_OnNewSession(FileSessionManager sender)
|
||||
{
|
||||
return await Task.Run(() =>
|
||||
return await Task.Run(async () =>
|
||||
{
|
||||
var form = new NewForm();
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
@ -371,7 +370,7 @@ namespace FizzyLauncher
|
||||
|
||||
for (var i = 0; i < result.GroupCount; i++)
|
||||
{
|
||||
AddNewTileGroup();
|
||||
await AddNewTileGroup();
|
||||
}
|
||||
}
|
||||
|
||||
@ -601,6 +600,28 @@ namespace FizzyLauncher
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Duplicate
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <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)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var model = UIControl.GetTag<TileGroupModel>(container);
|
||||
model.IsExpanded = true;
|
||||
|
||||
await AddTileGroups(model);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Row - Add Row
|
||||
/// </summary>
|
||||
@ -730,28 +751,44 @@ namespace FizzyLauncher
|
||||
#endregion
|
||||
|
||||
|
||||
private void AddNewTileGroup()
|
||||
private async Task AddNewTileGroup()
|
||||
{
|
||||
var group = new TileGroupModel();
|
||||
group.Title = "New Group";
|
||||
group.IsExpanded = true;
|
||||
group.GridSize = new System.Drawing.Size(this.CurrentSession.TilesPerRow, 1);
|
||||
|
||||
var container = new RyzStudio.Windows.TileForms.TileContainer();
|
||||
container.Title = group.Title;
|
||||
container.IsOpen = group.IsExpanded;
|
||||
container.TitleContextMenuStrip = tileContainerMenu1;
|
||||
container.AutoSizeHeight = true;
|
||||
container.Tag = group;
|
||||
container.BackColor = Color.Orange;
|
||||
|
||||
UIControl.Add(flowLayoutPanel1, container);
|
||||
|
||||
container.AutoSize(group.GridSize.Width, group.GridSize.Height);
|
||||
await AddTileGroups(group);
|
||||
|
||||
_fileSessionManager.HasChanged = true;
|
||||
}
|
||||
|
||||
private async Task AddTileGroups(TileGroupModel model)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
{
|
||||
var panel = new RyzStudio.Windows.TileForms.TileContainer();
|
||||
panel.Title = model.Title;
|
||||
panel.IsOpen = model.IsExpanded;
|
||||
panel.TitleContextMenuStrip = tileContainerMenu1;
|
||||
panel.AutoSizeHeight = true;
|
||||
panel.Tag = model;
|
||||
|
||||
panel.AutoSize(model.GridSize.Width, model.GridSize.Height);
|
||||
|
||||
UIControl.Add(flowLayoutPanel1, panel);
|
||||
|
||||
// Load tiles
|
||||
foreach (var item2 in model.Items ?? new List<TileModel>())
|
||||
{
|
||||
var tile = new FizzyLauncher.Windows.Forms.TilePanel();
|
||||
tile.LoadInfo(item2);
|
||||
|
||||
panel.Add(tile, item2.Position.X, item2.Position.Y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void AutoResize()
|
||||
{
|
||||
if (flowLayoutPanel1.Controls.Count <= 0)
|
||||
@ -770,35 +807,12 @@ namespace FizzyLauncher
|
||||
|
||||
private async Task LoadTileGroups(List<TileGroupModel> groupList)
|
||||
{
|
||||
await Task.Run(() =>
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
|
||||
foreach (var item in groupList ?? new List<TileGroupModel>())
|
||||
{
|
||||
UIControl.Clear(flowLayoutPanel1);
|
||||
|
||||
// Load groups
|
||||
foreach (var item in groupList ?? new List<TileGroupModel>())
|
||||
{
|
||||
var panel = new RyzStudio.Windows.TileForms.TileContainer();
|
||||
panel.Title = item.Title;
|
||||
panel.IsOpen = item.IsExpanded;
|
||||
panel.TitleContextMenuStrip = tileContainerMenu1;
|
||||
panel.AutoSizeHeight = true;
|
||||
panel.Tag = item;
|
||||
|
||||
panel.AutoSize(item.GridSize.Width, item.GridSize.Height);
|
||||
|
||||
UIControl.Add(flowLayoutPanel1, panel);
|
||||
|
||||
// Load tiles
|
||||
foreach (var item2 in item.Items ?? new List<TileModel>())
|
||||
{
|
||||
var tile = new FizzyLauncher.Windows.Forms.TilePanel();
|
||||
tile.LoadInfo(item2);
|
||||
|
||||
panel.Add(tile, item2.Position.X, item2.Position.Y);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
await AddTileGroups(item);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user