forked from WalletWasabi/WalletWasabi
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ichthus1604
committed
Apr 20, 2024
1 parent
0eda1c6
commit efbdd50
Showing
9 changed files
with
152 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
WalletWasabi.Fluent/ViewModels/Wallets/Send/ManualControlDialogViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using DynamicData; | ||
using DynamicData.Binding; | ||
using ReactiveUI; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Reactive.Linq; | ||
using WalletWasabi.Blockchain.TransactionOutputs; | ||
using WalletWasabi.Fluent.Models.Transactions; | ||
using WalletWasabi.Fluent.Models.Wallets; | ||
using WalletWasabi.Fluent.ViewModels.Dialogs.Base; | ||
using WalletWasabi.Fluent.ViewModels.Wallets.Coins; | ||
using WalletWasabi.Wallets; | ||
|
||
namespace WalletWasabi.Fluent.ViewModels.Wallets.Send; | ||
|
||
[NavigationMetaData( | ||
Title = "Manual Control", | ||
IconName = "wallet_action_send", | ||
NavBarPosition = NavBarPosition.None, | ||
Searchable = false, | ||
NavigationTarget = NavigationTarget.DialogScreen)] | ||
public partial class ManualControlDialogViewModel: DialogViewModelBase<IEnumerable<SmartCoin>> | ||
{ | ||
private readonly IWalletModel _walletModel; | ||
private readonly Wallet _wallet; | ||
|
||
private ManualControlDialogViewModel(IWalletModel walletModel, Wallet wallet) | ||
{ | ||
CoinList = new CoinListViewModel(walletModel, [], true); | ||
|
||
EnableBack = true; | ||
|
||
var nextCommandCanExecute = | ||
CoinList.Selection | ||
.ToObservableChangeSet() | ||
.ToCollection() | ||
.Select(c => c.Count > 0); | ||
|
||
NextCommand = ReactiveCommand.Create(OnNext, nextCommandCanExecute); | ||
|
||
SetupCancel(true, true, true); | ||
_walletModel = walletModel; | ||
_wallet = wallet; | ||
} | ||
|
||
public CoinListViewModel CoinList { get; } | ||
|
||
protected override void OnNavigatedFrom(bool isInHistory) | ||
{ | ||
CoinList.Dispose(); | ||
|
||
base.OnNavigatedFrom(isInHistory); | ||
} | ||
|
||
private void OnNext() | ||
{ | ||
var coins = CoinList.Selection.GetSmartCoins().ToList(); | ||
|
||
var sendParameters = SendParameters.CreateManual(_wallet, coins); | ||
|
||
Navigate().To().Send(_walletModel, sendParameters); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
WalletWasabi.Fluent/Views/Wallets/Send/ManualControlDialogView.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<UserControl xmlns="https://github.com/avaloniaui" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:vm="using:WalletWasabi.Fluent.ViewModels.Wallets.Send" | ||
xmlns:sorting="clr-namespace:WalletWasabi.Fluent.Controls.Sorting" | ||
xmlns:coins="clr-namespace:WalletWasabi.Fluent.Views.Wallets.Coins" | ||
x:DataType="vm:ManualControlDialogViewModel" | ||
x:CompileBindings="True" | ||
x:Class="WalletWasabi.Fluent.Views.Wallets.Send.ManualControlDialogView"> | ||
|
||
<ContentArea Title="{Binding Title}" | ||
Caption="Select the coins that are allowed for the transaction to use" | ||
EnableNext="True" NextContent="Continue" | ||
EnableCancel="{Binding EnableCancel}" | ||
EnableBack="{Binding EnableBack}" | ||
ScrollViewer.VerticalScrollBarVisibility="Disabled" | ||
ScrollViewer.HorizontalScrollBarVisibility="Disabled"> | ||
<ContentArea.TopContent> | ||
<Button DockPanel.Dock="Right" Theme="{StaticResource DialogSortButton}" ToolTip.Tip="Sorting"> | ||
<Button.Flyout> | ||
<Flyout Placement="BottomEdgeAlignedRight"> | ||
<sorting:SortControl Sortables="{Binding CoinList.Sortables}" /> | ||
</Flyout> | ||
</Button.Flyout> | ||
</Button> | ||
</ContentArea.TopContent> | ||
<coins:CoinListView DataContext="{Binding CoinList}" /> | ||
</ContentArea> | ||
</UserControl> |
17 changes: 17 additions & 0 deletions
17
WalletWasabi.Fluent/Views/Wallets/Send/ManualControlDialogView.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using Avalonia.Controls; | ||
using Avalonia.Markup.Xaml; | ||
|
||
namespace WalletWasabi.Fluent.Views.Wallets.Send; | ||
|
||
public class ManualControlDialogView : UserControl | ||
{ | ||
public ManualControlDialogView() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void InitializeComponent() | ||
{ | ||
AvaloniaXamlLoader.Load(this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters