diff --git a/AppResource.Designer.cs b/AppResource.Designer.cs
index 35848c8..9fa888a 100644
--- a/AppResource.Designer.cs
+++ b/AppResource.Designer.cs
@@ -19,7 +19,7 @@ namespace RokettoLaunch {
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class AppResource {
@@ -106,6 +106,26 @@ namespace RokettoLaunch {
}
}
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap folder_minus {
+ get {
+ object obj = ResourceManager.GetObject("folder_minus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap help_circle {
+ get {
+ object obj = ResourceManager.GetObject("help_circle", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// Looks up a localized resource of type System.Drawing.Bitmap.
///
@@ -115,5 +135,45 @@ namespace RokettoLaunch {
return ((System.Drawing.Bitmap)(obj));
}
}
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap plus {
+ get {
+ object obj = ResourceManager.GetObject("plus", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap save {
+ get {
+ object obj = ResourceManager.GetObject("save", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap settings {
+ get {
+ object obj = ResourceManager.GetObject("settings", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Looks up a localized resource of type System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap trash_2 {
+ get {
+ object obj = ResourceManager.GetObject("trash_2", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
}
}
diff --git a/AppResource.resx b/AppResource.resx
index ead4e1e..6ea4339 100644
--- a/AppResource.resx
+++ b/AppResource.resx
@@ -133,7 +133,25 @@
Resources\folder_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Resources\MainMenu\folder-minus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\MainMenu\help-circle.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
Resources\icon-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+ Resources\MainMenu\plus.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\MainMenu\save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\MainMenu\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ Resources\MainMenu\trash-2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index ca14b99..72e4028 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -35,7 +35,7 @@ namespace RokettoLaunch
saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
notifyIcon1 = new System.Windows.Forms.NotifyIcon(components);
- contextMenuStrip2 = new System.Windows.Forms.ContextMenuStrip(components);
+ trayMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
exitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
menuStrip1 = new System.Windows.Forms.MenuStrip();
fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -59,7 +59,7 @@ namespace RokettoLaunch
viewHelpToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem16 = new System.Windows.Forms.ToolStripSeparator();
aboutToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- tileContainerMenu1 = new System.Windows.Forms.ContextMenuStrip(components);
+ groupMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
addGroupToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem4 = new System.Windows.Forms.ToolStripMenuItem();
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -74,16 +74,16 @@ namespace RokettoLaunch
removeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
panel1 = new System.Windows.Forms.Panel();
- tileMenu1 = new System.Windows.Forms.ContextMenuStrip(components);
+ tileMenuStrip = new System.Windows.Forms.ContextMenuStrip(components);
editToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
toolStripMenuItem6 = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
removeToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
- contextMenuStrip2.SuspendLayout();
+ trayMenuStrip.SuspendLayout();
menuStrip1.SuspendLayout();
- tileContainerMenu1.SuspendLayout();
+ groupMenuStrip.SuspendLayout();
panel1.SuspendLayout();
- tileMenu1.SuspendLayout();
+ tileMenuStrip.SuspendLayout();
SuspendLayout();
//
// saveFileDialog1
@@ -98,17 +98,17 @@ namespace RokettoLaunch
//
// notifyIcon1
//
- notifyIcon1.ContextMenuStrip = contextMenuStrip2;
+ notifyIcon1.ContextMenuStrip = trayMenuStrip;
notifyIcon1.Icon = (System.Drawing.Icon)resources.GetObject("notifyIcon1.Icon");
notifyIcon1.Text = "notifyIcon1";
notifyIcon1.Visible = true;
notifyIcon1.MouseClick += NotifyIcon_MouseClick;
//
- // contextMenuStrip2
+ // trayMenuStrip
//
- contextMenuStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { exitToolStripMenuItem1 });
- contextMenuStrip2.Name = "contextMenuStrip2";
- contextMenuStrip2.Size = new System.Drawing.Size(94, 26);
+ trayMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { exitToolStripMenuItem1 });
+ trayMenuStrip.Name = "contextMenuStrip2";
+ trayMenuStrip.Size = new System.Drawing.Size(94, 26);
//
// exitToolStripMenuItem1
//
@@ -122,7 +122,7 @@ namespace RokettoLaunch
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, toolStripMenuItem1, viewToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem1 });
menuStrip1.Location = new System.Drawing.Point(0, 0);
menuStrip1.Name = "menuStrip1";
- menuStrip1.Size = new System.Drawing.Size(642, 24);
+ menuStrip1.Size = new System.Drawing.Size(464, 24);
menuStrip1.TabIndex = 2;
menuStrip1.MenuActivate += MainMenuStrip_MenuActivate;
//
@@ -144,7 +144,7 @@ namespace RokettoLaunch
//
// openToolStripMenuItem
//
- openToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ openToolStripMenuItem.Image = AppResource.folder_minus;
openToolStripMenuItem.Name = "openToolStripMenuItem";
openToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O;
openToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
@@ -170,7 +170,7 @@ namespace RokettoLaunch
//
// saveToolStripMenuItem
//
- saveToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ saveToolStripMenuItem.Image = AppResource.save;
saveToolStripMenuItem.Name = "saveToolStripMenuItem";
saveToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S;
saveToolStripMenuItem.Size = new System.Drawing.Size(146, 22);
@@ -205,8 +205,9 @@ namespace RokettoLaunch
//
// addGroupToolStripMenuItem
//
+ addGroupToolStripMenuItem.Image = AppResource.plus;
addGroupToolStripMenuItem.Name = "addGroupToolStripMenuItem";
- addGroupToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
+ addGroupToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
addGroupToolStripMenuItem.Text = "&Add Group";
addGroupToolStripMenuItem.Click += AddGroupToolStripMenuItem_Click;
//
@@ -220,14 +221,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;
//
@@ -240,7 +241,7 @@ namespace RokettoLaunch
//
// optionsToolStripMenuItem
//
- optionsToolStripMenuItem.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ optionsToolStripMenuItem.Image = AppResource.settings;
optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
optionsToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F12;
optionsToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
@@ -256,7 +257,7 @@ namespace RokettoLaunch
//
// viewHelpToolStripMenuItem1
//
- viewHelpToolStripMenuItem1.ImageScaling = System.Windows.Forms.ToolStripItemImageScaling.None;
+ viewHelpToolStripMenuItem1.Image = AppResource.help_circle;
viewHelpToolStripMenuItem1.Name = "viewHelpToolStripMenuItem1";
viewHelpToolStripMenuItem1.ShortcutKeys = System.Windows.Forms.Keys.F1;
viewHelpToolStripMenuItem1.Size = new System.Drawing.Size(146, 22);
@@ -275,14 +276,15 @@ namespace RokettoLaunch
aboutToolStripMenuItem1.Text = "&About";
aboutToolStripMenuItem1.Click += AboutToolStripMenuItem_Click;
//
- // tileContainerMenu1
+ // groupMenuStrip
//
- 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, 148);
+ groupMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { addGroupToolStripMenuItem1, toolStripMenuItem4, editToolStripMenuItem, toolStripMenuItem5, toolStripSeparator1, toolStripMenuItem3, toolStripSeparator3, removeToolStripMenuItem });
+ groupMenuStrip.Name = "tileContainerMenu1";
+ groupMenuStrip.Size = new System.Drawing.Size(133, 148);
//
// addGroupToolStripMenuItem1
//
+ addGroupToolStripMenuItem1.Image = AppResource.plus;
addGroupToolStripMenuItem1.Name = "addGroupToolStripMenuItem1";
addGroupToolStripMenuItem1.Size = new System.Drawing.Size(132, 22);
addGroupToolStripMenuItem1.Text = "&Add Tile";
@@ -356,6 +358,7 @@ namespace RokettoLaunch
//
// removeToolStripMenuItem
//
+ removeToolStripMenuItem.Image = AppResource.trash_2;
removeToolStripMenuItem.Name = "removeToolStripMenuItem";
removeToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
removeToolStripMenuItem.Text = "&Remove";
@@ -370,7 +373,7 @@ namespace RokettoLaunch
flowLayoutPanel1.Location = new System.Drawing.Point(10, 0);
flowLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
flowLayoutPanel1.Name = "flowLayoutPanel1";
- flowLayoutPanel1.Size = new System.Drawing.Size(632, 540);
+ flowLayoutPanel1.Size = new System.Drawing.Size(454, 257);
flowLayoutPanel1.TabIndex = 8;
flowLayoutPanel1.WrapContents = false;
//
@@ -383,38 +386,39 @@ namespace RokettoLaunch
panel1.Margin = new System.Windows.Forms.Padding(0);
panel1.Name = "panel1";
panel1.Padding = new System.Windows.Forms.Padding(10, 0, 0, 0);
- panel1.Size = new System.Drawing.Size(642, 540);
+ panel1.Size = new System.Drawing.Size(464, 257);
panel1.TabIndex = 9;
//
- // tileMenu1
+ // tileMenuStrip
//
- tileMenu1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { editToolStripMenuItem1, toolStripMenuItem6, toolStripSeparator4, removeToolStripMenuItem1 });
- tileMenu1.Name = "tileMenu1";
- tileMenu1.Size = new System.Drawing.Size(127, 76);
+ tileMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { editToolStripMenuItem1, toolStripMenuItem6, toolStripSeparator4, removeToolStripMenuItem1 });
+ tileMenuStrip.Name = "tileMenu1";
+ tileMenuStrip.Size = new System.Drawing.Size(127, 76);
//
// editToolStripMenuItem1
//
editToolStripMenuItem1.Name = "editToolStripMenuItem1";
- editToolStripMenuItem1.Size = new System.Drawing.Size(126, 22);
+ editToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
editToolStripMenuItem1.Text = "&Edit";
editToolStripMenuItem1.Click += EditTileToolStripMenuItem_Click;
//
// toolStripMenuItem6
//
toolStripMenuItem6.Name = "toolStripMenuItem6";
- toolStripMenuItem6.Size = new System.Drawing.Size(126, 22);
+ toolStripMenuItem6.Size = new System.Drawing.Size(180, 22);
toolStripMenuItem6.Text = "Copy To...";
toolStripMenuItem6.Click += CopyToTileToolStripMenuItem_Click;
//
// toolStripSeparator4
//
toolStripSeparator4.Name = "toolStripSeparator4";
- toolStripSeparator4.Size = new System.Drawing.Size(123, 6);
+ toolStripSeparator4.Size = new System.Drawing.Size(177, 6);
//
// removeToolStripMenuItem1
//
+ removeToolStripMenuItem1.Image = AppResource.trash_2;
removeToolStripMenuItem1.Name = "removeToolStripMenuItem1";
- removeToolStripMenuItem1.Size = new System.Drawing.Size(126, 22);
+ removeToolStripMenuItem1.Size = new System.Drawing.Size(180, 22);
removeToolStripMenuItem1.Text = "&Remove";
removeToolStripMenuItem1.Click += RemoveTileToolStripMenuItem_Click;
//
@@ -423,7 +427,7 @@ namespace RokettoLaunch
AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.White;
BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
- ClientSize = new System.Drawing.Size(642, 564);
+ ClientSize = new System.Drawing.Size(464, 281);
Controls.Add(panel1);
Controls.Add(menuStrip1);
DoubleBuffered = true;
@@ -434,12 +438,12 @@ namespace RokettoLaunch
MinimizeBox = false;
MinimumSize = new System.Drawing.Size(300, 320);
Name = "MainForm";
- contextMenuStrip2.ResumeLayout(false);
+ trayMenuStrip.ResumeLayout(false);
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
- tileContainerMenu1.ResumeLayout(false);
+ groupMenuStrip.ResumeLayout(false);
panel1.ResumeLayout(false);
- tileMenu1.ResumeLayout(false);
+ tileMenuStrip.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
}
@@ -448,7 +452,7 @@ namespace RokettoLaunch
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.NotifyIcon notifyIcon1;
- private System.Windows.Forms.ContextMenuStrip contextMenuStrip2;
+ private System.Windows.Forms.ContextMenuStrip trayMenuStrip;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem1;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
@@ -472,7 +476,7 @@ namespace RokettoLaunch
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem addGroupToolStripMenuItem;
- private System.Windows.Forms.ContextMenuStrip tileContainerMenu1;
+ private System.Windows.Forms.ContextMenuStrip groupMenuStrip;
private System.Windows.Forms.ToolStripMenuItem addGroupToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem;
@@ -487,7 +491,7 @@ namespace RokettoLaunch
private System.Windows.Forms.ToolStripMenuItem bottomToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem5;
- private System.Windows.Forms.ContextMenuStrip tileMenu1;
+ private System.Windows.Forms.ContextMenuStrip tileMenuStrip;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem removeToolStripMenuItem1;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem6;
diff --git a/MainForm.cs b/MainForm.cs
index 1d9135c..ed29e5d 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -13,14 +13,15 @@ using RyzStudio;
using RyzStudio.Windows.Forms;
using RyzStudio.Windows.ThemedForms;
using RyzStudio.Windows.ThemedForms.ButtonTextBox;
+using RyzStudio.Windows.TileForms;
namespace RokettoLaunch
{
public partial class MainForm : Form
{
- private const int MIN_COLUMNS = 4;
- private const int TILE_SIZE = 70;
- private const int TILE_PADDING = 3;
+ //private const int MIN_COLUMNS = 4;
+ //private const int TILE_SIZE = 70;
+ //private const int TILE_PADDING = 3;
private readonly IServiceProvider _provider;
private readonly IFileSessionManager _fileSessionManager;
@@ -42,12 +43,6 @@ namespace RokettoLaunch
//flowLayoutPanel1.BackColor = Color.LightGreen;
//#endif
- newToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.Icon.Small.GetImage("a");
- openToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.Icon.Small.GetImage("b");
- saveToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.Icon.Small.GetImage("c");
- optionsToolStripMenuItem.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.Icon.Small.GetImage("i");
- viewHelpToolStripMenuItem1.Image = RyzStudio.Windows.ThemedForms.DefaultVisualStyle.Icon.Small.GetImage("j");
-
notifyIcon1.Text = Application.ProductName;
}
@@ -161,6 +156,11 @@ namespace RokettoLaunch
UIControl.SetLocation(this, this.CurrentSession.StartPosition);
}
+ if (this.CurrentSession.Width > 0)
+ {
+ UIControl.SetClientWidth(this, this.CurrentSession.Width);
+ }
+
if (this.CurrentSession.Height > 0)
{
UIControl.SetClientHeight(this, this.CurrentSession.Height);
@@ -184,8 +184,6 @@ namespace RokettoLaunch
}
#endif
- //AutoResizeWidth();
-
UIControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
}
@@ -305,14 +303,12 @@ namespace RokettoLaunch
///
private async void AddGroupToolStripMenuItem_Click(object sender, EventArgs e)
{
- var maxColumn = Math.Max(MIN_COLUMNS, this.CurrentSession.TilesPerRow);
-
var group = new App4Options.Group()
{
Id = Guid.NewGuid(),
Title = "New Group",
IsOpen = true,
- GridSize = new Size(maxColumn, 1)
+ GridSize = new Size(this.CurrentSession.TilesPerRow, 1)
};
this.CurrentSession.Groups.Add(group);
@@ -431,7 +427,7 @@ namespace RokettoLaunch
private async Task fileSessionManager_OnNewSession(FileSessionManager sender)
{
// Enforce minimum number of rows
- this.CurrentSession.TilesPerRow = Math.Max(this.CurrentSession.TilesPerRow, MIN_COLUMNS);
+ this.CurrentSession.TilesPerRow = Math.Max(this.CurrentSession.TilesPerRow, TileLayoutPanel.MIN_COLUMNS);
UIControl.Clear(flowLayoutPanel1);
@@ -461,11 +457,11 @@ namespace RokettoLaunch
foreach (var group in this.CurrentSession.Groups ?? new List())
{
var gridSize = group.GetMaxGridSize();
- gridSize.Width = Math.Max(gridSize.Width, MIN_COLUMNS);
+ gridSize.Width = Math.Max(gridSize.Width, TileLayoutPanel.MIN_COLUMNS);
group.GridSize = new Size(gridSize.Width, gridSize.Height);
- AddGroup(group);
+ this.AddGroup(group);
}
});
@@ -496,6 +492,7 @@ namespace RokettoLaunch
}
this.CurrentSession.StartPosition = this.Location;
+ this.CurrentSession.Width = this.DisplayRectangle.Width;
this.CurrentSession.Height = this.DisplayRectangle.Height;
var result = GenericResult.Create();
@@ -608,7 +605,14 @@ namespace RokettoLaunch
Position = new Point(-1, -1)
};
- this.AddTile((TableLayoutPanel)panel.ToggleControl, groupInfo.Id, newTileInfo);
+ newTileInfo = groupInfo.AddItem(newTileInfo);
+
+ // Update table layout
+ var newTilePanel = CreateTile(newTileInfo);
+
+ var tableLayout = (TileLayoutPanel)panel.ToggleControl;
+ tableLayout.AddTilePanel(newTilePanel, newTileInfo.Position.X, newTileInfo.Position.Y);
+ tableLayout.SetGridSize(groupInfo.GridSize);
_fileSessionManager.HasChanged = true;
}
@@ -645,7 +649,14 @@ namespace RokettoLaunch
Position = new Point(-1, -1)
};
- this.AddTile((TableLayoutPanel)panel.ToggleControl, groupInfo.Id, newTileInfo);
+ newTileInfo = groupInfo.AddItem(newTileInfo);
+
+ // Update table layout
+ var newTilePanel = CreateTile(newTileInfo);
+
+ var tableLayout = (TileLayoutPanel)panel.ToggleControl;
+ tableLayout.AddTilePanel(newTilePanel, newTileInfo.Position.X, newTileInfo.Position.Y);
+ tableLayout.SetGridSize(groupInfo.GridSize);
_fileSessionManager.HasChanged = true;
}
@@ -926,33 +937,14 @@ namespace RokettoLaunch
return;
}
+ App4Options.Item resultTileInfo = null;
+
if (tileInfo.IsGroup)
{
var editFolderForm = new EditFolderForm(tileInfo);
if (editFolderForm.ShowDialog() == DialogResult.OK)
{
- var newTileInfo = editFolderForm.Result;
-
- var result = this.CurrentSession.Update(newTileInfo);
- if (result)
- {
- var updatedTileInfo = this.CurrentSession.FindById(tileInfo.Id);
-
- tilePanel.Title = updatedTileInfo.Title;
-
- if (tilePanel.TileContextMenu == null)
- {
- tilePanel.TileContextMenu = new ContextMenuStrip();
- }
-
- this.UpdateContextMenu(tilePanel.TileContextMenu, updatedTileInfo.Items);
-
- _fileSessionManager.HasChanged = true;
- }
- else
- {
- MessageBox.Show(this, "Unable to update tile", "Edit Tile", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ resultTileInfo = editFolderForm.Result;
}
}
else
@@ -960,25 +952,21 @@ namespace RokettoLaunch
var editForm = new EditTileForm(tileInfo);
if (editForm.ShowDialog() == DialogResult.OK)
{
- var newTileInfo = editForm.Result;
- newTileInfo.ResolvePaths();
-
- var result = this.CurrentSession.Update(newTileInfo);
- if (result)
- {
- var updatedTileInfo = this.CurrentSession.FindById(tileInfo.Id);
-
- tilePanel.Title = updatedTileInfo.Title;
- tilePanel.LargeIcon = RyzStudio.IO.File.GetIcon(updatedTileInfo.ResolvedTargetPath);
-
- _fileSessionManager.HasChanged = true;
- }
- else
- {
- MessageBox.Show(this, "Unable to update tile", "Edit Tile", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
+ resultTileInfo = editForm.Result;
}
}
+
+ if (resultTileInfo == null)
+ {
+ return;
+ }
+
+ var updatedTileInfo = this.CurrentSession.FindById(tileInfo.Id);
+ updatedTileInfo.Load(resultTileInfo);
+
+ this.UpdateTile(tilePanel, updatedTileInfo);
+
+ _fileSessionManager.HasChanged = true;
}
///
@@ -1012,7 +1000,15 @@ namespace RokettoLaunch
{
if (n >= 0 && n <= (headers.Count - 1))
{
- this.AddTile((TableLayoutPanel)headers[n].ToggleControl, this.CurrentSession.Groups[n].Id, newTileInfo);
+ // Add to group
+ newTileInfo = this.CurrentSession.Groups[n].AddItem(newTileInfo);
+
+ // Update table layout
+ var newTilePanel = CreateTile(newTileInfo);
+
+ var tableLayout = (TileLayoutPanel)headers[n].ToggleControl;
+ tableLayout.AddTilePanel(newTilePanel, newTileInfo.Position.X, newTileInfo.Position.Y);
+ tableLayout.SetGridSize(this.CurrentSession.Groups[n].GridSize);
}
}
@@ -1059,68 +1055,28 @@ namespace RokettoLaunch
#endregion
- private void AddGroup(App4Options.Group group)
+ private void AddGroup(App4Options.Group groupInfo)
{
- var table = CreateTable(group.GridSize);
+ var tableLayout = CreateTable(groupInfo.GridSize);
- var header = CreateHeader(group);
- header.ToggleControlId = group.Id;
- header.ToggleControl = table;
+ var header = CreateHeader(groupInfo);
+ header.ToggleControlId = groupInfo.Id;
+ header.ToggleControl = tableLayout;
UIControl.Add(flowLayoutPanel1, header);
- UIControl.Add(flowLayoutPanel1, table);
+ UIControl.Add(flowLayoutPanel1, tableLayout);
- foreach (var item in group.Items ?? new List())
+ foreach (var item in groupInfo.Items ?? new List())
{
- AddTile(table, item);
+ var tilePanel = CreateTile(item);
+
+ tableLayout.AddTilePanel(tilePanel, item.Position.X, item.Position.Y);
}
+
+ tableLayout.SetGridSize(groupInfo.GridSize);
}
- private void AddTile(TableLayoutPanel table, App4Options.Item item)
- {
- var icon = (item.IsGroup ? null : RyzStudio.IO.File.GetIcon(item.ResolvedTargetPath));
- var tile = CreateTile(item.Id, item.Title, item.IsGroup, icon);
-
- if (item.IsGroup)
- {
- tile.TileContextMenu = new ContextMenuStrip();
-
- this.UpdateContextMenu(tile.TileContextMenu, item.Items);
- }
-
- UIControl.Add(table, tile, item.Position.X, item.Position.Y);
- }
-
- private void AddTile(TableLayoutPanel table, Guid groupId, App4Options.Item item)
- {
- var groupInfo = this.CurrentSession.Groups.Where(x => x.Id == groupId).FirstOrDefault();
- if (groupInfo == null)
- {
- return;
- }
-
- var canPosition = groupInfo.CanPosition(item);
- if (!canPosition)
- {
- // Find next available position
- item.Position = groupInfo.GetNextPosition();
- }
-
- // Resize-expand table
- if ((item.Position.Y + 1) > groupInfo.GridSize.Height)
- {
- groupInfo.GridSize = new Size(groupInfo.GridSize.Width, (item.Position.Y + 1));
-
- this.UpdateTable(table, groupInfo.GridSize);
- }
-
- // Add tile
- groupInfo.Items.Add(item);
-
- this.AddTile(table, item);
- }
-
- private void AddToTile(App4Options.Item item, List paths, bool appendTo = true)
+ private void AddToFolder(App4Options.Item item, List paths, bool appendTo = true)
{
item.IsGroup = true;
@@ -1145,47 +1101,44 @@ namespace RokettoLaunch
}
}
- private TableLayoutPanel CreateTable(Size gridSize)
+ private TileLayoutPanel CreateTable(Size gridSize)
{
- var result = new TableLayoutPanel();
- result.Margin = new Padding(0);
- result.Padding = new Padding(0);
- result.ColumnCount = 0;
- result.RowCount = 0;
+ var layoutPanel = new TileLayoutPanel();
+ layoutPanel.SetGridSize(gridSize);
- return this.UpdateTable(result, gridSize);
+ return layoutPanel;
}
private TToggleHeaderPanel CreateHeader(App4Options.Group group)
{
- var result = new TToggleHeaderPanel();
- result.ContextMenuStrip = tileContainerMenu1;
- result.Height = 20;
- result.Padding = new Padding(0, 0, 0, 0);
- result.Title = group.Title;
- result.IsOpen = group.IsOpen;
+ var width = (TileLayoutPanel.TILE_SIZE + TileLayoutPanel.TILE_PADDING);
- return result;
+ var headerPanel = new TToggleHeaderPanel();
+ headerPanel.ContextMenuStrip = groupMenuStrip;
+ headerPanel.Height = 20;
+ headerPanel.Padding = new Padding(0, 0, 0, 0);
+ headerPanel.Width = (group.GridSize.Width * width);
+ headerPanel.Title = group.Title;
+ headerPanel.IsOpen = group.IsOpen;
+
+ return headerPanel;
}
- private TilePanel CreateTile(Guid id, string title, bool isGroup, Image icon = null)
+ private TilePanel CreateTile(App4Options.Item item)
{
- var result = new TilePanel();
- result.ContextMenuStrip = tileMenu1;
- result.Dock = DockStyle.Fill;
- result.Margin = new Padding(0, 0, 3, 3);
- result.Padding = new Padding(0);
+ var tilePanel = new TilePanel();
+ tilePanel.ContextMenuStrip = tileMenuStrip;
+ tilePanel.Dock = DockStyle.Fill;
+ tilePanel.Margin = new Padding(0, 0, 3, 3);
+ tilePanel.Padding = new Padding(0);
- result.TileId = id;
- result.Title = title;
- result.IsGroup = isGroup;
- result.LargeIcon = (isGroup ? AppResource.folder_32 : icon);
+ tilePanel.MouseClick += TilePanel_MouseClick;
+ tilePanel.MouseDoubleClick += TilePanel_MouseClick;
+ tilePanel.OnFileDrop += TilePanel_OnFileDrop;
- result.MouseClick += TilePanel_MouseClick;
- result.MouseDoubleClick += TilePanel_MouseClick;
- result.OnFileDrop += TilePanel_OnFileDrop;
+ this.UpdateTile(tilePanel, item);
- return result;
+ return tilePanel;
}
private App4Options.Item GetTileInfo(object sender)
@@ -1221,11 +1174,31 @@ namespace RokettoLaunch
return result;
}
+ private void UpdateTile(TilePanel tilePanel, App4Options.Item item)
+ {
+ tilePanel.TileId = item.Id;
+ tilePanel.Title = item.Title;
+ tilePanel.IsGroup = item.IsGroup;
+
+ if (item.IsGroup)
+ {
+ var iconSize = this.CurrentSession.ShowBigIcons ? 24 : 16;
+
+ tilePanel.LargeIcon = AppResource.folder_32;
+ tilePanel.TileContextMenu = new ContextMenuStrip();
+ tilePanel.TileContextMenu!.ImageScalingSize = new Size(iconSize, iconSize);
+
+ this.UpdateContextMenu(tilePanel.TileContextMenu, item.Items);
+ }
+ else
+ {
+ tilePanel.LargeIcon = RyzStudio.IO.File.GetIcon(item.ResolvedTargetPath);
+ tilePanel.TileContextMenu = null;
+ }
+ }
+
private ContextMenuStrip UpdateContextMenu(ContextMenuStrip contextMenu, List items)
{
- var iconSize = this.CurrentSession.ShowBigIcons ? 24 : 16;
-
- contextMenu.ImageScalingSize = new Size(iconSize, iconSize);
contextMenu.Items.Clear();
foreach (var item in items ?? new List())
@@ -1244,45 +1217,6 @@ namespace RokettoLaunch
return contextMenu;
}
- private TableLayoutPanel UpdateTable(TableLayoutPanel result, Size gridSize)
- {
- var addColumns = gridSize.Width - result.ColumnCount;
- var addRows = gridSize.Height - result.RowCount;
- var width = (TILE_SIZE + TILE_PADDING);
-
- UIControl.Invoke(result, (x) =>
- {
- result.ColumnCount = gridSize.Width;
- result.RowCount = gridSize.Height;
- result.Height = (gridSize.Height * width) + TILE_PADDING;
- result.Width = (gridSize.Width * width);
-
- foreach (ColumnStyle column in result.ColumnStyles)
- {
- column.SizeType = SizeType.Absolute;
- column.Width = width;
- }
-
- foreach (RowStyle row in result.RowStyles)
- {
- row.SizeType = SizeType.Absolute;
- row.Height = width;
- }
-
- for (var i = 0; i < addColumns; i++)
- {
- result.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, width));
- }
-
- for (var i = 0; i < addRows; i++)
- {
- result.RowStyles.Add(new RowStyle(SizeType.Absolute, width));
- }
- });
-
- return result;
- }
-
private void TilePanel_MouseClick(object sender, MouseEventArgs e)
{
var tilePanel = (sender as TilePanel);
@@ -1323,81 +1257,72 @@ namespace RokettoLaunch
private async Task TilePanel_OnFileDrop(TilePanel sender, Keys keys, List paths)
{
- var tileInfo = this.CurrentSession.FindById(sender.TileId);
-
- // Append
- if (keys.HasFlag(Keys.Shift))
+ await Task.Run(() =>
{
- if (tileInfo.IsGroup)
+ var tileInfo = this.CurrentSession.FindById(sender.TileId);
+
+ // Append
+ if (keys.HasFlag(Keys.Shift))
{
- this.AddToTile(tileInfo, paths, true);
+ if (tileInfo.IsGroup)
+ {
+ this.AddToFolder(tileInfo, paths, true);
+ }
+ else
+ {
+ var newTileInfo = tileInfo.CopyOf();
+
+ tileInfo.Title = "New Folder";
+ tileInfo.IsGroup = true;
+ tileInfo.TargetPath = string.Empty;
+ tileInfo.StartPath = string.Empty;
+ tileInfo.Argument = string.Empty;
+ tileInfo.RunAsAdmin = false;
+
+ tileInfo.Items.Clear();
+ tileInfo.Items.Add(newTileInfo);
+
+ this.AddToFolder(tileInfo, paths, true);
+
+ tileInfo.ResolvePaths();
+ }
}
else
{
- var newTileInfo = tileInfo.CopyOf();
+ if (paths.Count <= 1)
+ {
+ tileInfo.IsGroup = false;
+ tileInfo.TargetPath = paths[0];
+ tileInfo.StartPath = string.Empty;
+ tileInfo.Argument = string.Empty;
+ tileInfo.RunAsAdmin = false;
- tileInfo.Title = "New Folder";
- tileInfo.IsGroup = true;
- tileInfo.TargetPath = string.Empty;
- tileInfo.StartPath = string.Empty;
- tileInfo.Argument = string.Empty;
- tileInfo.RunAsAdmin = false;
+ tileInfo.Items.Clear();
+ tileInfo.ResolvePaths();
- tileInfo.Items.Clear();
- tileInfo.Items.Add(newTileInfo);
+ tileInfo.Title = RyzStudio.IO.File.GetName(tileInfo.ResolvedTargetPath);
+ }
+ else
+ {
+ tileInfo.Title = "New Folder";
+ tileInfo.IsGroup = true;
+ tileInfo.TargetPath = string.Empty;
+ tileInfo.StartPath = string.Empty;
+ tileInfo.Argument = string.Empty;
+ tileInfo.RunAsAdmin = false;
- this.AddToTile(tileInfo, paths, true);
+ tileInfo.Items.Clear();
- tileInfo.ResolvePaths();
+ this.AddToFolder(tileInfo, paths, false);
+
+ tileInfo.ResolvePaths();
+ }
}
- }
- else
- {
- if (paths.Count <= 1)
- {
- tileInfo.IsGroup = false;
- tileInfo.TargetPath = paths[0];
- tileInfo.StartPath = string.Empty;
- tileInfo.Argument = string.Empty;
- tileInfo.RunAsAdmin = false;
- tileInfo.Items.Clear();
- tileInfo.ResolvePaths();
+ this.UpdateTile(sender, tileInfo);
+ });
- tileInfo.Title = RyzStudio.IO.File.GetName(tileInfo.ResolvedTargetPath);
- }
- else
- {
- tileInfo.Title = "New Folder";
- tileInfo.IsGroup = true;
- tileInfo.TargetPath = string.Empty;
- tileInfo.StartPath = string.Empty;
- tileInfo.Argument = string.Empty;
- tileInfo.RunAsAdmin = false;
-
- tileInfo.Items.Clear();
-
- this.AddToTile(tileInfo, paths, false);
-
- tileInfo.ResolvePaths();
- }
- }
-
- sender.Title = tileInfo.Title;
- sender.IsGroup = tileInfo.IsGroup;
-
- if (tileInfo.IsGroup)
- {
- sender.LargeIcon = AppResource.folder_32;
- sender.TileContextMenu = new ContextMenuStrip();
-
- this.UpdateContextMenu(sender.TileContextMenu, tileInfo.Items);
- }
- else
- {
- sender.LargeIcon = RyzStudio.IO.File.GetIcon(tileInfo.ResolvedTargetPath);
- sender.TileContextMenu = null;
- }
+ _fileSessionManager.HasChanged = true;
}
private void Execute(App4Options.Item model)
diff --git a/MainForm.resx b/MainForm.resx
index c441c6c..c321215 100644
--- a/MainForm.resx
+++ b/MainForm.resx
@@ -126,7 +126,7 @@
448, 17
-
+
561, 17
@@ -428,12 +428,12 @@
- 716, 17
+ 46, 13
-
+
831, 17
-
+
990, 17
diff --git a/Models/SaveFile/App4Options.cs b/Models/SaveFile/App4Options.cs
index dc7fdcf..828719d 100644
--- a/Models/SaveFile/App4Options.cs
+++ b/Models/SaveFile/App4Options.cs
@@ -24,6 +24,30 @@ namespace RokettoLaunch.Models.SaveFile
public Size GridSize { get; set; } = new Size(0, 0);
+ public Item AddItem(Item item)
+ {
+ var canPosition = this.CanPosition(item);
+ if (!canPosition)
+ {
+ // Find next available position
+ item.Position = this.GetNextPosition();
+ }
+
+ // Resize-expand table
+ if ((item.Position.Y + 1) > this.GridSize.Height)
+ {
+ this.GridSize = new Size(this.GridSize.Width, (item.Position.Y + 1));
+
+ //this.UpdateTable(table, this.GridSize);
+ }
+
+ // Add item
+ this.Items.Add(item);
+
+ return item;
+ }
+
+
public Group CopyOf()
{
var json = JsonSerializer.Serialize(this);
@@ -213,6 +237,8 @@ namespace RokettoLaunch.Models.SaveFile
this.ResolvedTargetPath = model.ResolvedTargetPath;
this.ResolvedStartPath = model.ResolvedStartPath;
this.ResolvedArgument = model.ResolvedArgument;
+
+ this.ResolvePaths();
}
public void ResolvePaths()
@@ -303,18 +329,18 @@ namespace RokettoLaunch.Models.SaveFile
return null;
}
- public bool Update(Item value)
- {
- var result = this.FindById(value.Id);
- if (result == null)
- {
- return false;
- }
+ //public bool Update(Item value)
+ //{
+ // var result = this.FindById(value.Id);
+ // if (result == null)
+ // {
+ // return false;
+ // }
- result.Load(value);
+ // result.Load(value);
- return true;
- }
+ // return true;
+ //}
public bool Remove(Guid id)
{
diff --git a/Models/SaveFile/AppOptionsBase.cs b/Models/SaveFile/AppOptionsBase.cs
index c178f24..d07eb22 100644
--- a/Models/SaveFile/AppOptionsBase.cs
+++ b/Models/SaveFile/AppOptionsBase.cs
@@ -20,7 +20,8 @@ namespace RokettoLaunch.Models.SaveFile
public Point StartPosition { get; set; } = Point.Empty;
- public int Height { get; set; } = 280;
+ public int Width { get; set; } = 0;
+ public int Height { get; set; } = 320;
}
}
\ No newline at end of file
diff --git a/Resources/MainMenu/folder-minus.png b/Resources/MainMenu/folder-minus.png
new file mode 100644
index 0000000..655cfd8
Binary files /dev/null and b/Resources/MainMenu/folder-minus.png differ
diff --git a/Resources/MainMenu/folder-minus.svg b/Resources/MainMenu/folder-minus.svg
new file mode 100644
index 0000000..2d81d34
--- /dev/null
+++ b/Resources/MainMenu/folder-minus.svg
@@ -0,0 +1,54 @@
+
+
diff --git a/Resources/MainMenu/help-circle.png b/Resources/MainMenu/help-circle.png
new file mode 100644
index 0000000..fa87ded
Binary files /dev/null and b/Resources/MainMenu/help-circle.png differ
diff --git a/Resources/MainMenu/help-circle.svg b/Resources/MainMenu/help-circle.svg
new file mode 100644
index 0000000..88a6846
--- /dev/null
+++ b/Resources/MainMenu/help-circle.svg
@@ -0,0 +1,60 @@
+
+
diff --git a/Resources/MainMenu/plus.png b/Resources/MainMenu/plus.png
new file mode 100644
index 0000000..21c5be4
Binary files /dev/null and b/Resources/MainMenu/plus.png differ
diff --git a/Resources/MainMenu/plus.svg b/Resources/MainMenu/plus.svg
new file mode 100644
index 0000000..309770d
--- /dev/null
+++ b/Resources/MainMenu/plus.svg
@@ -0,0 +1,57 @@
+
+
diff --git a/Resources/MainMenu/save.png b/Resources/MainMenu/save.png
new file mode 100644
index 0000000..72dfc90
Binary files /dev/null and b/Resources/MainMenu/save.png differ
diff --git a/Resources/MainMenu/save.svg b/Resources/MainMenu/save.svg
new file mode 100644
index 0000000..19251ad
--- /dev/null
+++ b/Resources/MainMenu/save.svg
@@ -0,0 +1,55 @@
+
+
diff --git a/Resources/MainMenu/settings.png b/Resources/MainMenu/settings.png
new file mode 100644
index 0000000..e4e4b3a
Binary files /dev/null and b/Resources/MainMenu/settings.png differ
diff --git a/Resources/MainMenu/settings.svg b/Resources/MainMenu/settings.svg
new file mode 100644
index 0000000..bf8a9f0
--- /dev/null
+++ b/Resources/MainMenu/settings.svg
@@ -0,0 +1,53 @@
+
+
diff --git a/Resources/MainMenu/trash-2.png b/Resources/MainMenu/trash-2.png
new file mode 100644
index 0000000..f04f773
Binary files /dev/null and b/Resources/MainMenu/trash-2.png differ
diff --git a/Resources/MainMenu/trash-2.svg b/Resources/MainMenu/trash-2.svg
new file mode 100644
index 0000000..f4c5330
--- /dev/null
+++ b/Resources/MainMenu/trash-2.svg
@@ -0,0 +1,65 @@
+
+
diff --git a/Windows/Forms/TileLayoutPanel.cs b/Windows/Forms/TileLayoutPanel.cs
new file mode 100644
index 0000000..a0226b3
--- /dev/null
+++ b/Windows/Forms/TileLayoutPanel.cs
@@ -0,0 +1,115 @@
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+using RyzStudio.Windows.Forms;
+
+namespace RokettoLaunch.Windows.Forms
+{
+ public class TileLayoutPanel : System.Windows.Forms.TableLayoutPanel
+ {
+ public const int MIN_COLUMNS = 4;
+ public const int TILE_SIZE = 70;
+ public const int TILE_PADDING = 3;
+
+
+ public TileLayoutPanel() : base()
+ {
+ this.Margin = new Padding(0);
+ this.Padding = new Padding(0);
+ this.ColumnCount = 0;
+ this.RowCount = 0;
+ }
+
+ public void AddTilePanel(TilePanel tilePanel, int x, int y)
+ {
+ UIControl.Add(this, tilePanel, x, y);
+ }
+
+ public void SetGridSize(Size gridSize)
+ {
+ this.SetGridWidth(gridSize.Width);
+ this.SetGridHeight(gridSize.Height);
+ }
+
+ public void SetGridWidth(int width)
+ {
+ width = Math.Max(MIN_COLUMNS, width);
+
+ var diffColumns = width - this.ColumnCount;
+ var tileWidth = (TILE_SIZE + TILE_PADDING);
+
+ UIControl.Invoke(this, (x) =>
+ {
+ this.ColumnCount = width;
+ this.Width = (width * tileWidth);
+
+ // Resize columns
+ if (diffColumns == 0)
+ {
+ // Do nothing
+ }
+ else if (diffColumns > 0)
+ {
+ for (var i = 0; i < diffColumns; i++)
+ {
+ this.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, tileWidth));
+ }
+ }
+ else
+ {
+ for (var i = 0; i < (diffColumns * -1); i++)
+ {
+ this.ColumnStyles.RemoveAt((this.ColumnStyles.Count - 1));
+ }
+ }
+
+ // Update column width
+ foreach (ColumnStyle column in this.ColumnStyles)
+ {
+ column.SizeType = SizeType.Absolute;
+ column.Width = tileWidth;
+ }
+ });
+ }
+
+ public void SetGridHeight(int height)
+ {
+ var diffRows = height - this.RowCount;
+ var tileHeight = (TILE_SIZE + TILE_PADDING);
+
+ UIControl.Invoke(this, (x) =>
+ {
+ this.RowCount = height;
+ this.Height = (height * tileHeight) + TILE_PADDING;
+
+ // Resize rows
+ if (diffRows == 0)
+ {
+ // Do nothing
+ }
+ else if (diffRows > 0)
+ {
+ for (var i = 0; i < diffRows; i++)
+ {
+ this.RowStyles.Add(new RowStyle(SizeType.Absolute, tileHeight));
+ }
+ }
+ else
+ {
+ for (var i = 0; i < (diffRows * -1); i++)
+ {
+ this.RowStyles.RemoveAt((this.RowStyles.Count - 1));
+ }
+ }
+
+ // Update row height
+ foreach (RowStyle row in this.RowStyles)
+ {
+ row.SizeType = SizeType.Absolute;
+ row.Height = tileHeight;
+ }
+ });
+ }
+
+ }
+}