예제 #1
0
        public async Task SetupRemoteCollections()
        {
            string connection = SettingsVm.LocalConnectionString;

            try
            {
                RemoteDatabaseCollections.Clear();

                _remoteBooksReadDatabase = new BooksReadDatabase(connection, true);
                _remoteBooksReadDatabase.MongoClientFunc = GetRemoteConnection;
                //_remoteBooksReadDatabase.ResetLoadedItems();
                _remoteBooksReadDatabase.ConnectToDatabase();
                RemoteDatabaseCollections.Add(new DataCollectionSettings(_remoteBooksReadDatabase));

                _remoteNationDatabase = new NationDatabase(connection, true);
                _remoteNationDatabase.MongoClientFunc = GetRemoteConnection;
                //_remoteNationDatabase.ResetLoadedItems();
                _remoteNationDatabase.ConnectToDatabase();
                RemoteDatabaseCollections.Add(new DataCollectionSettings(_remoteNationDatabase));

                _remoteUserDatabase = new UserDatabase(connection, true);
                _remoteUserDatabase.MongoClientFunc = GetRemoteConnection;
                //_remoteUserDatabase.ResetLoadedItems();
                _remoteUserDatabase.ConnectToDatabase();
                RemoteDatabaseCollections.Add(new DataCollectionSettings(_remoteUserDatabase));

                NotifyOfPropertyChange(() => RemoteDatabaseCollections);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TesterViewModel"/> class.
        /// </summary>
        public TesterViewModel()
        {
            _booksReadFromDatabase   = new ObservableCollection <BookRead>();
            _nationsReadFromDatabase = new ObservableCollection <Nation>();

            _booksReadDatabase   = new BooksReadDatabase(DatabaseConnectionString);
            _nationsReadDatabase = new NationDatabase(DatabaseConnectionString);

            _basePieChart = new BasePieChartViewModel();
            SetupPieChartTypesByTitle();

            _baseScatterChart = new BaseScatterChartViewModel();
            SetupScatterChartTypesByTitle();

            _baseLineChart = new BaseLineChartViewModel();
            SetupLineChartTypesByTitle();

            _baseGeoMapChart = new BaseGeoMapChartViewModel();
            SetupGeoMapChartTypesByTitle();

            _baseMultipleAxisLineChart = new BaseMultipleAxisLineChartViewModel();
            SetupMultipleAxisLineChartTypesByTitle();

            _baseColumnChart = new BaseColumnChartViewModel();
            SetupColumnChartTypesByTitle();

            _baseStackedAreaChart = new BaseStackedAreaChartViewModel();
            SetupStackedAreaChartTypesByTitle();
        }
예제 #3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            _booksReadFromDatabase   = new ObservableCollection <BookRead>();
            _nationsReadFromDatabase = new ObservableCollection <Nation>();

            _booksReadDatabase   = new BooksReadDatabase(DatabaseConnectionString);
            _nationsReadDatabase = new NationDatabase(DatabaseConnectionString);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseTesterViewModel"/> class.
        /// </summary>
        public BaseTesterViewModel()
        {
            _booksReadFromDatabase   = new ObservableCollection <BookRead>();
            _nationsReadFromDatabase = new ObservableCollection <Nation>();
            _usersReadFromDatabase   = new ObservableCollection <User>();

            _booksReadDatabase   = new BooksReadDatabase(DatabaseConnectionString);
            _nationsReadDatabase = new NationDatabase(DatabaseConnectionString);
            _usersReadDatabase   = new UserDatabase(DatabaseConnectionString);
        }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class.
        /// </summary>
        public MainViewModel()
        {
            _booksReadFromDatabase   = new ObservableCollection <BookRead>();
            _nationsReadFromDatabase = new ObservableCollection <Nation>();

            _booksReadDatabase   = new BooksReadDatabase(DatabaseConnectionString);
            _nationsReadDatabase = new NationDatabase(DatabaseConnectionString);

            _selectedPlot = PlotType.AverageDaysPerBook;

            _oxyPlotChart = new OxyPlotViewModel(_selectedPlot);

            SetupPlotTypesByTitle();
        }
예제 #6
0
        public async Task SetupLocalCollections()
        {
            string connection = SettingsVm.LocalConnectionString;

            LocalDatabaseCollections.Clear();
            _localBooksReadDatabase = new BooksReadDatabase(connection);
            _localBooksReadDatabase.ConnectToDatabase();
            LocalDatabaseCollections.Add(new DataCollectionSettings(_localBooksReadDatabase));

            _localNationDatabase = new NationDatabase(LocalConnectionString);
            _localNationDatabase.ConnectToDatabase();
            LocalDatabaseCollections.Add(new DataCollectionSettings(_localNationDatabase));

            _localUserDatabase = new UserDatabase(LocalConnectionString);
            _localUserDatabase.ConnectToDatabase();
            LocalDatabaseCollections.Add(new DataCollectionSettings(_localUserDatabase));

            NotifyOfPropertyChange(() => LocalDatabaseCollections);
        }
예제 #7
0
        public BooksDataControllerUtilities(MongoDbSettings dbSettings, SmtpConfig mailConfig) : base(dbSettings)
        {
            _smtpConfig = mailConfig;
            DatabaseConnectionString = dbSettings.DatabaseConnectionString;
            ExportDirectory          = dbSettings.ExportDirectory;

            _books = new ObservableCollection <Book>();

            _booksReadFromDatabase   = new ObservableCollection <BookRead>();
            _nationsReadFromDatabase = new ObservableCollection <Nation>();
            _usersReadFromDatabase   = new ObservableCollection <User>();

            if (!dbSettings.UseRemoteHost)
            {
                _booksReadDatabase   = new BooksReadDatabase(DatabaseConnectionString);
                _nationsReadDatabase = new NationDatabase(DatabaseConnectionString);
                _userDatabase        = new UserDatabase(DatabaseConnectionString);
            }
            else
            {
                _booksReadDatabase =
                    new BooksReadDatabase(string.Empty, false)
                {
                    MongoClientFunc = GetRemoteConnection
                };
                _booksReadDatabase.ConnectToDatabase();

                _nationsReadDatabase =
                    new NationDatabase(string.Empty, false)
                {
                    MongoClientFunc = GetRemoteConnection
                };
                _nationsReadDatabase.ConnectToDatabase();

                _userDatabase =
                    new UserDatabase(string.Empty, false)
                {
                    MongoClientFunc = GetRemoteConnection
                };
                _userDatabase.ConnectToDatabase();
            }
        }
예제 #8
0
        public MainViewModel()
        {
            SettingsVm = new SettingsViewModel();
            LocalDatabaseCollections  = new ObservableCollection <DataCollectionSettings>();
            RemoteDatabaseCollections = new ObservableCollection <DataCollectionSettings>();

            try
            {
                _localBooksReadDatabase = new BooksReadDatabase(SettingsVm.LocalConnectionString, false);
                _localNationDatabase    = new NationDatabase(SettingsVm.LocalConnectionString, false);
                _localUserDatabase      = new UserDatabase(SettingsVm.LocalConnectionString, false);

                LocalDatabaseCollections.Add(new DataCollectionSettings(_localBooksReadDatabase));
                LocalDatabaseCollections.Add(new DataCollectionSettings(_localNationDatabase));
                LocalDatabaseCollections.Add(new DataCollectionSettings(_localUserDatabase));

                RemoteDatabaseCollections.Add(new DataCollectionSettings());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }