mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Revert "Reformatting"
This reverts commit 6a85a3e7
This commit is contained in:
parent
383c6f5059
commit
81d775ddca
@ -9,6 +9,7 @@
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Material.Icons.Avalonia/App.xaml" />
|
||||
<FluentTheme Mode="Dark" />
|
||||
<StyleInclude Source="avares://Avalonia.Controls.DataGrid/Themes/Fluent.xaml"/>
|
||||
<StyleInclude Source="avares://Wabbajack.App/Assets/Wabbajack.axaml" />
|
||||
<Style Selector="Button:not(:pointerover) /template/ ContentPresenter">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
|
@ -41,6 +41,12 @@
|
||||
<Setter Property="CornerRadius" Value="4"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border.StandardBorder">
|
||||
<Setter Property="BorderThickness" Value="2"></Setter>
|
||||
<Setter Property="BorderBrush" Value="DarkGray"></Setter>
|
||||
<Setter Property="CornerRadius" Value="4"></Setter>
|
||||
</Style>
|
||||
|
||||
<Style Selector="Border.Settings Grid">
|
||||
<Setter Property="Margin" Value="4"></Setter>
|
||||
</Style>
|
||||
|
@ -4,13 +4,10 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Wabbajack.App.Controls.ResourceView">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock x:Name="ResourceName" Width="100" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<Label Width="100" HorizontalContentAlignment="Right" VerticalAlignment="Center">Tasks:</Label>
|
||||
<TextBox x:Name="MaxTasks" Width="20" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<Label Width="100" HorizontalContentAlignment="Right" VerticalAlignment="Center">Throughput:</Label>
|
||||
<TextBox x:Name="MaxThroughput" Width="20" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
<Label Width="100" HorizontalContentAlignment="Right" VerticalAlignment="Center">Status:</Label>
|
||||
<TextBlock x:Name="CurrentThrougput" Width="50" HorizontalAlignment="Left" VerticalAlignment="Center" />
|
||||
</StackPanel>
|
||||
<Grid RowDefinitions="Auto" ColumnDefinitions="140, 100, 140, 100">
|
||||
<TextBlock Grid.Column="0" VerticalAlignment="Center" Margin="4, 0" x:Name="ResourceName"></TextBlock>
|
||||
<TextBox Grid.Column="1" Text="32" Margin="4, 0" x:Name="MaxTasks"></TextBox>
|
||||
<TextBox Grid.Column="2" Margin="4, 0" x:Name="MaxThroughput"></TextBox>
|
||||
<TextBlock Grid.Column="3" Text="42GB" VerticalAlignment="Center" Margin="4, 0" x:Name="CurrentThroughput"></TextBlock>
|
||||
</Grid>
|
||||
</UserControl>
|
@ -17,10 +17,21 @@ public partial class ResourceView : ReactiveUserControl<ResourceViewModel>, IAct
|
||||
|
||||
this.Bind(ViewModel, vm => vm.MaxTasks, view => view.MaxTasks.Text)
|
||||
.DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.MaxThroughput, view => view.MaxThroughput.Text)
|
||||
|
||||
this.Bind(ViewModel, vm => vm.MaxThroughput, view => view.MaxThroughput.Text,
|
||||
l => l is 0 or long.MaxValue ? "∞" : (l / 1024 / 1024).ToString(),
|
||||
v =>
|
||||
{
|
||||
v = v.Trim();
|
||||
if (v is "0" or "∞" || v == long.MaxValue.ToString())
|
||||
{
|
||||
return long.MaxValue;
|
||||
}
|
||||
return long.TryParse(v, out var l) ? l * 1024 * 1024 : long.MaxValue;
|
||||
})
|
||||
.DisposeWith(disposables);
|
||||
|
||||
this.OneWayBind(ViewModel, vm => vm.CurrentThroughput, view => view.CurrentThrougput.Text,
|
||||
this.OneWayBind(ViewModel, vm => vm.CurrentThroughput, view => view.CurrentThroughput.Text,
|
||||
val => val.FileSizeToString())
|
||||
.DisposeWith(disposables);
|
||||
});
|
||||
|
@ -2,9 +2,11 @@ using System;
|
||||
using System.Reactive.Disposables;
|
||||
using System.Reactive.Linq;
|
||||
using System.Timers;
|
||||
using Avalonia.Threading;
|
||||
using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Wabbajack.App.ViewModels;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.RateLimiter;
|
||||
|
||||
namespace Wabbajack.App.Controls;
|
||||
@ -18,7 +20,7 @@ public class ResourceViewModel : ViewModelBase, IActivatableViewModel, IDisposab
|
||||
{
|
||||
Activator = new ViewModelActivator();
|
||||
_resource = resource;
|
||||
_timer = new Timer(1.0);
|
||||
_timer = new Timer(250);
|
||||
|
||||
Name = resource.Name;
|
||||
|
||||
@ -32,14 +34,9 @@ public class ResourceViewModel : ViewModelBase, IActivatableViewModel, IDisposab
|
||||
_timer.Stop();
|
||||
_timer.Elapsed -= TimerElapsed;
|
||||
}).DisposeWith(disposables);
|
||||
|
||||
this.WhenAnyValue(vm => vm.MaxThroughput)
|
||||
.Skip(1)
|
||||
.Subscribe(v => { _resource.MaxThroughput = MaxThroughput; }).DisposeWith(disposables);
|
||||
|
||||
this.WhenAnyValue(vm => vm.MaxTasks)
|
||||
.Skip(1)
|
||||
.Subscribe(v => { _resource.MaxTasks = MaxTasks; }).DisposeWith(disposables);
|
||||
|
||||
MaxTasks = _resource.MaxTasks;
|
||||
MaxThroughput = _resource.MaxThroughput;
|
||||
});
|
||||
}
|
||||
|
||||
@ -50,6 +47,8 @@ public class ResourceViewModel : ViewModelBase, IActivatableViewModel, IDisposab
|
||||
[Reactive] public long CurrentThroughput { get; set; }
|
||||
|
||||
[Reactive] public string Name { get; set; }
|
||||
|
||||
[Reactive] public string ThroughputHumanFriendly { get; set; }
|
||||
|
||||
|
||||
public void Dispose()
|
||||
@ -59,8 +58,9 @@ public class ResourceViewModel : ViewModelBase, IActivatableViewModel, IDisposab
|
||||
|
||||
private void TimerElapsed(object? sender, ElapsedEventArgs e)
|
||||
{
|
||||
MaxTasks = _resource.MaxTasks;
|
||||
MaxThroughput = _resource.MaxThroughput;
|
||||
CurrentThroughput = _resource.StatusReport.Transferred;
|
||||
Dispatcher.UIThread.Post(() => {
|
||||
CurrentThroughput = _resource.StatusReport.Transferred;
|
||||
ThroughputHumanFriendly = _resource.StatusReport.Transferred.ToFileSizeString();
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user