コード例 #1
0
        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));
        }
コード例 #2
0
ファイル: App.axaml.cs プロジェクト: danwalmsley/WalletWasabi
        public App()
        {
            Name = "Wasabi Wallet";
            ApplicationViewModel applicationViewModel = new();

            DataContext = applicationViewModel;
            applicationViewModel.ShowRequested += (sender, args) => ShowRequested?.Invoke(sender, args);
        }
コード例 #3
0
    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)
            });
        }));
コード例 #4
0
ファイル: RemotingHolder.cs プロジェクト: reflecat/Monitorian
 /// <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);
 }
コード例 #5
0
ファイル: ViewModel.cs プロジェクト: laptou/tsa-2017
 public void ShowView()
 {
     ShowRequested?.Invoke();
 }
コード例 #6
0
ファイル: RemotingHolder.cs プロジェクト: rivy/Monitorian
 /// <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);
 }
コード例 #7
0
 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));
 }