/// <summary> /// Saves the policy settings. /// </summary> /// <returns><b>true</b> if the settings were saved, otherwise <b>false</b>.</returns> private bool SaveSettings() { bool retval = true; this.Settings.AllowProjectToOverridePolicy = this.AllowProjectOverrideCheckBox.Checked; this.Settings.TaskCategory = (PolicyTaskCategory)((ComboBoxItem)this.TreatErrorsAsComboBox.SelectedItem).Tag; EvaluateOnType evaluateOn = EvaluateOnType.NotSet; if (this.EvaluateOnAddCheckBox.Checked) { evaluateOn |= EvaluateOnType.Add; } if (this.EvaluateOnBranchCheckBox.Checked) { evaluateOn |= EvaluateOnType.Branch; } if (this.EvaluateOnEditCheckBox.Checked) { evaluateOn |= EvaluateOnType.Edit; } if (this.EvaluateOnMergeCheckBox.Checked) { evaluateOn |= EvaluateOnType.Merge; } if (this.EvaluateOnRenameCheckBox.Checked) { evaluateOn |= EvaluateOnType.Rename; } if ((int)evaluateOn == (int)EvaluateOnType.NotSet) { // The user has not specified any change events to validate, notify them. if (MessageBox.Show(this, Resources.Message_NoChangeTypesWarning, Resources.Message_PolicyType, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No) { return(false); } else { evaluateOn = EvaluateOnType.None; } } this.Settings.EvaluateOn = evaluateOn; return(retval); }
/// <summary> /// Determines whether a flag has been set. /// </summary> /// <param name="input">The value to test.</param> /// <param name="match">The value to check for.</param> /// <returns><b>true</b> if the flag has been set, otherwise <b>false</b>.</returns> public static bool IsFlagSet(EvaluateOnType input, EvaluateOnType match) { return((input & match) == match); }