[WIP] receive label autocomplate
MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabView.xaml
<DockPanel LastChildFill="True">
<Grid ColumnDefinitions="*,300" DockPanel.Dock="Top" Margin="0 0 0 10">
- <controls:ExtendedTextBox Text="{Binding Label, Mode=TwoWay}" Watermark="Label (Required)" UseFloatingWatermark="True" Grid.Column="0" Margin="0 0 10 0">
+ <StackPanel Spacing="8">
+ <controls:ExtendedTextBox Text="{Binding Label, Mode=TwoWay}" Watermark="Label (Required)" CaretIndex="{Binding CaretIndex, Mode=TwoWay}" UseFloatingWatermark="True" Grid.Column="0" Margin="0 0 10 0">
<i:Interaction.Behaviors>
<behaviors:SuggestionBehavior SuggestionItems="{Binding Suggestions}" />
<behaviors:CommandOnEnterBehavior Command="{Binding GenerateCommand}" />
Start labelling today and your privacy will thank you tomorrow!
</ToolTip.Tip>
</controls:ExtendedTextBox>
+ <ItemsControl Items="{Binding Suggestions}">
+ <ItemsControl.ItemsPanel>
+ <ItemsPanelTemplate>
+ <StackPanel Orientation ="Horizontal" Spacing="2"/>
+ </ItemsPanelTemplate>
+ </ItemsControl.ItemsPanel>
+ <ItemsControl.ItemTemplate>
+ <DataTemplate>
+ <Button Focusable="False" Content="{Binding Word}" Command="{Binding OnSelected}" />
+ </DataTemplate>
+ </ItemsControl.ItemTemplate>
+ </ItemsControl>
+ </StackPanel>
+
<Button Content="Generate Receive Address" Command="{Binding GenerateCommand}" VerticalAlignment="Top" Grid.Column="1" />
</Grid>

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/ReceiveTabViewModel.cs
@@ -26,10 +26,11 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
private int _caretIndex;
private ObservableCollection<SuggestionViewModel> _suggestions;
- private ReceiveTabViewModel(WalletViewModel walletViewModel)
+ public ReceiveTabViewModel(WalletViewModel walletViewModel)
: base("Receive", walletViewModel)
{
_addresses = new ObservableCollection<AddressViewModel>();
+ Label = String.Empty;
Observable.FromEventPattern(Global.WalletService.Coins, nameof(Global.WalletService.Coins.HashSetChanged))
.ObserveOn(RxApp.MainThreadScheduler)
@@ -91,6 +92,15 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
});
}
});
+
+ this.WhenAnyValue(x => x.CaretIndex).Subscribe(_ =>
+ {
+ if (Label == null) return;
+ if (CaretIndex != Label.Length)
+ {
+ CaretIndex = Label.Length;
+ }
+ });
_suggestions = new ObservableCollection<SuggestionViewModel>();
}
@@ -173,16 +183,18 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
if (lastWorld.Length < 1)
{
- _suggestions.Clear();
+ Suggestions.Clear();
return;
}
- var suggestedWords = Global.WalletService.GetNonSpecialLabels().Where(w => w.StartsWith(lastWorld, StringComparison.InvariantCultureIgnoreCase)).Take(7);
+ var suggestedWords = Global.WalletService.GetNonSpecialLabels().Where(w => w.StartsWith(lastWorld, StringComparison.InvariantCultureIgnoreCase))
+ .Concat(Global.WalletService.GetNonSpecialLabels().Where(w => w.Contains(lastWorld, StringComparison.InvariantCultureIgnoreCase)))
+ .Distinct().Take(3);
- _suggestions.Clear();
+ Suggestions.Clear();
foreach (var suggestion in suggestedWords)
{
- _suggestions.Add(new SuggestionViewModel(suggestion, OnAddWord));
+ Suggestions.Add(new SuggestionViewModel(suggestion, OnAddWord));
}
}

MODIFY
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
WalletWasabi.Gui/Controls/WalletExplorer/SendTabViewModel.cs
@@ -177,6 +177,10 @@ namespace WalletWasabi.Gui.Controls.WalletExplorer
}
});
+
+
+
+
this.WhenAnyValue(x => x.Password).Subscribe(x =>
{
if (x.NotNullAndNotEmpty())

MODIFY
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
WalletWasabi.Gui/Tabs/WalletManager/RecoverWalletViewModel.cs
@@ -179,16 +179,16 @@ namespace WalletWasabi.Gui.Tabs.WalletManager
if (lastWorld.Length < 1)
{
- _suggestions.Clear();
+ Suggestions.Clear();
return;
}
var suggestedWords = EnglishWords.Where(w => w.StartsWith(lastWorld)).Take(7);
- _suggestions.Clear();
+ Suggestions.Clear();
foreach (var suggestion in suggestedWords)
{
- _suggestions.Add(new SuggestionViewModel(suggestion, OnAddWord));
+ Suggestions.Add(new SuggestionViewModel(suggestion, OnAddWord));
}
}

[WIP] receive label autocomplate