Renamed rows to sections

Added prompt before removing tiles and sections
Added bottom padding
Fixed add/remove row/section
Changed section title font colour
Changed default new tile/folder/section name
This commit is contained in:
Ray 2025-11-23 18:53:11 +00:00
parent 487d40df9c
commit 1adc4c1311
10 changed files with 232 additions and 537 deletions

View File

@ -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()
{

View File

@ -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
View File

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

View File

@ -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);
}
@ -304,7 +326,7 @@ namespace RokettoLaunch
/// <param name="e"></param>
private async void addGroupToolStripMenuItem_Click(object sender, EventArgs e)
{
await AddNewTileGroup();
await AddNewSection();
}
@ -353,7 +375,7 @@ namespace RokettoLaunch
{
this.CurrentSession = form.Result;
InvalidateOptions();
InvalidateOptions(false);
}
}
@ -411,83 +433,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)
@ -589,12 +578,7 @@ namespace RokettoLaunch
private async Task<bool> fileSessionManager_OnClearSession(FileSessionManager sender)
{
await Task.Run(() =>
{
UIControl.Clear(flowLayoutPanel1);
});
return true;
return await fileSessionManager_OnNewSession(sender);
}
private async Task fileSessionManager_OnFilenameChanged(FileSessionManager sender, string filename)
@ -728,8 +712,9 @@ namespace RokettoLaunch
try
{
var newModel = JsonSerializer.Deserialize<TileGroupModel>(JsonSerializer.Serialize(model));
newModel.Title = (string.IsNullOrWhiteSpace(newModel.Title) ? "New Section" : newModel.Title?.Trim()) + " (Copy)";
await AddTileGroups(newModel);
await AddSection(newModel);
}
catch (Exception)
{
@ -741,37 +726,35 @@ namespace RokettoLaunch
/// <summary>
/// Row - Add Row
/// Section - Add Section
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void addRowToolStripMenuItem_Click(object sender, EventArgs e)
private async 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;
await AddNewSection();
}
/// <summary>
/// Row - Remove Row
/// Section - Remove Section
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void removeRowToolStripMenuItem_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>((ToolStripDropDownItem)sender);
if (container == null)
{
return;
}
container.RemoveRow();
container?.Parent.Controls?.Remove(container);
_fileSessionManager.HasChanged = true;
}
@ -929,6 +912,7 @@ namespace RokettoLaunch
try
{
newModel = JsonSerializer.Deserialize<TileModel>(JsonSerializer.Serialize(tile.ModelInfo));
newModel.Title = (string.IsNullOrWhiteSpace(newModel.Title) ? "New Tile" : newModel.Title?.Trim()) + " (Copy)";
}
catch (Exception)
{
@ -953,6 +937,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,19 +963,19 @@ 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)
private async Task AddSection(TileGroupModel model)
{
await Task.Run(() =>
{
@ -993,12 +983,15 @@ namespace RokettoLaunch
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;
UIControl.Add(flowLayoutPanel1, panel);
@ -1015,30 +1008,22 @@ namespace RokettoLaunch
});
}
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;
private async Task LoadTileGroups(List<TileGroupModel> groupList)
{
UIControl.Clear(flowLayoutPanel1);
foreach (var item in groupList ?? new List<TileGroupModel>())
{
await AddTileGroups(item);
}
UIControl.SetClientWidth(this, width + padding);
}
}

View File

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

View File

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

View File

@ -239,8 +239,6 @@ namespace RokettoLaunch
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";
@ -297,8 +295,6 @@ namespace RokettoLaunch
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";

View File

@ -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" />
<ProjectReference Include="..\ryzstudio8\core\RyzStudio.csproj" />
<ProjectReference Include="..\ryzstudio8\windows.forms\RyzStudio.Windows.Forms.csproj" />
</ItemGroup>
<ItemGroup>
@ -89,7 +89,6 @@
<AutoGen>True</AutoGen>
<DependentUpon>AppResource.resx</DependentUpon>
</Compile>
<Compile Update="NewForm.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -5,6 +5,10 @@ VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RokettoLaunch", "RokettoLaunch.csproj", "{4833FB27-0817-4720-A54B-180369B0C374}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RyzStudio", "..\ryzstudio8\core\RyzStudio.csproj", "{BBB7657A-3CE7-4333-9DCE-3137973F538E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RyzStudio.Windows.Forms", "..\ryzstudio8\windows.forms\RyzStudio.Windows.Forms.csproj", "{EF73F363-4F93-5128-6F96-C797FA7CD94B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -15,6 +19,14 @@ Global
{4833FB27-0817-4720-A54B-180369B0C374}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4833FB27-0817-4720-A54B-180369B0C374}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4833FB27-0817-4720-A54B-180369B0C374}.Release|Any CPU.Build.0 = Release|Any CPU
{BBB7657A-3CE7-4333-9DCE-3137973F538E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBB7657A-3CE7-4333-9DCE-3137973F538E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBB7657A-3CE7-4333-9DCE-3137973F538E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBB7657A-3CE7-4333-9DCE-3137973F538E}.Release|Any CPU.Build.0 = Release|Any CPU
{EF73F363-4F93-5128-6F96-C797FA7CD94B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF73F363-4F93-5128-6F96-C797FA7CD94B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF73F363-4F93-5128-6F96-C797FA7CD94B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF73F363-4F93-5128-6F96-C797FA7CD94B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE