Skip to content

Commit 0b4e705

Browse files
committed
Add component size display, misc. code improvements
1 parent e29206f commit 0b4e705

File tree

5 files changed

+168
-78
lines changed

5 files changed

+168
-78
lines changed

src/Common.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public static long ToDownload
201201
set
202202
{
203203
toDownload = value;
204-
Main.DownloadSizeDisplay.Text = GetFormattedBytes(toDownload);
204+
Main.TotalSizeDisplay.Text = GetFormattedBytes(toDownload);
205205
}
206206
}
207207
// Tracks size difference from checking/unchecking components in the manager tab
@@ -210,7 +210,7 @@ public static long Modified
210210
get => modified;
211211
set {
212212
modified = value;
213-
Main.ManagerSizeDisplay.Text = GetFormattedBytes(modified - Downloaded);
213+
Main.TotalSizeDisplay2.Text = GetFormattedBytes(modified - Downloaded);
214214
}
215215
}
216216
}

src/Forms/MainDownload.Designer.cs

Lines changed: 116 additions & 57 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Forms/MainDownload.cs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,22 @@ private void ComponentList_AfterCheck(object sender, TreeViewEventArgs e)
7676

7777
private void ComponentList_BeforeSelect(object _, TreeViewCancelEventArgs e)
7878
{
79-
Description.Text = e.Node.Tag.GetType().ToString().EndsWith("Component")
80-
? (e.Node.Tag as Component).Description
81-
: (e.Node.Tag as Category).Description;
79+
bool isComponent = e.Node.Tag.GetType().ToString().EndsWith("Component");
80+
81+
if (isComponent)
82+
{
83+
var component = e.Node.Tag as Component;
84+
85+
Description.Text = component.Description;
86+
SizeDisplay.Text = FPM.GetFormattedBytes(component.Size);
87+
}
88+
else
89+
{
90+
Description.Text = (e.Node.Tag as Category).Description;
91+
}
92+
93+
SizeLabel.Visible = isComponent;
94+
SizeDisplay.Visible = isComponent;
8295
}
8396

8497
private void DestinationPathBrowse_Click(object _, EventArgs e)

0 commit comments

Comments
 (0)