예제 #1
0
        /// <summary>
        /// Display the main window and get the user's server selection when
        /// the form is loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void VerifyBackup_Load(object sender, System.EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            ServerConn = new ServerConnection();
            scForm     = new ServerConnect(ServerConn);
            dr         = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;

                    // Refresh device list
                    GetBackupDevicesList();
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #2
0
        /// <summary>
        /// Load main form and display the server connect dialog.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ServerInfo_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            // Create the server connection
            ServerConn = new ServerConnection();

            // Create the server connect dialog
            scForm = new ServerConnect(ServerConn);

            // Display the server connect dialog
            dr = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;

                    // Refresh server information
                    ShowServerInformation();
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #3
0
        private void LoadRegAssembly_Load(object sender, System.EventArgs e)
        {
            ServerConnection myServerConn;
            ServerConnect scForm;
            DialogResult dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();
            
            myServerConn = new ServerConnection();
            scForm = new ServerConnect(myServerConn);
            dr = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (myServerConn.SqlConnectionObject.State
                == ConnectionState.Open))
            {
                mySqlServer = new Server(myServerConn);
                if (mySqlServer != null)
                {
                    this.Text = Properties.Resources.AppTitle + mySqlServer.Name;

                    // Refresh database list
                    ShowDatabases(true);
                    UpdateButtons();
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #4
0
        private void ManageDatabaseUsers_Load(object sender, System.EventArgs e)
        {
            ServerConnection myServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            myServerConn = new ServerConnection();
            scForm       = new ServerConnect(myServerConn);
            dr           = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (myServerConn.SqlConnectionObject.State
                 == ConnectionState.Open))
            {
                SqlServerSelection = new Server(myServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle
                                + SqlServerSelection.Name;

                    // Refresh database list
                    ShowDatabases(true);
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #5
0
        private void ManageTables_Load(object sender, System.EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect scForm;
            DialogResult dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            ServerConn = new ServerConnection();
            scForm = new ServerConnect(ServerConn);
            dr = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;

                    // Refresh database list
                    ShowDatabases(true);
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #6
0
        private void DatabaseDefrag_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            Cursor csr = null;

            try
            {
                csr         = this.Cursor;        // Save the old cursor
                this.Cursor = Cursors.WaitCursor; // Display the waiting cursor

                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm     = new ServerConnect(ServerConn);
                dr         = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK) &&
                    (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    SqlServerSelection = new Server(ServerConn);
                    if (SqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                                    + SqlServerSelection.Name;

                        // Limit the table properties returned to just those that we use
                        SqlServerSelection.SetDefaultInitFields(typeof(Table),
                                                                new String[] { "Schema", "Name", "IsSystemObject" });

                        ShowDatabases(true);
                    }
                }
                else
                {
                    this.Close();
                }
            }
            catch (SmoException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
            finally
            {
                this.Cursor = csr;  // Restore the original cursor
            }
        }
예제 #7
0
        private void DatabaseDefrag_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect scForm;
            DialogResult dr;

            Cursor csr = null;

            try
            {
                csr = this.Cursor;   // Save the old cursor
                this.Cursor = Cursors.WaitCursor;   // Display the waiting cursor

                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm = new ServerConnect(ServerConn);
                dr = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK) &&
                    (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    SqlServerSelection = new Server(ServerConn);
                    if (SqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                            + SqlServerSelection.Name;

                        // Limit the table properties returned to just those that we use
                        SqlServerSelection.SetDefaultInitFields(typeof(Table),
                            new String[] { "Schema", "Name", "IsSystemObject" });

                        ShowDatabases(true);
                    }
                }
                else
                {
                    this.Close();
                }
            }
            catch (SmoException ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
            finally
            {
                this.Cursor = csr;  // Restore the original cursor
            }
        }
예제 #8
0
파일: SmoBrowser.cs 프로젝트: rcdosado/SMO
        private void SmoBrowser_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect scForm;
            DialogResult dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();
            
            ServerConn = new ServerConnection();
            scForm = new ServerConnect(ServerConn);
            dr = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle
                        + SqlServerSelection.Name;
                }
            }
            else
            {
                this.Close();
            }

            if (SqlServerSelection != null)
            {
                objectTreeView.BeginUpdate();

                // By default create Server and Managed Computer nodes
                objectTreeView.Nodes.Add(CreateNode(
                    String.Format(CultureInfo.CurrentUICulture,
                    Properties.Resources.SQLServerNodeName,
                    SqlServerSelection.Name),
                    SqlServerSelection));
                objectTreeView.Nodes.Add(CreateNode(
                    String.Format(CultureInfo.CurrentUICulture,
                    Properties.Resources.ManagedComputerNodeName,
                    SqlServerSelection.Name),
                    new ManagedComputer(SqlServerSelection.Name)));

                objectTreeView.EndUpdate();
            }
        }
예제 #9
0
        private void SmoBrowser_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            ServerConn = new ServerConnection();
            scForm     = new ServerConnect(ServerConn);
            dr         = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle
                                + SqlServerSelection.Name;
                }
            }
            else
            {
                this.Close();
            }

            if (SqlServerSelection != null)
            {
                objectTreeView.BeginUpdate();

                // By default create Server and Managed Computer nodes
                objectTreeView.Nodes.Add(CreateNode(
                                             String.Format(CultureInfo.CurrentUICulture,
                                                           Properties.Resources.SQLServerNodeName,
                                                           SqlServerSelection.Name),
                                             SqlServerSelection));
                objectTreeView.Nodes.Add(CreateNode(
                                             String.Format(CultureInfo.CurrentUICulture,
                                                           Properties.Resources.ManagedComputerNodeName,
                                                           SqlServerSelection.Name),
                                             new ManagedComputer(SqlServerSelection.Name)));

                objectTreeView.EndUpdate();
            }
        }
예제 #10
0
        private void BackupRestore_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect    scForm;
            DialogResult     dr;

            try
            {
                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm     = new ServerConnect(ServerConn);
                dr         = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK) &&
                    (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    SqlServerSelection = new Server(ServerConn);
                    if (SqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                                    + SqlServerSelection.Name;

                        // Refresh database list
                        ShowDatabases(true);
                    }
                }
                else
                {
                    this.Close();
                }

                if (SqlServerSelection != null)
                {
                    BackupFileTextBox.Text = SqlServerSelection.Settings.
                                             BackupDirectory + @"\SmoDemoBackup.bak";
                }
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
        }
예제 #11
0
파일: MainForm.cs 프로젝트: ramnaresh/SMO
        private void MainForm_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect    scForm;
            DialogResult     dr;

            try
            {
                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm     = new ServerConnect(ServerConn);
                dr         = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK) &&
                    (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    this.sqlServerSelection = new Server(ServerConn);
                    if (this.sqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                                    + this.sqlServerSelection.Name;

                        // Refresh database list
                        ConnectToServer(ServerConn.ServerInstance);
                    }
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
        }
예제 #12
0
        private void ConnectToServer()
        {
            ServerConnection ServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            // Load and display the server selection dialog
            ServerConn = new ServerConnection();

            // Set Application name
            ServerConn.ApplicationName = Application.ProductName;

            scForm = new ServerConnect(ServerConn);
            dr     = scForm.ShowDialog(this);
            if (dr == DialogResult.OK &
                ServerConn.SqlConnectionObject.State == ConnectionState.Open)
            {
                this.SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;

                    // Refresh database list
                    ShowDatabases(true);

                    // Show server information on StatusBar
                    this.StatusBar.Text = SqlServerSelection.Name + " "
                                          + SqlServerSelection.Information.VersionString + " "
                                          + SqlServerSelection.Information.ProductLevel;
                }
            }

            scForm = null;
        }
예제 #13
0
파일: IndexSizes.cs 프로젝트: ramnaresh/SMO
        private void IndexSizes_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect    scForm;
            DialogResult     dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            ServerConn = new ServerConnection();
            scForm     = new ServerConnect(ServerConn);
            dr         = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle
                                + SqlServerSelection.Name;

                    // Limit the properties returned to just those that we use
                    SqlServerSelection.SetDefaultInitFields(typeof(Table),
                                                            new String[] { "Schema", "Name", "IsSystemObject" });

                    SqlServerSelection.SetDefaultInitFields(typeof(Index),
                                                            new String[] { "Name", "IndexKeyType", "SpaceUsed" });

                    ShowDatabases(true);
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #14
0
파일: IndexSizes.cs 프로젝트: rcdosado/SMO
        private void IndexSizes_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn;
            ServerConnect scForm;
            DialogResult dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            ServerConn = new ServerConnection();
            scForm = new ServerConnect(ServerConn);
            dr = scForm.ShowDialog(this);
            if ((dr == DialogResult.OK) &&
                (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
            {
                SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle
                        + SqlServerSelection.Name;

                    // Limit the properties returned to just those that we use
                    SqlServerSelection.SetDefaultInitFields(typeof(Table),
                        new String[] { "Schema", "Name", "IsSystemObject" });

                    SqlServerSelection.SetDefaultInitFields(typeof(Index),
                        new String[] { "Name", "IndexKeyType", "SpaceUsed" });

                    ShowDatabases(true);
                }
            }
            else
            {
                this.Close();
            }
        }
예제 #15
0
        private void BackupRestore_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect scForm;
            DialogResult dr;

            try
            {
                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm = new ServerConnect(ServerConn);
                dr = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK) &&
                    (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    SqlServerSelection = new Server(ServerConn);
                    if (SqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                            + SqlServerSelection.Name;

                        // Refresh database list
                        ShowDatabases(true);
                    }
                }
                else
                {
                    this.Close();
                }

                if (SqlServerSelection != null)
                {
                    BackupFileTextBox.Text = SqlServerSelection.Settings.
                        BackupDirectory + @"\SmoDemoBackup.bak";
                }
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
        }
예제 #16
0
파일: MainForm.cs 프로젝트: rcdosado/SMO
        private void MainForm_Load(object sender, EventArgs e)
        {
            ServerConnection ServerConn = new ServerConnection();
            ServerConnect scForm;
            DialogResult dr;

            try
            {
                // Display the main window first
                this.Show();
                Application.DoEvents();

                ServerConn = new ServerConnection();
                scForm = new ServerConnect(ServerConn);
                dr = scForm.ShowDialog(this);
                if ((dr == DialogResult.OK)
                    && (ServerConn.SqlConnectionObject.State == ConnectionState.Open))
                {
                    this.sqlServerSelection = new Server(ServerConn);
                    if (this.sqlServerSelection != null)
                    {
                        this.Text = Properties.Resources.AppTitle
                            + this.sqlServerSelection.Name;

                        // Refresh database list
                        ConnectToServer(ServerConn.ServerInstance);
                    }
                }
                else
                {
                    this.Close();
                }
            }
            catch (Exception ex)
            {
                ExceptionMessageBox emb = new ExceptionMessageBox(ex);
                emb.Show(this);
            }
        }
예제 #17
0
        private void ConnectToServer()
        {
            ServerConnection ServerConn;
            ServerConnect scForm;
            DialogResult dr;

            // Display the main window first
            this.Show();
            Application.DoEvents();

            // Load and display the server selection dialog
            ServerConn = new ServerConnection();

            // Set Application name
            ServerConn.ApplicationName = Application.ProductName;

            scForm = new ServerConnect(ServerConn);
            dr = scForm.ShowDialog(this);
            if (dr == DialogResult.OK &
                ServerConn.SqlConnectionObject.State == ConnectionState.Open)
            {
                this.SqlServerSelection = new Server(ServerConn);
                if (SqlServerSelection != null)
                {
                    this.Text = Properties.Resources.AppTitle + SqlServerSelection.Name;

                    // Refresh database list
                    ShowDatabases(true);

                    // Show server information on StatusBar
                    this.StatusBar.Text = SqlServerSelection.Name + " "
                        + SqlServerSelection.Information.VersionString + " "
                        + SqlServerSelection.Information.ProductLevel;
                }
            }

            scForm = null;
        }