Ejemplo n.º 1
0
        private void Connect(ServerViewModel server)
        {
            var frm = new LoginWindow(server.Name);
            frm.Owner = this;
            frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            if (frm.ShowDialog() == true) {
                server.Server = frm.Server;
                foreach (Database db in server.Server.Databases) {
                    try {
                        if (db.Tables.Contains("tblMaterial") && db.Tables.Contains("tblBiota")) {
                            var vm = new DatabaseViewModel(db);
                            server.Children.Add(vm);
                        }
                    } catch (Exception) {

                    }
                }
                server.IsExpanded = true;
            }
        }
Ejemplo n.º 2
0
        private void Connect(ServerViewModel server)
        {
            var frm = new LoginWindow(server.Name);

            frm.Owner = this;
            frm.WindowStartupLocation = System.Windows.WindowStartupLocation.CenterOwner;
            if (frm.ShowDialog() == true)
            {
                server.Server = frm.Server;
                foreach (Database db in server.Server.Databases)
                {
                    try {
                        if (db.Tables.Contains("tblMaterial") && db.Tables.Contains("tblBiota"))
                        {
                            var vm = new DatabaseViewModel(db);
                            server.Children.Add(vm);
                        }
                    } catch (Exception) {
                    }
                }
                server.IsExpanded = true;
            }
        }
Ejemplo n.º 3
0
 private void Disconnect(ServerViewModel server)
 {
     if (server != null && server.Server != null) {
         server.Server.ConnectionContext.Disconnect();
         server.Server = null;
         server.Children.Clear();
     }
 }
Ejemplo n.º 4
0
        private ServerViewModel CreateServerViewModel(string name)
        {
            var model = new ServerViewModel { Name = name };

            return model;
        }