Exemplo n.º 1
0
        public OverviewViewModel(Global global, IMainThreadInvoker mainThreadInvoker)
        {
            _global            = global;
            _mainThreadInvoker = mainThreadInvoker;
            Transactions       = new ObservableCollection <TransactionViewModel>();

            if (_global.HasWalletFile() && _global.Wallet == null)
            {
                _global.SetDefaultWallet();
                Task.Run(async() => await LoadWalletAsync());

                TryWriteTableFromCache();
            }

            _hasSeed = this.WhenAnyValue(x => x._global.UiConfig.HasSeed)
                       .ToProperty(this, nameof(HasSeed));

            _isBackedUp = this.WhenAnyValue(x => x._global.UiConfig.IsBackedUp)
                          .ToProperty(this, nameof(IsBackedUp));

            var canBackUp = this.WhenAnyValue(x => x.HasSeed, x => x.IsBackedUp,
                                              (hasSeed, isBackedUp) => hasSeed && !isBackedUp);

            canBackUp.ToProperty(this, x => x.CanBackUp, out _canBackUp);

            Balance = _global.UiConfig.Balance;

            Initializing += OnInit;
            Initializing(this, EventArgs.Empty);
        }
Exemplo n.º 2
0
        public OverviewViewModel(ChaincaseWalletManager walletManager, Config config, UiConfig uiConfig, BitcoinStore bitcoinStore, IMainThreadInvoker mainThreadInvoker)
        {
            _walletManager     = walletManager;
            _config            = config;
            _uiConfig          = uiConfig;
            _bitcoinStore      = bitcoinStore;
            _mainThreadInvoker = mainThreadInvoker;
            Transactions       = new ObservableCollection <TransactionViewModel>();

            if (_walletManager.HasDefaultWalletFile() && _walletManager.CurrentWallet == null)
            {
                _walletManager.SetDefaultWallet();
                Task.Run(async() => await LoadWalletAsync());

                TryWriteTableFromCache();
            }

            _hasSeed = this.WhenAnyValue(x => x._uiConfig.HasSeed)
                       .ToProperty(this, nameof(HasSeed));

            _isBackedUp = this.WhenAnyValue(x => x._uiConfig.IsBackedUp)
                          .ToProperty(this, nameof(IsBackedUp));

            var canBackUp = this.WhenAnyValue(x => x.HasSeed, x => x.IsBackedUp,
                                              (hasSeed, isBackedUp) => hasSeed && !isBackedUp);

            canBackUp.ToProperty(this, x => x.CanBackUp, out _canBackUp);

            Balance = _uiConfig.Balance;

            Initializing += OnInit;
            Initializing(this, EventArgs.Empty);
        }
Exemplo n.º 3
0
 public MainWindowViewModel(ICANReader canReader, IMainThreadInvoker mainThreadInvoker, IDependencyInjection di)
 {
     this.di                            = di;
     this.canReader                     = canReader;
     this.mainThreadInvoker             = mainThreadInvoker;
     this.messageReceived               = HandleCANQueue;
     this.canReader.CANMessageReceived += CanReader_CANMessageReceived_RemoteThread;
 }
 public ClipboardDataControlPackageFactory(
     IClipboardDataPackageFactory dataPackageFactory,
     IEnumerable <IClipboardDataControlFactory> controlFactories,
     IMainThreadInvoker mainThreadInvoker)
 {
     this.dataPackageFactory = dataPackageFactory;
     this.controlFactories   = controlFactories;
     this.mainThreadInvoker  = mainThreadInvoker;
 }
 public ClipboardDataControlPackageFactory(
     IClipboardDataPackageFactory dataPackageFactory,
     IEnumerable<IClipboardDataControlFactory> controlFactories,
     IMainThreadInvoker mainThreadInvoker)
 {
     this.dataPackageFactory = dataPackageFactory;
     this.controlFactories = controlFactories;
     this.mainThreadInvoker = mainThreadInvoker;
 }
 public void Setup()
 {
     _doWorkCalled = false;
     _progressChangedCalled = false;
     _completed = false;
     _mainThreadInvloker = MockRepository.GenerateStub<IMainThreadInvoker>();
     _backgroundWorkerInvoker = new BackgroundWorkerInvoker(_mainThreadInvloker);
     _backgroundWorkerInvoker.ProgressChanged += (sender, e) => _progressChangedCalled = true;
     _backgroundWorkerInvoker.DoWork += (sender, e) => _doWorkCalled = true;
     _backgroundWorkerInvoker.RunWorkerAsync();
     _backgroundWorkerInvoker.RunWorkerCompleted += (sender, args) => _completed = true;
 }
Exemplo n.º 7
0
        public PasteCombinationDurationMediator(
            IPasteHotkeyInterceptor pasteHotkeyInterceptor,
            IConsumerThreadLoop threadLoop,
            IThreadDelay threadDelay,
            IMainThreadInvoker mainThreadInvoker,
            ILogger logger)
        {
            this.pasteHotkeyInterceptor = pasteHotkeyInterceptor;
            this.threadLoop             = threadLoop;
            this.threadDelay            = threadDelay;
            this.mainThreadInvoker      = mainThreadInvoker;
            this.logger = logger;

            threadCancellationTokenSource = new CancellationTokenSource();
        }
        public PasteCombinationDurationMediator(
            IPasteHotkeyInterceptor pasteHotkeyInterceptor,
            IConsumerThreadLoop threadLoop,
            IThreadDelay threadDelay,
            IMainThreadInvoker mainThreadInvoker,
            ILogger logger)
        {
            this.pasteHotkeyInterceptor = pasteHotkeyInterceptor;
            this.threadLoop = threadLoop;
            this.threadDelay = threadDelay;
            this.mainThreadInvoker = mainThreadInvoker;
            this.logger = logger;

            threadCancellationTokenSource = new CancellationTokenSource();
        }
 public PasteCombinationDurationMediator(
     IPasteDetectionHandler pasteDetectionHandler,
     IConsumerThreadLoop consumerLoop,
     ISettingsViewModel settingsViewModel,
     IThreadDelay threadDelay,
     IMainThreadInvoker mainThreadInvoker,
     ILogger logger,
     IKeyboardPasteCombinationStateService keyboardPasteState)
 {
     this.pasteDetectionHandler = pasteDetectionHandler;
     this.consumerLoop          = consumerLoop;
     this.settingsViewModel     = settingsViewModel;
     this.threadDelay           = threadDelay;
     this.mainThreadInvoker     = mainThreadInvoker;
     this.logger             = logger;
     this.keyboardPasteState = keyboardPasteState;
 }
Exemplo n.º 10
0
        public IndexViewModel(Global global, IMainThreadInvoker mainThreadInvoker)
        {
            _global            = global;
            _mainThreadInvoker = mainThreadInvoker;
            Transactions       = new ObservableCollection <TransactionViewModel>();

            if (_global.HasWalletFile() && _global.Wallet == null)
            {
                _global.SetDefaultWallet();
                Task.Run(async() => await LoadWalletAsync());

                TryWriteTableFromCache();
            }

            Balance = _global.UiConfig.Balance;

            Initializing += OnInit;
            Initializing(this, EventArgs.Empty);
        }
Exemplo n.º 11
0
 public FileRetrieverServiceService(IMainThreadInvoker mainThreadInvoker, IFileInfoImplemantation fileInfoImplemantation)
 {
     _mainThreadInvoker = mainThreadInvoker;
     _fileInfoImplemantation = fileInfoImplemantation;
     _files = new List<string>();
 }
Exemplo n.º 12
0
 public TrayIconManager(
     IMainThreadInvoker mainThreadInvoker)
 {
     trayIcon = new NotifyIcon();
     this.mainThreadInvoker = mainThreadInvoker;
 }
Exemplo n.º 13
0
 public AsyncActionInvoker(IBackgroundThreadInvoker backgroundThreadInvoker, IMainThreadInvoker mainThreadInvoker)
 {
     _backgroundThreadInvoker = backgroundThreadInvoker;
     _mainThreadInvoker = mainThreadInvoker;
 }