public ApplicationViewModel() { QuitCommand = ReactiveCommand.CreateFromTask(async() => { if (CanShutdown()) { if (Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktopLifetime) { desktopLifetime.Shutdown(); } } else { // Show the window if it was hidden. ShowRequested?.Invoke(this, EventArgs.Empty); await MainViewModel.Instance !.CompactDialogScreen.NavigateDialogAsync(new Dialogs.ShowErrorDialogViewModel( "Wasabi is currently anonymising your wallet. Please try again in a few seconds.", "Warning", "Unable to close")); } }); ShowCommand = ReactiveCommand.Create(() => ShowRequested?.Invoke(this, EventArgs.Empty)); }
public App() { Name = "Wasabi Wallet"; ApplicationViewModel applicationViewModel = new(); DataContext = applicationViewModel; applicationViewModel.ShowRequested += (sender, args) => ShowRequested?.Invoke(sender, args); }
public ApplicationViewModel() { QuitCommand = ReactiveCommand.CreateFromTask(async() => { if (CanShutdown()) { if (Application.Current?.ApplicationLifetime is IControlledApplicationLifetime lifetime) { lifetime.Shutdown(); } } else { // Show the window if it was hidden. ShowRequested?.Invoke(this, EventArgs.Empty); await MainViewModel.Instance.CompactDialogScreen.NavigateDialogAsync(new Dialogs.ShowErrorDialogViewModel( "Wasabi is currently anonymising your wallet. Please try again in a few minutes.", "Warning", "Unable to close right now")); } }); ShowCommand = ReactiveCommand.Create(() => ShowRequested?.Invoke(this, EventArgs.Empty)); var dialogScreen = MainViewModel.Instance.DialogScreen; AboutCommand = ReactiveCommand.Create( () => dialogScreen.To(new AboutViewModel(navigateBack: dialogScreen.CurrentPage is not null)), canExecute: dialogScreen.WhenAnyValue(x => x.CurrentPage) .SelectMany(x => { return(x switch { null => Observable.Return(true), AboutViewModel => Observable.Return(false), _ => x.WhenAnyValue(page => page.IsBusy).Select(isBusy => !isBusy) }); }));
/// <summary> /// Raise event. /// </summary> /// <remarks> /// This method is intended to be called by an instance other than that instantiated this object. /// </remarks> public void RaiseShowRequested() { ShowRequested?.Invoke(this, EventArgs.Empty); }
public void ShowView() { ShowRequested?.Invoke(); }
/// <summary> /// Raise event. /// </summary> /// <remarks> /// This method is intended to be called by an instance other than that instantiated this object. /// </remarks> public void RaiseShowRequested() { ShowRequested?.Invoke(this, null); }
public void ShowRequest() { // This method will be called by an instance other than one which instantiated this object. App.Current.Dispatcher.Invoke(() => ShowRequested?.Invoke(this, null)); }