Esempio n. 1
0
        private Database getDatabase()
        {
            Database database = new Database();

            if (dbid != null)
            {
                database.Id = dbid;
            }

            if (wgs != null)
            {
                database.WorkgroupServerName = wgs;
            }

            if (!database.IsValid)
            {
                database.Dispose();

                DesktopHelper helper = new DesktopHelper();
                database = helper.SelectDatabase(GetDesktopWindow(), false, false);
            }
            // if the database id and work group server are not set we rely on a default already having been set in the client.
            database.Connect(); //connect to the db using DB id and workgroup server

            return(database);
        }
Esempio n. 2
0
        private void Button_Click_3(object sender, RoutedEventArgs e)
        {
            DesktopHelper helper      = new DesktopHelper();
            Database      newDatabase = helper.SelectDatabase(GetDesktopWindow(), false, false);

            if (newDatabase != null)
            {
                _database.Dispose();
                _database = newDatabase;
            }
        }
Esempio n. 3
0
        private void Select_Database_Button_Click(object sender, RoutedEventArgs e)
        {
            // Choose a different database
            DesktopHelper helper      = new DesktopHelper();
            Database      newDatabase = helper.SelectDatabase(GetDesktopWindow(), false, false);

            if (newDatabase != null)
            {
                if (Database != null)
                {
                    Database.Dispose();
                }

                Database = newDatabase;

                Properties.Settings.Default["dbid"] = Database.Id;

                IsDatabaseAvailable = Database.IsValid;
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            Database database = null;

            try
            {
                DesktopHelper helper = new DesktopHelper();
                database = helper.SelectDatabase(GetDesktopWindow(), false, false);

                dbid = database?.Id;
                wgs  = database?.WorkgroupServerName;

                label2.Text = $"{dbid} / {wgs}";
            }
            finally
            {
                if (database != null)
                {
                    database.Dispose();
                }
            }
        }