Fixed: layout sometimes doesn't load

This commit is contained in:
Ray 2020-05-20 21:29:51 +01:00
parent 30149df2a4
commit eff57558ca
4 changed files with 30 additions and 15 deletions

View File

@ -431,6 +431,18 @@ namespace AppLauncher
// //
ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop); ThreadControl.SetTopMost(this, this.CurrentSession.AlwaysOnTop);
ThreadControl.SetVisible(this, true); ThreadControl.SetVisible(this, true);
if (this.InvokeRequired)
{
this.Invoke(new MethodInvoker(() => {
this.Focus();
}));
}
else
{
this.Focus();
}
}); });
} }

View File

@ -5,11 +5,11 @@ using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following // General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information // set of attributes. Change these attribute values to modify the information
// associated with an assembly. // associated with an assembly.
[assembly: AssemblyTitle("Fizzy App Launcher")] [assembly: AssemblyTitle("Fizzy Launcher")]
[assembly: AssemblyDescription("Application and shortcut launcher")] [assembly: AssemblyDescription("Application and shortcut launcher")]
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Hi, I'm Ray")] [assembly: AssemblyCompany("Hi, I'm Ray")]
[assembly: AssemblyProduct("Fizzy App Launcher")] [assembly: AssemblyProduct("Fizzy Launcher")]
[assembly: AssemblyCopyright("Copyright © Ray Lam 2020")] [assembly: AssemblyCopyright("Copyright © Ray Lam 2020")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [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 // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.1.1.94")] [assembly: AssemblyVersion("0.1.1.064")]
[assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -149,7 +149,7 @@ namespace AppLauncher.Windows.Forms
g.DrawImageUnscaled(Properties.Resources.app_icon_24, 17, 17); 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));
} }

View File

@ -27,7 +27,7 @@ namespace AppLauncher.Windows.Forms
protected readonly int collapseIncrement = 6; protected readonly int collapseIncrement = 6;
protected readonly int expandIncrement = 8; protected readonly int expandIncrement = 8;
protected TileGroupModel groupInfo = null; protected TileGroupModel groupModel = null;
protected List<Item> items = new List<Item>(); protected List<Item> items = new List<Item>();
protected int collapseHeight = 0; 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); 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) protected override async void OnResize(EventArgs e)
@ -224,10 +224,10 @@ namespace AppLauncher.Windows.Forms
{ {
TileGroupModel rs = new TileGroupModel() TileGroupModel rs = new TileGroupModel()
{ {
Title = groupInfo.Title, Title = groupModel.Title,
GridSize = new Size(this.GridSize.X, this.GridSize.Y), GridSize = new Size(this.GridSize.X, this.GridSize.Y),
IsExpanded = isChecked, IsExpanded = isChecked,
IsExclusive = groupInfo.IsExclusive, IsExclusive = groupModel.IsExclusive,
Items = this.Tiles 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 EditGroup() => EditGroupForm.ShowDialog(this);
public void LoadModel(TileGroupModel model) 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.LoadTiles(model.Items);
this.SetGridSize(groupModel.GridSize.Width, groupModel.GridSize.Height);
this.Invalidate(); this.Invalidate();
} }
public void UpdateModel(TileGroupModel model) public void UpdateModel(TileGroupModel model)
{ {
groupInfo = model; groupModel = model;
isChecked = groupInfo.IsExpanded; isChecked = groupModel.IsExpanded;
this.Invalidate(); this.Invalidate();
} }
@ -581,7 +582,9 @@ namespace AppLauncher.Windows.Forms
expandedHeight = (this.TileSize * height) + labelHeight; 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)); protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));