public DatabasesExplorerViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentDatabaseFilesProvider recentDatabaseFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentDatabaseFilesProvider;

            CloseDatabaseCommand      = new AsyncCommand <DatabaseReference>(CloseDatabase, CanCloseDatabase, this);
            EditDbPropertiesCommand   = new AsyncCommand <DatabaseReference>(EditDbProperties, CanEditDbProperties, this);
            SaveDatabaseCopyAsCommand = new AsyncCommand <DatabaseReference>(SaveDatabaseCopyAs, CanSaveDatabaseCopyAs, this);
            AddFileCommand            = new AsyncCommand <DatabaseReference>(AddFile, CanAddFile, this);
            AddCollectionCommand      = new AsyncCommand <DatabaseReference>(AddCollection, CanAddCollection, this);
            RefreshDatabaseCommand    = new AsyncCommand <DatabaseReference>(RefreshDatabase, CanRefreshDatabase, this);
            RevealInExplorerCommand   = new AsyncCommand <DatabaseReference>(RevealInExplorer, CanRevealInExplorer, this);

            RenameCollectionCommand = new AsyncCommand <CollectionReference>(RenameCollection, CanRenameCollection, this);
            DropCollectionCommand   = new AsyncCommand <CollectionReference>(DropCollection, CanDropCollection, this);
            ExportCollectionCommand = new AsyncCommand <CollectionReference>(ExportCollection, CanExportCollection, this);

            ImportDataCommand = new RelayCommand(_ => ImportData(), _ => CanImportData());

            OpenRecentItemCommand = new AsyncCommand <RecentDatabaseFileInfo>(OpenRecentItem);

            NodeDefaulActionCommand = new AsyncCommand <object>(NodeDefaultAction);

            Store.Current.Databases.CollectionChanged += OnDatabasesCollectionChanged;
        }
Exemplo n.º 2
0
        public StartPageViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentDatabaseFilesProvider recentDatabaseFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentDatabaseFilesProvider;

            ShowStartPageOnOpen = Properties.Settings.Default.ShowStartPageOnOpen;

            var recentFilesTermFilter = this.WhenValueChanged(vm => vm.SearchTerm)
                                        .Throttle(TimeSpan.FromMilliseconds(150))
                                        .Select(CreatePredicate);

            _cleanUp = PathDefinitions.RecentFiles
                       .ToObservableChangeSet()
                       .Filter(recentFilesTermFilter)
                       .Sort(
                SortExpressionComparer <RecentDatabaseFileInfo>
                .Descending(p => p.FixedAt.HasValue)
                .ThenByDescending(p => p.FixedAt ?? p.LastOpenedAt)
                )
                       .ObserveOnDispatcher()
                       .Bind(out _recentFilesFiltered)
                       .Do(p =>
            {
                NotifyOfPropertyChange(nameof(RecentFilesListIsEmpty));
                NotifyOfPropertyChange(nameof(RecentFilesListEmptyMessage));
            })
                       .Subscribe();
        }
Exemplo n.º 3
0
        public ShellMenuViewModel(
            IDatabaseInteractions databaseInteractions,
            IWindowManager windowManager,
            IApplicationInteraction applicationInteraction,
            IEventAggregator eventAggregator,
            IRecentDatabaseFilesProvider recentDatabaseFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _windowManager          = windowManager;
            _applicationInteraction = applicationInteraction;
            _eventAggregator        = eventAggregator;

            PathDefinitions = recentDatabaseFilesProvider;
        }
Exemplo n.º 4
0
 public DatabaseInteractions(IApplicationInteraction applicationInteraction, IRecentDatabaseFilesProvider recentDatabaseFilesProvider)
 {
     _applicationInteraction      = applicationInteraction;
     _recentDatabaseFilesProvider = recentDatabaseFilesProvider;
 }