Пример #1
0
        private void saveToFile()
        {
            try
            {
                // Collect new properties and assign properties
                TestProperties.SetTestPropertyCollection(collectTestProperties());

                // Save properties to fie.
                TestProperties.Save();
            }
            catch (TestPropertyEditorException e)
            {
                m_testPropertiesDataGridView.CurrentCell = m_testPropertiesDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];

                MessageBox.Show(this, e.Message,
                                this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                m_testPropertiesDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
                m_testPropertiesDataGridView.BeginEdit(false);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Close();
            }
        }
        private void saveToFile()
        {
            try
            {
                bool includeOverrides = false;

                if (TestProperties.HasTestPropertyOverrides())
                {
                    // Query to update config file with override values (they become the defaults.
                    includeOverrides = DialogResult.Yes == MessageBox.Show(this, "Some of the test properties reflect environmental overrides.  " +
                                                                           "Do you want to update the configuration file to include the override values?", "Quintity TestFramework",
                                                                           MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2) ? true : false;
                }

                // Collect new properties and assign properties
                TestProperties.SetTestPropertyCollection(collectTestPropertiesFromGrid(includeOverrides));

                // Save properties to fie.
                TestProperties.Save();
                setCaption();
                m_saveButton.Enabled = false;
            }
            catch (TestPropertyEditorException e)
            {
                m_testPropertiesDataGridView.CurrentCell = m_testPropertiesDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex];

                MessageBox.Show(this, e.Message,
                                this.Text, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                m_testPropertiesDataGridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Selected = true;
                m_testPropertiesDataGridView.BeginEdit(false);
            }
            catch (Exception e)
            {
                MessageBox.Show(this, e.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }