public ImportSecretPhraseDialogViewModel(IWalletRepository walletRepository, IAccountLedgerRepository accountLedgerRepository)
        {
            _walletRepository        = walletRepository;
            _accountLedgerRepository = accountLedgerRepository;

            ImportSecretPhraseCommand = new RelayCommand(DoImport, () => !string.IsNullOrEmpty(SecretPhrase));
        }
 public AccountLedgersController(IAccountLedgerRepository accountLedgerRepo,
                                 IMapper mapper,
                                 ILogger <AccountLedgersController> logger)
 {
     _accountLedgerRepo = accountLedgerRepo;
     _mapper            = mapper;
     _logger            = logger;
 }
Exemplo n.º 3
0
        public AccountLedgerRunner(IWalletRepository walletRepository, INxtServer nxtServer,
                                   IAccountLedgerRepository accountLedgerRepository)
        {
            _walletRepository        = walletRepository;
            _nxtServer               = nxtServer;
            _accountLedgerRepository = accountLedgerRepository;

            Messenger.Default.Register <SecretPhraseResetMessage>(this, (message) => _cancellationTokenSource.Cancel());
        }
Exemplo n.º 4
0
        public ReceiveMoneyViewModel(IWalletRepository walletRepository, IAccountLedgerRepository accountLedgerRepository,
                                     INavigationService navigationService)
        {
            _walletRepository        = walletRepository;
            _accountLedgerRepository = accountLedgerRepository;
            _navigationService       = navigationService;

            MessengerInstance.Register <SecretPhraseResetMessage>(this, (message) => InitUiProperties());
            InitUiProperties();
        }
Exemplo n.º 5
0
        public SendMoneyViewModel(INxtServer nxtServer, IWalletRepository walletRepository,
                                  IAccountLedgerRepository accountLedgerRepository, IContactRepository contactRepository,
                                  INavigationService navigationService)
        {
            _nxtServer               = nxtServer;
            _walletRepository        = walletRepository;
            _accountLedgerRepository = accountLedgerRepository;
            _contactRepository       = contactRepository;
            _navigationService       = navigationService;

            SendMoneyCommand           = new RelayCommand(SendMoney, () => CanSendMoney());
            nxtServer.PropertyChanged += (sender, args) => SendMoneyCommand.RaiseCanExecuteChanged();
            ErrorsChanged             += (sender, args) => SendMoneyCommand.RaiseCanExecuteChanged();
            ClearFields();
        }
Exemplo n.º 6
0
        public SettingsViewModel(IWalletRepository walletRepository, INxtServer nxtServer, IAccountLedgerRepository accountLedgerRepository,
                                 INavigationService navigationService)
        {
            _walletRepository        = walletRepository;
            _nxtServer               = nxtServer;
            _accountLedgerRepository = accountLedgerRepository;
            _navigationService       = navigationService;

            SaveCommand = new RelayCommand(Save);
            ImportSecretPhraseCommand = new RelayCommand(() => _navigationService.ShowDialog(NavigationDialog.ImportSecretPhraseInfo));

            ServerAddress          = _walletRepository.NxtServer;
            IsNotificationsEnabled = _walletRepository.NotificationsEnabled;
            ReadOnlyAddress        = _walletRepository.IsReadOnlyAccount ? _walletRepository.NxtAccount.AccountRs : string.Empty;
            SecretPhrase           = _walletRepository.SecretPhrase;
        }
Exemplo n.º 7
0
        public OverviewViewModel(IWalletRepository walletRepository, IAccountLedgerRunner accountLedgerRunner, IAccountLedgerRepository accountLedgerRepository,
                                 IContactRepository contactRepository)
        {
            _walletRepository        = walletRepository;
            _accountLedgerRepository = accountLedgerRepository;
            _contactRepository       = contactRepository;
            InitUiProperties();

            MessengerInstance.Register <LedgerEntryMessage>(this, (message) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() =>
                {
                    if (message.Action == LedgerEntryMessageAction.Added)
                    {
                        InsertLedgerEntry(message.LedgerEntry);
                    }
                    else if (message.Action == LedgerEntryMessageAction.ConfirmationUpdated)
                    {
                        var existingLedgerEntry         = LedgerEntries.Single(t => t.Equals(message.LedgerEntry));
                        existingLedgerEntry.IsConfirmed = message.LedgerEntry.IsConfirmed;
                    }
                    else if (message.Action == LedgerEntryMessageAction.Removed)
                    {
                        LedgerEntries.Remove(LedgerEntries.Single(t => t.Equals(message.LedgerEntry)));
                    }
                });
            });

            MessengerInstance.Register <BalanceUpdatedMessage>(this, (message) =>
            {
                DispatcherHelper.CheckBeginInvokeOnUI(() => NxtBalance = message.NqtBalance.NqtToNxt());
            });

            MessengerInstance.Register <SecretPhraseResetMessage>(this, (message) =>
            {
                InitUiProperties();
                LedgerEntries.Clear();
            });

            LedgerEntries = new ObservableCollection <LedgerEntry>();
            LoadLedgerEntriesFromRepository();
        }