mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Removed RxUI from Wabbajack.Common
This commit is contained in:
parent
dbc868a363
commit
ea8b0d601f
@ -6,7 +6,6 @@ using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Splat;
|
||||
using Wabbajack;
|
||||
using Wabbajack.Common;
|
||||
using Xunit;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using DynamicData.Kernel;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
|
@ -7,6 +7,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reactive.Concurrency;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
||||
using System.Reflection;
|
||||
@ -23,7 +24,6 @@ using IniParser.Model.Configuration;
|
||||
using IniParser.Parser;
|
||||
using Microsoft.Win32;
|
||||
using Newtonsoft.Json;
|
||||
using ReactiveUI;
|
||||
using RocksDbSharp;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
using Wabbajack.Common.StatusFeed.Errors;
|
||||
@ -107,7 +107,7 @@ namespace Wabbajack.Common
|
||||
AppLocalEvents = Observable.Merge(Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Changed += h, h => watcher.Changed -= h).Select(e => (FileEventType.Changed, e.EventArgs)),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Created += h, h => watcher.Created -= h).Select(e => (FileEventType.Created, e.EventArgs)),
|
||||
Observable.FromEventPattern<FileSystemEventHandler, FileSystemEventArgs>(h => watcher.Deleted += h, h => watcher.Deleted -= h).Select(e => (FileEventType.Deleted, e.EventArgs)))
|
||||
.ObserveOn(RxApp.TaskpoolScheduler);
|
||||
.ObserveOn(Scheduler.Default);
|
||||
watcher.EnableRaisingEvents = true;
|
||||
InitPatches();
|
||||
}
|
||||
|
@ -51,12 +51,12 @@
|
||||
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0-preview.6.20305.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="Octodiff" Version="1.2.1" />
|
||||
<PackageReference Include="ReactiveUI" Version="11.5.17" />
|
||||
<PackageReference Include="RocksDbNative" Version="6.2.2" />
|
||||
<PackageReference Include="RocksDbSharp" Version="6.2.2" />
|
||||
<PackageReference Include="SharpZipLib" Version="1.2.0" />
|
||||
<PackageReference Include="System.Data.HashFunction.xxHash" Version="2.0.0" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
<PackageReference Include="System.Reactive" Version="4.4.1" />
|
||||
<PackageReference Include="System.Security.Cryptography.ProtectedData" Version="5.0.0-preview.6.20305.6" />
|
||||
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0-preview.6.20305.6" />
|
||||
<PackageReference Include="YamlDotNet" Version="8.1.2" />
|
||||
|
@ -8,7 +8,6 @@ using System.Reactive.Subjects;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using DynamicData;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
|
||||
[assembly: InternalsVisibleTo("Wabbajack.Test")]
|
||||
@ -26,6 +25,7 @@ namespace Wabbajack.Common
|
||||
public static bool WorkerThread => AsyncLocalCurrentQueue.Value != null;
|
||||
public bool IsWorkerThread => WorkerThread;
|
||||
internal static readonly AsyncLocal<WorkQueue?> AsyncLocalCurrentQueue = new AsyncLocal<WorkQueue?>();
|
||||
public static WorkQueue? AsyncLocalQueue => AsyncLocalCurrentQueue.Value;
|
||||
|
||||
private readonly Subject<CPUStatus> _Status = new Subject<CPUStatus>();
|
||||
public IObservable<CPUStatus> Status => _Status;
|
||||
@ -69,15 +69,14 @@ namespace Wabbajack.Common
|
||||
public WorkQueue(IObservable<int>? numThreads)
|
||||
{
|
||||
// Hook onto the number of active threads subject, and subscribe to it for changes
|
||||
_activeNumThreadsObservable
|
||||
_disposables.Add(_activeNumThreadsObservable
|
||||
// Select the latest driving observable
|
||||
.Select(x => x ?? Observable.Return(Environment.ProcessorCount))
|
||||
.Switch()
|
||||
.DistinctUntilChanged()
|
||||
// Add new threads if it increases
|
||||
.SelectTask(AddNewThreadsIfNeeded)
|
||||
.Subscribe()
|
||||
.DisposeWith(_disposables);
|
||||
.Subscribe());
|
||||
// Set the incoming driving observable to be active
|
||||
SetActiveThreadsObservable(numThreads);
|
||||
}
|
||||
|
@ -5,8 +5,9 @@ using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Common
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public abstract class AUserIntervention : ReactiveObject, IUserIntervention
|
||||
{
|
||||
@ -17,7 +18,7 @@ namespace Wabbajack.Common
|
||||
private bool _handled;
|
||||
public bool Handled { get => _handled; set => this.RaiseAndSetIfChanged(ref _handled, value); }
|
||||
|
||||
public int CpuID { get; } = WorkQueue.AsyncLocalCurrentQueue.Value?.CpuId ?? WorkQueue.UnassignedCpuId;
|
||||
public int CpuID { get; } = WorkQueue.AsyncLocalQueue?.CpuId ?? WorkQueue.UnassignedCpuId;
|
||||
|
||||
public abstract void Cancel();
|
||||
public ICommand CancelCommand { get; }
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace Wabbajack.Common
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
public abstract class ConfirmationIntervention : AUserIntervention
|
||||
{
|
@ -6,7 +6,7 @@ using System.Threading.Tasks;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
|
||||
namespace Wabbajack.Common
|
||||
namespace Wabbajack.Lib
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a message that requires user interaction. The user must perform some action
|
@ -7,6 +7,7 @@ using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Common.StatusFeed;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.Downloaders;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
@ -2,7 +2,7 @@
|
||||
x:Class="Wabbajack.CompilerView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
|
||||
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:icon="http://metro.mahapps.com/winfx/xaml/iconpacks"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
@ -200,7 +200,7 @@
|
||||
ViewModel="{Binding}" />
|
||||
<local:AttentionBorder x:Name="UserInterventionsControl" Grid.Column="2">
|
||||
<Grid>
|
||||
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type common:ConfirmationIntervention}}" />
|
||||
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type lib:ConfirmationIntervention}}" />
|
||||
</Grid>
|
||||
</local:AttentionBorder>
|
||||
<local:CompilationCompleteView Grid.Column="2"
|
||||
|
@ -304,7 +304,7 @@
|
||||
x:Name="UserInterventionsControl"
|
||||
Content="{Binding ActiveGlobalUserIntervention}">
|
||||
<local:AttentionBorder.Resources>
|
||||
<DataTemplate DataType="{x:Type common:ConfirmationIntervention}">
|
||||
<DataTemplate DataType="{x:Type lib:ConfirmationIntervention}">
|
||||
<local:ConfirmationInterventionView ViewModel="{Binding}" />
|
||||
</DataTemplate>
|
||||
<DataTemplate DataType="{x:Type local:ConfirmUpdateOfExistingInstallVM}">
|
||||
|
@ -2,14 +2,14 @@
|
||||
x:Class="Wabbajack.ConfirmationInterventionView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:common="clr-namespace:Wabbajack.Common;assembly=Wabbajack.Common"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lib="clr-namespace:Wabbajack.Lib;assembly=Wabbajack.Lib"
|
||||
xmlns:rxui="http://reactiveui.net"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
x:TypeArguments="common:ConfirmationIntervention"
|
||||
x:TypeArguments="lib:ConfirmationIntervention"
|
||||
mc:Ignorable="d">
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
|
@ -14,7 +14,7 @@ using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using ReactiveUI;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
|
||||
namespace Wabbajack
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user