public static bool SetRule(this IPropertiesContainer container, [NotNull] IRuleEditorDialog ruleEditor) { bool result = false; ruleEditor.Rule = container.GetRule(); if (ruleEditor is Form dialog && dialog.ShowDialog(Form.ActiveForm) == DialogResult.OK) { container.SetRule(ruleEditor.Rule); result = true; } return(result); }