/// <summary> /// Refreshes the form and removes the selected item /// Also removed the item from the auto change tab drop down /// </summary> private void optionsResolutionRemove_Click(object sender, EventArgs e) { if (optionsRadiusR.SelectedItem.ToString() != optionsAuto1.SelectedItem.ToString()) { if (optionsRadiusR.Items.Count > 1) { using (OptionsRadiiList.Update update = new OptionsRadiiList.Update()) { // Refresh the form update.RefreshForm(optionsRadiusR, true); // Disable the controls optionsRadiusEdit.Enabled = false; optionsRadiusRemove.Enabled = false; } } else { MessageBox.Show("You must have at least one radius in your list.", "Unable to remove radius", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("You cannot remove a radius that you have set for auto change.", "Unable to remove radius", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
/// <summary> /// Refreshes the form without removing a selected item /// </summary> private void optionsTabs_MouseDown(object sender, MouseEventArgs e) { using (OptionsRadiiList.Update update = new OptionsRadiiList.Update()) { // Refresh the form update.RefreshForm(optionsRadiusR, false); // Disable the controls optionsRadiusEdit.Enabled = false; optionsRadiusRemove.Enabled = false; } }
/// <summary> /// Splits the selected item up into the exponential value of 2 and the description /// then outputs the two parts into the appropriate textboxes /// </summary> private void optionsResolutionEdit_Click(object sender, EventArgs e) { // Split the selected item's string string[] splitRadius = optionsRadiusR.SelectedItem.ToString().Split('('); // Set the textbox values optionsRadiusValue.Text = splitRadius[0].TrimEnd(' '); optionsRadiusDefinition.Text = splitRadius[1].TrimEnd(')'); using (OptionsRadiiList.Update update = new OptionsRadiiList.Update()) { // Refresh the form update.RefreshForm(optionsRadiusR, true); // Disable the controls optionsRadiusEdit.Enabled = false; optionsRadiusRemove.Enabled = false; } // Update the button text optionsResolutionAdd.Text = "Save"; }