Fixed: layout sometimes doesn't load

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

No files matched your search

+1 -1
View File
@@ -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));
}
+14 -11
View File
@@ -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<Item> items = new List<Item>();
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));