Changed: session settings + layout panel init-size

This commit is contained in:
Ray committed 2020-05-17 19:52:37 +01:00
1 parent 3a2ee532c7
commit c49c9308c0
6 files changed
+93 -46

No files matched your search

+14 -35
View File
@@ -36,6 +36,7 @@ namespace AppLauncher.Windows.Forms
protected bool isAnimating = false;
protected bool isChecked = true;
protected Point lastMousePosition = new Point();
protected Point gridSize = new Point();
public TTilePanelLayout(TileGroupModel model) : base()
{
@@ -182,10 +183,11 @@ namespace AppLauncher.Windows.Forms
{
get
{
int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
int h = (int)Math.Floor(decimal.Divide(this.Height - labelHeight, this.TileSize));
//int w = (int)Math.Floor(decimal.Divide(this.Width, this.TileSize));
//int h = (int)Math.Floor(decimal.Divide(this.Height - labelHeight, this.TileSize));
return new Point(w, h);
//return new Point(w, h);
return gridSize;
}
}
@@ -308,20 +310,6 @@ namespace AppLauncher.Windows.Forms
});
}
public async Task CollapseNow()
{
await Task.Run(() =>
{
if (isAnimating) return;
isAnimating = true;
ThreadControl.SetHeight(this, this.CollapseHeight);
isAnimating = false;
});
}
public async Task Expand()
{
await Task.Run(() =>
@@ -355,7 +343,7 @@ namespace AppLauncher.Windows.Forms
return new Point((x * this.TileSize), ((y * this.TileSize) + labelHeight));
}
public async Task InvalidateContainer(bool animate = true)
public async Task InvalidateContainer()
{
if (isAnimating)
{
@@ -368,14 +356,7 @@ namespace AppLauncher.Windows.Forms
}
else
{
if (animate)
{
await this.Collapse();
}
else
{
await this.CollapseNow();
}
await this.Collapse();
}
}
@@ -393,10 +374,7 @@ namespace AppLauncher.Windows.Forms
}));
}
public void AddRow()
{
this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1));
}
public void AddRow() =>this.SetGridSize(groupInfo.GridSize.Width, (groupInfo.GridSize.Height + 1));
public void EditGroup() => EditGroupForm.ShowDialog(this);
@@ -404,10 +382,9 @@ namespace AppLauncher.Windows.Forms
{
groupInfo = model;
this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
isChecked = groupInfo.IsExpanded;
this.SetGridSize(groupInfo.GridSize.Width, groupInfo.GridSize.Height);
this.LoadTiles(model.Items);
this.Invalidate();
@@ -416,7 +393,7 @@ namespace AppLauncher.Windows.Forms
public void UpdateModel(TileGroupModel model)
{
groupInfo = model;
isChecked = groupInfo.IsExpanded;
//isChecked = groupInfo.IsExpanded;
this.Invalidate();
}
@@ -566,9 +543,12 @@ namespace AppLauncher.Windows.Forms
public void SetGridSize(int width, int height)
{
gridSize = new Point(width, height);
expandedHeight = (this.TileSize * height) + labelHeight;
this.Size = new Size((this.TileSize * width), expandedHeight);
//this.Size = new Size((this.TileSize * width), expandedHeight);
this.Size = new Size((this.TileSize * width), (isChecked ? this.ExpandedHeight : this.CollapseHeight));
}
protected Point convertCoordToLocation(Point position) => new Point((position.X * this.TileSize), ((position.Y * this.TileSize) + labelHeight));
@@ -768,6 +748,5 @@ namespace AppLauncher.Windows.Forms
private void removeGroupMenuItem3_Click(object sender, EventArgs e) => this.Remove();
}
}