mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Merge pull request #217 from wabbajack-tools/better-cpu-status
Switched CPU status into a blue-color-in-the-background style progres…
This commit is contained in:
commit
edcf75c28c
@ -63,9 +63,6 @@
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.3\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
@ -99,8 +96,14 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CSP Readme.md" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<PackageReference Include="System.Reactive">
|
||||
<Version>4.2.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe">
|
||||
<Version>4.6.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="System.Reactive" version="4.2.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.6.0" targetFramework="net48" />
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
</packages>
|
@ -52,20 +52,22 @@ namespace Wabbajack.Common
|
||||
|
||||
while (true)
|
||||
{
|
||||
Report("Waiting", 0);
|
||||
Report("Waiting", 0, false);
|
||||
var f = Queue.Take();
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
public void Report(string msg, int progress)
|
||||
public void Report(string msg, int progress, bool isWorking = true)
|
||||
{
|
||||
_Status.OnNext(
|
||||
new CPUStatus
|
||||
{
|
||||
Progress = progress,
|
||||
ProgressPercent = progress / 100f,
|
||||
Msg = msg,
|
||||
ID = CpuId
|
||||
ID = CpuId,
|
||||
IsWorking = isWorking
|
||||
});
|
||||
}
|
||||
|
||||
@ -89,7 +91,9 @@ namespace Wabbajack.Common
|
||||
public class CPUStatus
|
||||
{
|
||||
public int Progress { get; internal set; }
|
||||
public float ProgressPercent { get; internal set; }
|
||||
public string Msg { get; internal set; }
|
||||
public int ID { get; internal set; }
|
||||
public bool IsWorking { get; internal set; }
|
||||
}
|
||||
}
|
||||
|
@ -38,6 +38,7 @@ namespace Wabbajack
|
||||
public float PercentCompleted => _percentCompleted.Value;
|
||||
|
||||
public ObservableCollectionExtended<CPUStatus> StatusList { get; } = new ObservableCollectionExtended<CPUStatus>();
|
||||
|
||||
public ObservableCollectionExtended<string> Log => MWVM.Log;
|
||||
|
||||
public IReactiveCommand BackCommand { get; }
|
||||
@ -121,6 +122,7 @@ namespace Wabbajack
|
||||
.ToObservableChangeSet(x => x.ID)
|
||||
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
|
||||
.EnsureUniqueChanges()
|
||||
.Filter(i => i.IsWorking)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<CPUStatus>.Ascending(s => s.ID), SortOptimisations.ComparesImmutableValuesOnly)
|
||||
.Bind(StatusList)
|
||||
|
@ -280,6 +280,7 @@ namespace Wabbajack
|
||||
.ToObservableChangeSet(x => x.ID)
|
||||
.Batch(TimeSpan.FromMilliseconds(250), RxApp.TaskpoolScheduler)
|
||||
.EnsureUniqueChanges()
|
||||
.Filter(i => i.IsWorking)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<CPUStatus>.Ascending(s => s.ID), SortOptimisations.ComparesImmutableValuesOnly)
|
||||
.Bind(StatusList)
|
||||
|
@ -5,6 +5,7 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:mahapps="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
|
||||
d:DesignHeight="250"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
@ -12,7 +13,7 @@
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="4" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="500" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox
|
||||
Grid.Column="0"
|
||||
@ -34,33 +35,24 @@
|
||||
<DataTemplate>
|
||||
<Grid HorizontalAlignment="Stretch">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="500" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ProgressBar
|
||||
<mahapps:MetroProgressBar
|
||||
Grid.Column="0"
|
||||
Width="100"
|
||||
Maximum="100"
|
||||
Minimum="0"
|
||||
Value="{Binding Progress, Mode=OneTime}">
|
||||
<ProgressBar.Style>
|
||||
<Style TargetType="ProgressBar">
|
||||
<Setter Property="Visibility" Value="Visible" />
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Progress}" Value="0">
|
||||
<Setter Property="Visibility" Value="Collapsed" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ProgressBar.Style>
|
||||
</ProgressBar>
|
||||
<TextBlock Grid.Column="1" Text=" CPU " />
|
||||
<TextBlock Grid.Column="2" Text="{Binding ID}" />
|
||||
<TextBlock Grid.Column="3" Text=" - " />
|
||||
<TextBlock Grid.Column="4" Text="{Binding Msg}" />
|
||||
Background="{StaticResource WindowBackgroundBrush}"
|
||||
BorderThickness="0"
|
||||
Foreground="Transparent"
|
||||
Maximum="1"
|
||||
Value="{Binding ProgressPercent, Mode=OneWay}" />
|
||||
<mahapps:MetroProgressBar
|
||||
Grid.Column="0"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
Foreground="{StaticResource PrimaryVariantBrush}"
|
||||
Maximum="1"
|
||||
Opacity="{Binding ProgressPercent, Mode=OneWay}"
|
||||
Value="{Binding ProgressPercent, Mode=OneWay}" />
|
||||
<TextBlock Grid.Column="0" Text="{Binding Msg}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
|
Loading…
Reference in New Issue
Block a user