dont pass global to transaction broadcaster.
MODIFY
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
WalletWasabi.Fluent/ViewModels/Dialogs/DialogViewModelBaseOfTResult.cs
@@ -100,6 +100,8 @@ namespace WalletWasabi.Fluent.ViewModels.Dialogs
/// <summary>
/// Method that is triggered when the dialog is closed.
/// </summary>
- protected abstract void OnDialogClosed();
+ protected virtual void OnDialogClosed()
+ {
+ }
}
}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -4,6 +4,7 @@ using System.Reactive.Concurrency;
using NBitcoin;
using ReactiveUI;
using System.Reactive.Linq;
+using System.Threading.Tasks;
using WalletWasabi.Fluent.ViewModels.AddWallet;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Fluent.ViewModels.Dialogs;
@@ -158,7 +159,19 @@ namespace WalletWasabi.Fluent.ViewModels
AboutViewModel.RegisterLazy(() => new AboutViewModel());
- LoadTransactionViewModel.RegisterLazy(() => new LoadTransactionViewModel());
+ BroadcastTransactionViewModel.RegisterAsyncLazy(
+ async () =>
+ {
+ while (_global.TransactionBroadcaster is null)
+ {
+ await Task.Delay(100);
+ }
+
+ return new BroadcastTransactionViewModel(
+ _global.BitcoinStore,
+ _global.Network,
+ _global.TransactionBroadcaster);
+ });
LegalDocumentsViewModel.RegisterAsyncLazy(
async () =>

MODIFY
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/LoadTransactionViewModel.cs
WalletWasabi.Fluent/ViewModels/TransactionBroadcasting/LoadTransactionViewModel.cs
@@ -10,6 +10,7 @@ using Splat;
using WalletWasabi.Blockchain.TransactionBroadcasting;
using WalletWasabi.Blockchain.Transactions;
using WalletWasabi.Fluent.Helpers;
+using WalletWasabi.Fluent.ViewModels.Dialogs;
using WalletWasabi.Fluent.ViewModels.Navigation;
using WalletWasabi.Gui;
using WalletWasabi.Logging;
@@ -17,40 +18,20 @@ using WalletWasabi.Stores;
namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
{
- [NavigationMetaData(
- Title = "Broadcaster",
- Caption = "Broadcast your transactions here",
- IconName = "live_regular",
- Order = 5,
- Category = "General",
- Keywords = new[] { "Transaction Id", "Input", "Output", "Amount", "Network", "Fee", "Count", "BTC", "Signed", "Paste", "Import", "Broadcast", "Transaction", },
- NavBarPosition = NavBarPosition.None)]
- public partial class LoadTransactionViewModel : RoutableViewModel
+ public partial class LoadTransactionViewModel : DialogViewModelBase<SmartTransaction?>
{
[AutoNotify] private SmartTransaction? _finalTransaction;
- public LoadTransactionViewModel()
+ public LoadTransactionViewModel(Network network)
{
- // TODO: Remove global
- var global = Locator.Current.GetService<Global>();
-
- Network = global.Network;
- BitcoinStore = global.BitcoinStore;
+ Network = network;
this.WhenAnyValue(x => x.FinalTransaction)
.Where(x => x is { })
.ObserveOn(RxApp.MainThreadScheduler)
.Subscribe(finalTransaction =>
{
- try
- {
- Navigate().To(new BroadcastTransactionViewModel(global, finalTransaction!));
- }
- catch (Exception ex)
- {
- // TODO: Notify the user
- Logger.LogError(ex);
- }
+ Close(finalTransaction);
});
ImportTransactionCommand = ReactiveCommand.CreateFromTask(
@@ -105,12 +86,8 @@ namespace WalletWasabi.Fluent.ViewModels.TransactionBroadcasting
});
}
- public BitcoinStore BitcoinStore { get; }
-
private Network Network { get; }
- public override NavigationTarget DefaultTarget => NavigationTarget.DialogScreen;
-
public ICommand PasteCommand { get; }
public ICommand ImportTransactionCommand { get; }

MODIFY
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
<SubType>Designer</SubType>
</AvaloniaResource>
<AvaloniaResource Include="Assets\**" />
- <Compile Update="Controls\InfoMessage.axaml.cs">
- <DependentUpon>InfoMessage.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Update="Views\AddWallet\HardwareWallet\DetectedHardwareWalletView.axaml.cs">
- <DependentUpon>DetectedHardwareWalletView.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Update="Views\AddWallet\HardwareWallet\ConnectHardwareWalletView.axaml.cs">
- <DependentUpon>ConnectHardwareWalletView.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Update="Views\AddWallet\Create\RecoveryWordsView.axaml.cs">
- <DependentUpon>RecoveryWordsView.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Update="Views\AddWallet\Create\ConfirmRecoveryWordsView.axaml.cs">
- <DependentUpon>ConfirmRecoveryWordsView.axaml</DependentUpon>
- <Compile Update="Views\TransactionBroadcaster\LoadTransactionView.axaml.cs">
- <DependentUpon>TransactionBroadcasterView.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
- <Compile Update="Views\TransactionBroadcaster\BroadcastTransactionView.axaml.cs">
- <DependentUpon>BroadcastTransactionView.axaml</DependentUpon>
- <SubType>Code</SubType>
- </Compile>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.999-cibuild0012147-beta" />

dont pass global to transaction broadcaster.