mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
added Download Size and Installation size on list hover
This commit is contained in:
parent
bba92fd5a2
commit
1b199e5951
@ -120,5 +120,23 @@ namespace Wabbajack
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Format bytes to a greater unit
|
||||
/// </summary>
|
||||
/// <param name="bytes">number of bytes</param>
|
||||
/// <returns></returns>
|
||||
public static string FormatBytes(long bytes)
|
||||
{
|
||||
string[] Suffix = { "B", "KB", "MB", "GB", "TB" };
|
||||
int i;
|
||||
double dblSByte = bytes;
|
||||
for (i = 0; i < Suffix.Length && bytes >= 1024; i++, bytes /= 1024)
|
||||
{
|
||||
dblSByte = bytes / 1024.0;
|
||||
}
|
||||
|
||||
return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,6 +39,12 @@ namespace Wabbajack
|
||||
[Reactive]
|
||||
public bool IsBroken { get; private set; }
|
||||
|
||||
[Reactive]
|
||||
public string DownloadSizeText { get; private set; }
|
||||
|
||||
[Reactive]
|
||||
public string InstallSizeText { get; private set; }
|
||||
|
||||
[Reactive]
|
||||
public IErrorResponse Error { get; private set; }
|
||||
|
||||
@ -49,10 +55,12 @@ namespace Wabbajack
|
||||
public bool LoadingImage => _LoadingImage.Value;
|
||||
|
||||
public ModListMetadataVM(ModListGalleryVM parent, ModlistMetadata metadata)
|
||||
{
|
||||
{
|
||||
_parent = parent;
|
||||
Metadata = metadata;
|
||||
Location = Consts.ModListDownloadFolder.Combine(Metadata.Links.MachineURL + (string)Consts.ModListExtension);
|
||||
DownloadSizeText = "Download size : " + UIUtils.FormatBytes(Metadata.DownloadMetadata.SizeOfArchives);
|
||||
InstallSizeText = "Installation size : " + UIUtils.FormatBytes(Metadata.DownloadMetadata.SizeOfInstalledFiles);
|
||||
IsBroken = metadata.ValidationSummary.HasFailures;
|
||||
OpenWebsiteCommand = ReactiveCommand.Create(() => Utils.OpenWebsite(new Uri($"https://www.wabbajack.org/modlist/{Metadata.Links.MachineURL}")));
|
||||
ExecuteCommand = ReactiveCommand.CreateFromObservable<Unit, Unit>(
|
||||
|
@ -146,6 +146,66 @@
|
||||
</Style>
|
||||
</Ellipse.Style>
|
||||
</Ellipse>
|
||||
<Label Content="{Binding DownloadSizeText}" HorizontalAlignment="Left" Margin="10,289,0,0" VerticalAlignment="Top">
|
||||
<Label.Style>
|
||||
<Style TargetType="Label">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, ElementName=ModListTile}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1"
|
||||
Duration="0:0:0.08" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0"
|
||||
Duration="0:0:0.08" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Label.Style>
|
||||
</Label>
|
||||
<Label Content="{Binding InstallSizeText}" HorizontalAlignment="Left" Margin="10,305,0,0" VerticalAlignment="Top">
|
||||
<Label.Style>
|
||||
<Style TargetType="Label">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding IsMouseOver, ElementName=ModListTile}" Value="True">
|
||||
<DataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="1"
|
||||
Duration="0:0:0.08" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.EnterActions>
|
||||
<DataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetProperty="Opacity"
|
||||
To="0"
|
||||
Duration="0:0:0.08" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</DataTrigger.ExitActions>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Label.Style>
|
||||
</Label>
|
||||
</Grid>
|
||||
</Border>
|
||||
<local:UnderMaintenanceOverlay
|
||||
|
Loading…
Reference in New Issue
Block a user