Beispiel #1
0
        public async void LoadDatabasesAsync()
        {
            Databases.Clear();
            LoadConnection = true;
            Cores.ModelCore _modelCore = new Cores.ModelCore(connection);
            var             databases  = await Task.Run(() => _modelCore.DataBases());

            foreach (var dbName in databases)
            {
                var db = new Database
                {
                    DatabaseName   = dbName,
                    ParentTreeBase = this,
                    Tables         = new ObservableCollection <Table>()
                };

                var tables = await Task.Run(() => _modelCore.Tables(dbName));

                foreach (var tableName in tables)
                {
                    db.Tables.Add(new Table()
                    {
                        TableName = tableName, ParentTreeBase = this, DataBaseName = db.DatabaseName
                    });
                }
                Databases.Add(db);
            }

            if (_modelCore.Errors.Count > 0)
            {
                Errors = _modelCore.Errors;
            }

            LoadConnection = false;
        }
Beispiel #2
0
        public async void LoadTablesAsync()
        {
            LoadConnection = true;

            Cores.ModelCore _modelCore = new Cores.ModelCore(ParentTreeBase.Connection);

            Tables.Clear();
            var tables = await Task.Run(() => _modelCore.Tables(DatabaseName));

            foreach (var tableName in tables)
            {
                Tables.Add(new Table()
                {
                    TableName = tableName, ParentTreeBase = ParentTreeBase, DataBaseName = DatabaseName
                });
            }

            if (_modelCore.Errors.Count > 0)
            {
                Errors = _modelCore.Errors;
            }

            LoadConnection = false;
        }