コード例 #1
0
        /// <summary>
        /// Customizes the appearance of the database connection test datagrid
        /// as a new or updated row is being painted.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event arguments.</param>
        private void dataGrid_RowPrePaint(object sender, DataGridViewRowPrePaintEventArgs e)
        {
            DataGridViewRow dataGridViewRow = this.dataGrid.Rows[e.RowIndex];
            DataRowView     dataRowView     = dataGridViewRow.DataBoundItem as DataRowView;

            if (dataRowView == null)
            {
                return;
            }

            DatabaseConnectionTestDetailsDataSet.DatabaseConnectionTestDetailsRow connectionDataRow =
                dataRowView.Row as DatabaseConnectionTestDetailsDataSet.DatabaseConnectionTestDetailsRow;

            DataGridViewCellStyle rowStyle = this.dataGrid.Rows[e.RowIndex].DefaultCellStyle;

            if (!connectionDataRow.WasTestRun)
            {
                rowStyle.BackColor = Color.Silver;
                return;
            }

            if (connectionDataRow.WasTestSuccessful)
            {
                rowStyle.BackColor = Color.LightGreen;
            }
            else
            {
                rowStyle.BackColor = Color.Tomato;
            }

            if (connectionDataRow.IsSourceNull())
            {
                connectionDataRow.Source = this.connectionSourceDefaultDescription;
            }
        }
コード例 #2
0
        /// <summary>
        /// Updates the local database connection test datasource according to newly
        /// reported progress info.
        /// </summary>
        /// <param name="connectionTestProgressInfo">A report of newly updated data
        /// relating to a revcently executed database connection test.</param>
        private void UpdateConnectionTestResult(DatabaseConnectionTestProgressInfo connectionTestProgressInfo)
        {
            DatabaseConnectionTestDetails latestConnectionTest = connectionTestProgressInfo.ConnectionTestDetails;

            DatabaseConnectionTestDetailsDataSet.DatabaseConnectionTestDetailsRow connectionDataRow =
                this.databaseConnectionTestData.DatabaseConnectionTestDetails.Rows.Find(latestConnectionTest.ConnectionName)
                as DatabaseConnectionTestDetailsDataSet.DatabaseConnectionTestDetailsRow;

            connectionDataRow.WasTestRun            = latestConnectionTest.WasTestRun;
            connectionDataRow.WasTestSuccessful     = latestConnectionTest.WasTestSuccessful;
            connectionDataRow.ConnectionErrorText   = latestConnectionTest.ConnectionErrorText;
            connectionDataRow.TestStatusDescription = latestConnectionTest.TestStatusDescription;

            this.progressBar.Value = connectionTestProgressInfo.ConnectionTestPercentComplete;
            if (this.progressBar.Value == this.progressBar.Maximum)
            {
                this.ConnectionTestsCompleted();
            }
        }