Refactor receive addresses column creation into methods
MODIFY
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressesViewModel.cs
WalletWasabi.Fluent/ViewModels/Wallets/Receive/ReceiveAddressesViewModel.cs
@@ -43,8 +43,26 @@ public partial class ReceiveAddressesViewModel : RoutableViewModel
{
Columns =
{
- // Actions
- new TemplateColumn<AddressViewModel>(
+ ActionsColumn(),
+ AddressColumn(),
+ LabelsColumn()
+ }
+ };
+
+ Source.RowSelection!.SingleSelect = true;
+
+ InitializeAddresses();
+ }
+
+ public Wallet Wallet { get; }
+
+ public Network Network { get; }
+
+ public FlatTreeDataGridSource<AddressViewModel> Source { get; }
+
+ private static IColumn<AddressViewModel> ActionsColumn()
+ {
+ return new TemplateColumn<AddressViewModel>(
null,
new FuncDataTemplate<AddressViewModel>((node, ns) => new ActionsColumnView(), true),
options: new ColumnOptions<AddressViewModel>
@@ -52,10 +70,12 @@ public partial class ReceiveAddressesViewModel : RoutableViewModel
CanUserResizeColumn = false,
CanUserSortColumn = false
},
- width: new GridLength(90, GridUnitType.Pixel)),
+ width: new GridLength(90, GridUnitType.Pixel));
+ }
- // Address
- new TemplateColumn<AddressViewModel>(
+ private static IColumn<AddressViewModel> AddressColumn()
+ {
+ return new TemplateColumn<AddressViewModel>(
"Address",
new FuncDataTemplate<AddressViewModel>((node, ns) => new AddressColumnView(), true),
options: new ColumnOptions<AddressViewModel>
@@ -65,10 +85,12 @@ public partial class ReceiveAddressesViewModel : RoutableViewModel
CompareAscending = AddressViewModel.SortAscending(x => x.Address),
CompareDescending = AddressViewModel.SortDescending(x => x.Address)
},
- width: new GridLength(2, GridUnitType.Star)),
+ width: new GridLength(2, GridUnitType.Star));
+ }
- // Labels
- new TemplateColumn<AddressViewModel>(
+ private static IColumn<AddressViewModel> LabelsColumn()
+ {
+ return new TemplateColumn<AddressViewModel>(
"Labels",
new FuncDataTemplate<AddressViewModel>((node, ns) => new LabelsColumnView(), true),
options: new ColumnOptions<AddressViewModel>
@@ -78,20 +100,8 @@ public partial class ReceiveAddressesViewModel : RoutableViewModel
CompareAscending = AddressViewModel.SortAscending(x => x.Label),
CompareDescending = AddressViewModel.SortDescending(x => x.Label)
},
- width: new GridLength(210, GridUnitType.Pixel))
+ width: new GridLength(210, GridUnitType.Pixel));
}
- };
-
- Source.RowSelection!.SingleSelect = true;
-
- InitializeAddresses();
- }
-
- public Wallet Wallet { get; }
-
- public Network Network { get; }
-
- public FlatTreeDataGridSource<AddressViewModel> Source { get; }
protected override void OnNavigatedTo(bool isInHistory, CompositeDisposable disposables)
{

Refactor receive addresses column creation into methods