/// <summary> /// Resets the Path column of the Methods DataGridView to the Path property of the APIConfiguration.DefaultMethods collection. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnUseDefaults_Click(object sender, EventArgs e) { IEnumerable <APIMethod> defaultMethods = APIProvider.DefaultProvider.Methods; foreach (DataGridViewRow row in dgMethods.Rows) { SerializableAPIMethod rowMethod = (SerializableAPIMethod)row.Tag; foreach (APIMethod defaultMethod in defaultMethods.Where( defaultMethod => defaultMethod.Method.ToString() == rowMethod.MethodName)) { row.Cells[1].Value = defaultMethod.Path; } } }
/// <summary> /// Validates user input and assigns the edited values back to the APIConfiguration instance before closing the form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnOK_Click(object sender, EventArgs e) { if (!ValidateChildren()) { return; } m_provider.Name = txtConfigurationName.Text; m_provider.Address = txtAPIHost.Text; m_provider.SupportsCompressedResponse = SupportsCompressedResponseCheckBox.Checked; foreach (DataGridViewRow row in dgMethods.Rows) { SerializableAPIMethod method = (SerializableAPIMethod)row.Tag; method.Path = (string)row.Cells[1].Value; } DialogResult = DialogResult.OK; }