Simplify things pt. 2
DELETE
WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabHelper.cs
-using System.Collections.Generic;
-using System.Reflection;
-using WalletWasabi.Gui.ViewModels;
-using WalletWasabi.Gui.ViewModels.Validation;
-
-namespace WalletWasabi.Gui.Controls.WalletExplorer
-{
- public static class CoinInfoTabHelper
- {
- private static IEnumerable<AdvancedDetailPair> PropertiesWithAdvancedDetailAttribute(object instance)
- {
- foreach (PropertyInfo pInfo in ReflectionHelper.GetPropertyInfos(instance))
- {
- var vma = ReflectionHelper.GetAttribute<AdvancedDetailAttribute>(pInfo);
- if (vma != null)
- {
- yield return new AdvancedDetailPair(vma.DetailTitle, vma.IsSensitive, pInfo.Name);
- }
- }
- }
-
- public static CoinInfoTabViewModel GenerateCoinInfoTab<T>(string Title, T targetVM) where T : ViewModelBase
- {
- var getAttr = PropertiesWithAdvancedDetailAttribute(targetVM);
- return new CoinInfoTabViewModel(Title, targetVM, getAttr);
- }
- }
-}
\ No newline at end of file

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabView.xaml
<Setter Property="Background" Value="Transparent" />
</Style>
</UserControl.Styles>
- <Grid>
- <!-- <StackPanel>
- <ContentControl.ItemTemplate>
- <DataTemplate>
<Grid>
</Grid>
- </DataTemplate>
- </StackPanel.ItemTemplate>
- </StackPanel> -->
- </Grid>
</UserControl>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinInfoTabViewModel.cs
@@ -9,15 +9,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
{
public class CoinInfoTabViewModel : WasabiDocumentTabViewModel
{
- public CoinInfoTabViewModel(string title, object targetVM, IEnumerable<AdvancedDetailPair> bindingPairs) : base(title)
+ public CoinInfoTabViewModel(string title, CoinViewModel targetVM) : base(title)
{
Global = Locator.Current.GetService<Global>();
- BindingPairs = bindingPairs;
TargetVM = targetVM;
}
public object TargetVM { get; }
- public IEnumerable<AdvancedDetailPair> BindingPairs { get; }
private CompositeDisposable Disposables { get; set; }
private Global Global { get; }

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/CoinListView.xaml
<DataTemplate>
<Grid Classes="CoinItemGrid">
<i:Interaction.Behaviors>
- <behaviors:CommandOnDoubleClickBehavior Command="{Binding OpenAdvancedDetail}" />
+ <behaviors:CommandOnDoubleClickBehavior Command="{Binding OpenCoinInfo}" />
</i:Interaction.Behaviors>
<Grid.ContextMenu>
<ContextMenu>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/CoinViewModel.cs
@@ -15,6 +15,8 @@ using WalletWasabi.Gui.Models;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Models;
using WalletWasabi.Logging;
+using AvalonStudio.Extensibility;
+using AvalonStudio.Shell;
namespace WalletWasabi.Gui.Controls.WalletExplorer
{
@@ -31,12 +33,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private ObservableAsPropertyHelper<string> _cluster;
private ObservableAsPropertyHelper<string> _expandMenuCaption;
private bool _isExpanded;
- public ReactiveCommand<Unit, bool> ToggleDetails { get; }
public CoinListViewModel Owner { get; }
private Global Global { get; }
public bool CanBeDequeued => Owner.CanDequeueCoins;
+ public ReactiveCommand<Unit, bool> ToggleDetails { get; }
public ReactiveCommand<Unit, Unit> DequeueCoin { get; }
+ public ReactiveCommand<Unit, Unit> OpenCoinInfo { get; }
public CoinViewModel(CoinListViewModel owner, SmartCoin model)
{
@@ -114,6 +117,13 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
ToggleDetails = ReactiveCommand.Create(() => IsExpanded = !IsExpanded);
+ OpenCoinInfo = ReactiveCommand.Create(() =>
+ {
+ var title = $"{TransactionId[0..10]}'s Details";
+ var advancedDetail = new CoinInfoTabViewModel(title, this);
+ IoC.Get<IShell>().AddOrSelectDocument(advancedDetail);
+ });
+
ToggleDetails.ThrownExceptions
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex =>
@@ -122,7 +132,8 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
NotificationHelpers.Error(ex.ToUserFriendlyString());
});
- DequeueCoin.ThrownExceptions
+ Observable.Merge(DequeueCoin.ThrownExceptions)
+ .Merge(OpenCoinInfo.ThrownExceptions)
.ObserveOn(RxApp.TaskpoolScheduler)
.Subscribe(ex => Logger.LogError(ex)); // Don't notify about it. Dequeue failure (and success) is notified by other mechanism.
}

Simplify things pt. 2