From eff57558caa725ea7613aa15e28b112697d53fa8 Mon Sep 17 00:00:00 2001 From: Ray Date: Wed, 20 May 2020 21:29:51 +0100 Subject: [PATCH] Fixed: layout sometimes doesn't load --- MainForm.cs | 12 ++++++++++++ Properties/AssemblyInfo.cs | 6 +++--- Windows/Forms/AForm.cs | 2 +- Windows/Forms/Tile/TTilePanelLayout.cs | 25 ++++++++++++++----------- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/MainForm.cs b/MainForm.cs index 2cd595e..7cc1988 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -431,6 +431,18 @@ namespace AppLauncher // ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop); ThreadControl.SetVisible(this, true); + + if (this.InvokeRequired) + { + this.Invoke(new MethodInvoker(() => { + this.Focus(); + })); + } + else + { + this.Focus(); + } + }); } diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index b454115..1308be5 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("Fizzy App Launcher")] +[assembly: AssemblyTitle("Fizzy Launcher")] [assembly: AssemblyDescription("Application and shortcut launcher")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Hi, I'm Ray")] -[assembly: AssemblyProduct("Fizzy App Launcher")] +[assembly: AssemblyProduct("Fizzy Launcher")] [assembly: AssemblyCopyright("Copyright © Ray Lam 2020")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.1.1.94")] +[assembly: AssemblyVersion("0.1.1.064")] [assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Windows/Forms/AForm.cs b/Windows/Forms/AForm.cs index db77cea..2980e7a 100644 --- a/Windows/Forms/AForm.cs +++ b/Windows/Forms/AForm.cs @@ -149,7 +149,7 @@ namespace AppLauncher.Windows.Forms g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17); - TextRenderer.DrawText(g, "Fizzy App Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); + TextRenderer.DrawText(g, "Fizzy Launcher", new Font(this.Font.FontFamily, 14F), new Point(58, 17), Color.FromArgb(156, 158, 171)); } diff --git a/Windows/Forms/Tile/TTilePanelLayout.cs b/Windows/Forms/Tile/TTilePanelLayout.cs index fdbdf78..5a2a515 100644 --- a/Windows/Forms/Tile/TTilePanelLayout.cs +++ b/Windows/Forms/Tile/TTilePanelLayout.cs @@ -27,7 +27,7 @@ namespace AppLauncher.Windows.Forms protected readonly int collapseIncrement = 6; protected readonly int expandIncrement = 8; - protected TileGroupModel groupInfo = null; + protected TileGroupModel groupModel = null; protected List items = new List(); protected int collapseHeight = 0; @@ -132,7 +132,7 @@ namespace AppLauncher.Windows.Forms g.DrawImageUnscaled((isChecked ? Properties.Resources.toggle_right_ea_16 : Properties.Resources.toggle_left_ea_16), 2, 2); - TextRenderer.DrawText(g, groupInfo?.Title, new Font(this.Font.FontFamily, 8.25F), new Point(25, 4), Color.FromArgb(99, 105, 119)); + TextRenderer.DrawText(g, groupModel?.Title, new Font(this.Font.FontFamily, 8.25F), new Point(25, 4), Color.FromArgb(99, 105, 119)); } protected override async void OnResize(EventArgs e) @@ -224,10 +224,10 @@ namespace AppLauncher.Windows.Forms { TileGroupModel rs = new TileGroupModel() { - Title = groupInfo.Title, + Title = groupModel.Title, GridSize = new Size(this.GridSize.X, this.GridSize.Y), IsExpanded = isChecked, - IsExclusive = groupInfo.IsExclusive, + IsExclusive = groupModel.IsExclusive, Items = this.Tiles }; @@ -409,26 +409,27 @@ namespace AppLauncher.Windows.Forms })); } - public void AddRow() =>this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1)); + public void AddRow() =>this.SetGridSize(groupModel.GridSize.Width, (groupModel.GridSize.Height + 1)); public void EditGroup() => EditGroupForm.ShowDialog(this); public void LoadModel(TileGroupModel model) { - groupInfo = model; + groupModel = model; - isChecked = groupInfo.IsExpanded; + isChecked = groupModel.IsExpanded; - this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height); + this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height); this.LoadTiles(model.Items); + this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height); this.Invalidate(); } public void UpdateModel(TileGroupModel model) { - groupInfo = model; - isChecked = groupInfo.IsExpanded; + groupModel = model; + isChecked = groupModel.IsExpanded; this.Invalidate(); } @@ -581,7 +582,9 @@ namespace AppLauncher.Windows.Forms expandedHeight = (this.TileSize * height) + labelHeight; - this.Size = new Size((this.TileSize * width), (isChecked ? this.ExpandedHeight : this.CollapseHeight)); + int w = (this.TileSize * gridSize.X); + + this.Size = new Size(w, (isChecked ? this.ExpandedHeight : this.CollapseHeight)); } protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));