Пример #1
0
        public DatabasesExplorerViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentFilesProvider recentFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentFilesProvider;

            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 <RecentFileInfo>(OpenRecentItem);

            NodeDefaulActionCommand = new AsyncCommand <object>(NodeDefaultAction);

            Store.Current.Databases.CollectionChanged += OnDatabasesCollectionChanged;
        }
        public DatabasesExplorerViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentFilesProvider recentFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentFilesProvider;

            OpenRecentItemCommand  = new RelayCommand <RecentFileInfo>(async info => await OpenRecentItem(info));
            ItemDoubleClickCommand = new RelayCommand <CollectionReference>(async reference => await NodeDoubleClick(reference));

            SaveDatabaseCopyAsCommand = new RelayCommand(async _ => await SaveDatabaseCopyAs(), o => CanSaveDatabaseCopyAs());
            CloseDatabaseCommand      = new RelayCommand(async _ => await CloseDatabase(), o => CanCloseDatabase());
            AddFileCommand            = new RelayCommand(async _ => await AddFile(), _ => CanAddFile());
            AddCollectionCommand      = new RelayCommand(async _ => await AddCollection(), _ => CanAddCollection());
            RefreshDatabaseCommand    = new RelayCommand(_ => RefreshDatabase(), _ => CanRefreshDatabase());
            RevealInExplorerCommand   = new RelayCommand(async _ => await RevealInExplorer(), _ => CanRevealInExplorer());
            RenameCollectionCommand   = new RelayCommand(async _ => await RenameCollection(), _ => CanRenameCollection());
            DropCollectionCommand     = new RelayCommand(async _ => await DropCollection(), _ => CanDropCollection());
            ExportCollectionCommand   = new RelayCommand(async _ => await ExportCollection(), _ => CanExportCollection());
            EditDbPropertiesCommand   = new RelayCommand(_ => EditDbProperties(), _ => CanEditDbProperties());
            ImportDataCommand         = new RelayCommand(_ => ImportData(), _ => CanImportData());

            Store.Current.Databases.CollectionChanged += (sender, args) =>
            {
                Commands.ShowNavigationPanel.MainExecute(true);
            };
        }
Пример #3
0
        public ShellMenuViewModel(
            IDatabaseInteractions databaseInteractions,
            IWindowManager windowManager,
            IApplicationInteraction applicationInteraction,
            IEventAggregator eventAggregator,
            IRecentFilesProvider recentFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _windowManager          = windowManager;
            _applicationInteraction = applicationInteraction;
            _eventAggregator        = eventAggregator;

            PathDefinitions = recentFilesProvider;
        }
Пример #4
0
        public StartPageViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentFilesProvider recentFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentFilesProvider;

            ShowStartPageOnOpen = Properties.Settings.Default.ShowStartPageOnOpen;

            PathDefinitions.RecentFiles.CollectionChanged += (sender, args) =>
            {
                NotifyOfPropertyChange(nameof(RecentFilesIsEmpty));
            };
        }
        public DatabasesExplorerViewModel(
            IDatabaseInteractions databaseInteractions,
            IApplicationInteraction applicationInteraction,
            IRecentFilesProvider recentFilesProvider)
        {
            _databaseInteractions   = databaseInteractions;
            _applicationInteraction = applicationInteraction;

            PathDefinitions = recentFilesProvider;

            OpenRecentItemCommand  = new RelayCommand <RecentFileInfo>(async info => await OpenRecentItem(info));
            ItemDoubleClickCommand = new RelayCommand <CollectionReference>(async reference => await NodeDoubleClick(reference));

            SaveDatabaseCopyAsCommand = new RelayCommand(async _ => await SaveDatabaseCopyAs(), o => CanSaveDatabaseCopyAs());
            CloseDatabaseCommand      = new RelayCommand(async _ => await CloseDatabase(), o => CanCloseDatabase());
            AddFileCommand            = new RelayCommand(async _ => await AddFile(), _ => CanAddFile());
            AddCollectionCommand      = new RelayCommand(async _ => await AddCollection(), _ => CanAddCollection());
            RefreshDatabaseCommand    = new RelayCommand(_ => RefreshDatabase(), _ => CanRefreshDatabase());
            RevealInExplorerCommand   = new RelayCommand(async _ => await RevealInExplorer(), _ => CanRevealInExplorer());
            RenameCollectionCommand   = new RelayCommand(async _ => await RenameCollection(), _ => CanRenameCollection());
            DropCollectionCommand     = new RelayCommand(async _ => await DropCollection(), _ => CanDropCollection());
            ExportCollectionCommand   = new RelayCommand(async _ => await ExportCollection(), _ => CanExportCollection());
            EditDbPropertiesCommand   = new RelayCommand(_ => EditDbProperties(), _ => CanEditDbProperties());
        }
Пример #6
0
 public DatabaseInteractions(IApplicationInteraction applicationInteraction, IRecentFilesProvider recentFilesProvider)
 {
     _applicationInteraction = applicationInteraction;
     _recentFilesProvider    = recentFilesProvider;
 }