Dialog screen prototype
ADD
WalletWasabi.Fluent/ViewModels/DialogScreenViewModel.cs
+using ReactiveUI;
+using System.Reactive;
+using WalletWasabi.Gui.ViewModels;
+using System;
+using System.Reactive.Linq;
+
+namespace WalletWasabi.Fluent.ViewModels
+{
+ public class DialogScreenViewModel : ViewModelBase, IScreen
+ {
+ private bool _isDialogVisible;
+
+ public DialogScreenViewModel()
+ {
+ Observable.FromEventPattern(Router.NavigationStack, nameof(Router.NavigationStack.CollectionChanged))
+ .Subscribe(_ => IsDialogVisible = Router.NavigationStack.Count >= 1);
+ }
+
+ public RoutingState Router { get; } = new RoutingState();
+
+ public ReactiveCommand<Unit, Unit> GoBack => Router.NavigateBack;
+
+ public bool IsDialogVisible
+ {
+ get => _isDialogVisible;
+ set => this.RaiseAndSetIfChanged(ref _isDialogVisible, value);
+ }
+
+ public void Close()
+ {
+ Router.NavigationStack.Clear();
+ }
+ }
+}

MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -3,7 +3,6 @@ using ReactiveUI;
using System.Reactive;
using WalletWasabi.Gui.ViewModels;
using WalletWasabi.Fluent.ViewModels.Dialogs;
-using System;
using Global = WalletWasabi.Gui.Global;
namespace WalletWasabi.Fluent.ViewModels
@@ -14,19 +13,23 @@ namespace WalletWasabi.Fluent.ViewModels
private NavigationStateViewModel _navigationState;
private StatusBarViewModel _statusBar;
private string _title = "Wasabi Wallet";
+ private DialogScreenViewModel _dialogScreen;
private DialogViewModelBase _currentDialog;
private NavBarViewModel _navBar;
public MainViewModel(Global global)
{
_global = global;
+ _dialogScreen = new DialogScreenViewModel();
+
// TODO: Set Dialog with IScreen implementation
// TODO: Set default NextView
// TODO: Set default CancelView
_navigationState = new NavigationStateViewModel()
{
DialogHost = () => this,
- Screen = () => this
+ Screen = () => this,
+ Dialog = () => _dialogScreen
};
Network = global.Network;
@@ -46,6 +49,12 @@ namespace WalletWasabi.Fluent.ViewModels
public Network Network { get; }
+ public DialogScreenViewModel DialogScreen
+ {
+ get => _dialogScreen;
+ set => this.RaiseAndSetIfChanged(ref _dialogScreen, value);
+ }
+
public DialogViewModelBase CurrentDialog
{
get => _currentDialog;

MODIFY
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
WalletWasabi.Fluent/ViewModels/SettingsPageViewModel.cs
@@ -23,6 +23,8 @@ namespace WalletWasabi.Fluent.ViewModels
OpenDialogCommand = ReactiveCommand.CreateFromTask(async () => await ConfirmSetting.Handle("Please confirm the setting:").ToTask());
+ OpenDialogScreenCommand = ReactiveCommand.Create(() => navigationState.Dialog().Router.Navigate.Execute(new HomePageViewModel(navigationState)));
+
ConfirmSetting = new Interaction<string, bool>();
ConfirmSetting.RegisterHandler(
@@ -63,6 +65,7 @@ namespace WalletWasabi.Fluent.ViewModels
public ICommand NextCommand { get; }
public ICommand OpenDialogCommand { get; }
+ public ICommand OpenDialogScreenCommand { get; }
public Interaction<string, bool> ConfirmSetting { get; }
public ICommand ChangeThemeCommand { get; }

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
</DockPanel>
</Panel>
</SplitView>
+ <Panel DataContext="{Binding DialogScreen}" IsVisible="{Binding IsDialogVisible}">
+ <Panel Background="{DynamicResource DialogOverlayColor}"/>
+ <Border Background="{DynamicResource DialogBackground}" VerticalAlignment="Center" HorizontalAlignment="Center" MinWidth="750" MinHeight="450">
+ <rxui:RoutedViewHost Router="{Binding Router}">
+ <rxui:RoutedViewHost.ViewLocator>
+ <vl:ScreenViewLocator />
+ </rxui:RoutedViewHost.ViewLocator>
+ <rxui:RoutedViewHost.PageTransition>
+ <CrossFade Duration="0:0:0.25" />
+ </rxui:RoutedViewHost.PageTransition>
+ <rxui:RoutedViewHost.DefaultContent>
+ <TextBlock Text="Default content"
+ HorizontalAlignment="Center"
+ VerticalAlignment="Center" />
+ </rxui:RoutedViewHost.DefaultContent>
+ </rxui:RoutedViewHost>
+ </Border>
+ </Panel>
<c:Dialog DataContext="{Binding CurrentDialog}" Content="{Binding }" IsDialogOpen="{Binding IsDialogOpen, Mode=TwoWay}" />
</Panel>
</UserControl>

MODIFY
WalletWasabi.Fluent/Views/SettingsPageView.axaml
WalletWasabi.Fluent/Views/SettingsPageView.axaml
<StackPanel Spacing="10">
<Button Command="{Binding NextCommand}" Content="Next" />
<Button Command="{Binding OpenDialogCommand}" Content="Open Dialog" />
+ <Button Command="{Binding OpenDialogScreenCommand}" Content="Open Dialog Screen" />
<Button Command="{Binding ChangeThemeCommand}" Content="Change Theme" />
<TextBox Watermark="Type here..."/>
<TextBox Watermark="Type here... #2"/>

Dialog screen prototype