示例#1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            xdagRuntime = new XDagRuntime(xdagWallet);
            refreshingTransactionHistory = new RefreshingOperation(() => { this.LoadTransactionHistory(); }, TimeSpan.FromMinutes(1));

            xdagWallet.SetPromptInputPasswordFunction((prompt, passwordSize) =>
            {
                return(this.Dispatcher.Invoke(() =>
                {
                    return InputPassword(prompt, passwordSize);
                }));
            });

            xdagWallet.SetStateChangedAction((state) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    OnUpdatingState(state);
                });
            });

            xdagWallet.SetAddressChangedAction((address) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    OnUpdatingAddress(address);
                });
            });

            xdagWallet.SetBalanceChangedAction((balance) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    OnUpdatingBalance(balance);
                });
            });

            OnUpdatingState(xdagWallet.State);
            OnUpdatingAddress(xdagWallet.Address);
            OnUpdatingBalance(xdagWallet.Balance);

            Load_LocalizedStrings();

            xdagRuntime.RefreshData();

            refreshWalletDataRepeatTimer.Start();

            dgdTransactionHistorySimple.ItemsSource = transactionHistory;
            fillTransactionHistoryTimer.Start();
        }
示例#2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            xdagWallet = new XDagWallet();
            runtime    = new XDagRuntime(xdagWallet);

            registeringTimer          = new System.Timers.Timer();
            registeringTimer.Interval = 1000;
            registeringTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.OnRegisteringTimerTick);


            Load_LocalizedStrings();

            xdagWallet.SetPromptInputPasswordFunction((prompt, passwordSize) =>
            {
                return(this.Dispatcher.Invoke(() =>
                {
                    return InputPassword(prompt, passwordSize);
                }));
            });

            xdagWallet.SetUpdateStateFunction((state, balance, address) =>
            {
                return(this.Dispatcher.Invoke(() =>
                {
                    return UpdateState(state, balance, address);
                }));
            });

            xdagWallet.SetStateChangedAction((state) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    UpdateState(state);
                });
            });

            xdagWallet.SetMessageAction((message) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    OnMessage(message);
                });
            });

            xdagWallet.SetErrorAction((err) =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    OnError(err);
                });
            });

            if (!runtime.HasExistingAccount())
            {
                btnRegisterAccount.Visibility = Visibility.Visible;
                btnConnectAccount.Visibility  = Visibility.Hidden;
            }
            else
            {
                btnConnectAccount.Visibility  = Visibility.Visible;
                btnRegisterAccount.Visibility = Visibility.Hidden;
            }
        }