Esempio n. 1
0
        public OpenWithPassword()
        {
            this.InitializeComponent();

            _settings = new WalletCreateSettings();

            this.Loaded += OpenWithPassword_Loaded;
        }
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _settings = e.Parameter as WalletCreateSettings;

            if (!string.IsNullOrEmpty(_settings.restoreKey))
            {
                cmdBar.Content = "Restore your wallet";
            }

            base.OnNavigatedTo(e);
        }
Esempio n. 3
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _settings = e.Parameter as WalletCreateSettings;

            _cancel = new CancellationTokenSource();
            // redux
            App.Store.Select(state => state)
            .Subscribe(w =>
            {
                //Device.BeginInvokeOnMainThread(async () =>
                //{
                //    UserDialogs.Instance.HideLoading();

                if (w.IsOpening)
                {
                    _cancel.Cancel();
                    App.WalletSubscribeCancellation = new CancellationTokenSource();
                    //App.Current.MainPage = new AppShell();
                }
                else if (w.ErrorMessage != null)
                {
                }
                //await DisplayAlert("Warnning", "Wallet creation or restore failed.\n\n" + w.ErrorMessage, "Confirm");
                //});
            }, _cancel.Token);

            // create or restore then goto appshell
            string path = null;

#if !__WASM__
            path = Windows.Storage.ApplicationData.Current.LocalFolder.Path;
#endif

            if (string.IsNullOrWhiteSpace(_settings.restoreKey))
            {
                var oAct = new WalletCreateAction
                {
                    network  = _settings.network,
                    name     = "default",
                    password = _settings.password,
                    path     = path
                };

                _ = Task.Run(() => { App.Store.Dispatch(oAct); });
            }
            else
            {
                // create or restore then goto appshell
                var oAct = new WalletRestoreAction
                {
                    privateKey = _settings.restoreKey,
                    network    = _settings.network,
                    name       = "default",
                    password   = _settings.password,
                    path       = path
                };

                _ = Task.Run(() => { App.Store.Dispatch(oAct); });
            }

            base.OnNavigatedTo(e);
        }