public OpenDatabaseViewModel(
            INavigationService navigationService,
            IDatabaseInfoRepository databaseInfoRepository,
            ICanSHA256Hash hasher,
            IDialogService dialogService,
            IPWDatabaseDataSource databaseSource,
            ICache cache)
        {
            _cache = cache;
            _databaseSource = databaseSource;
            _dialogService = dialogService;
            _databaseInfoRepository = databaseInfoRepository;
            _hasher = hasher;
            _navigationService = navigationService;
            var canHitOpen = this.WhenAny(
                vm => vm.Password, 
                vm => vm.KeyFileName,
                (p, k) => !string.IsNullOrEmpty(p.Value) || !string.IsNullOrEmpty(k.Value));

            OpenCommand = new ReactiveCommand(canHitOpen);
            OpenCommand.Subscribe(OpenDatabase);

            GetKeyFileCommand = new ReactiveCommand();
            GetKeyFileCommand.Subscribe(GetKeyFile); 
            
            ClearKeyFileCommand = new ReactiveCommand();
            ClearKeyFileCommand.Subscribe(ClearKeyFile);

            IObservable<string> keyFileNameChanged = this.WhenAny(vm => vm.KeyFileName, kf => kf.Value);
            keyFileNameChanged.Subscribe(v => ClearKeyFileButtonIsVisible = !string.IsNullOrWhiteSpace(v));
            keyFileNameChanged.Subscribe(v => GetKeyFileButtonIsVisible = string.IsNullOrWhiteSpace(v));
        }
        public FolderPickerViewModel(IEventAggregator eventAggregator,
            IPWDatabaseDataSource dataSource)
        {
            _dataSource = dataSource;
            _eventAggregator = eventAggregator;

            Mode = FolderPickerMode.Move;
            FillGroups(_dataSource.PwDatabase.Tree.Group, 0);
        }
 public AddOrEditGroupViewModel(INavigationService navigationService,
     IPWDatabaseDataSource databaseSource)
 { 
     _databaseSource = databaseSource;
     _navigationService = navigationService;
     this.ObservableForPropertyNotNull(vm => vm.GroupUuid).Subscribe(GetGroup);
     this.ObservableForPropertyNotNull(vm => vm.ParentGroupUuid).Subscribe(GetParentGroup);
     this.ObservableForPropertyNotNull(vm => vm.GroupName).Subscribe(SetupCanSave);            
 }
Exemplo n.º 4
0
 public AddGroupViewModel(
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IPageServices pageServices,
     IPWDatabaseDataSource dataSource)
     : base(navigationService, eventAggregator, pageServices)
 {
     _dataSource = dataSource;
     _navigationService = navigationService;
 }
 public NewDatabaseViewModel(
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IPageServices pageServices,
     IPWDatabaseDataSource dataSource) :
     base(navigationService, eventAggregator, pageServices)
 {
     _dataSource = dataSource;
     this._pageServices = pageServices;
     _navigationService = navigationService;
 }
 public SearchResultsViewModel(
     INavigationService navigationService,
     IEventAggregator eventAggregator,
     IClipboard clipboard,
     IPageServices pageServices,
     IPWDatabaseDataSource dataSource)
     : base(navigationService, eventAggregator, clipboard, pageServices)
 {
     _dataSource = dataSource;
     Results = new ObservableCollection<PwEntry>();
 }
 public EntriesListViewModel(INavigationService navigationService,
     IPWDatabaseDataSource databaseSource,
     ICloudProviderFactory cloudProvider,
     ICache cache,
     IDatabaseInfoRepository databaseInfoRepository,
     IDialogService dialogService)
 {
     _dialogService = dialogService;
     _databaseInfoRepository = databaseInfoRepository;
     _cache = cache;
     _cloudProvider = cloudProvider;
     _databaseSource = databaseSource;
     _navigationService = navigationService;   
     this.ObservableForProperty(vm => vm.GroupId)
         .Subscribe(x => GetGroup(x.Value));
     this.ObservableForProperty(vm => vm.SelectedItem)                
         .Subscribe(NavigateToEntriesListView);
     Items = new ObservableCollection<PwCommon>();
 }
        public ChooseCloudViewModel(
            INavigationService navigationService,
            IDatabaseInfoRepository databaseInfoRepository,
            ICanSHA256Hash hasher,
            IDialogService dialogService,
            IPWDatabaseDataSource databaseSource,
            ICache cache)
        {
            _cache = cache;
            _databaseSource = databaseSource;
            _dialogService = dialogService;
            _databaseInfoRepository = databaseInfoRepository;
            _hasher = hasher;
            _navigationService = navigationService;

            NavigateToSkyDriveCommand = new ReactiveCommand();
            NavigateToSkyDriveCommand.Subscribe(NavigateToSkyDrive);
            
            NavigateToDropboxCommand = new ReactiveCommand();
            NavigateToDropboxCommand.Subscribe(NavigateToDropbox);

            NavigateToCreateDemoCommand = new ReactiveCommand();
            NavigateToCreateDemoCommand.Subscribe(NavigateToCreateDemo);
        }
 public AddOrEditEntryViewModel(IPWDatabaseDataSource databaserSource)
 {
     _databaserSource = databaserSource;
 }
Exemplo n.º 10
0
 public LockingService(INavigationService navigationService,
     IPWDatabaseDataSource dataSource)
 {
     _dataSource = dataSource;
     this.navigationService = navigationService;
 }