optimizations
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System.ComponentModel;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing.Design;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
@@ -672,13 +674,33 @@ public class RadValidationProviderEx : Component, ISupportInitialize, IExtenderP
|
||||
[Editor(DesignerConsts.RadValidationRuleEditorString, typeof(UITypeEditor))]
|
||||
public void SetValidationRule(RadControl control, FilterDescriptor rule)
|
||||
{
|
||||
var radValidationRule = rule as IRadValidationRuleEx;
|
||||
if (radValidationRule == null)
|
||||
if (rule is not IRadValidationRuleEx radValidationRule)
|
||||
RemoveControlFromRules(control);
|
||||
else
|
||||
{
|
||||
radValidationRule.AddControl(control);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Associates a validation rule with the specified RadControls descendant.</para>
|
||||
/// </summary>
|
||||
/// <param name="controls">A RadControl collection descendant that represents the editors.</param>
|
||||
/// <param name="rule">A RadValidationRule descendant that represents the validation rule.</param>
|
||||
[Editor(DesignerConsts.RadValidationRuleEditorString, typeof(UITypeEditor))]
|
||||
public void SetValidationRule(IEnumerable controls, FilterDescriptor rule)
|
||||
{
|
||||
SetValidationRule(controls.OfType<RadControl>(), rule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// <para>Associates a validation rule with the specified RadControls descendant.</para>
|
||||
/// </summary>
|
||||
/// <param name="controls">A RadControl collection descendant that represents the editors.</param>
|
||||
/// <param name="rule">A RadValidationRule descendant that represents the validation rule.</param>
|
||||
[Editor(DesignerConsts.RadValidationRuleEditorString, typeof(UITypeEditor))]
|
||||
public void SetValidationRule(IEnumerable<RadControl> controls, FilterDescriptor rule)
|
||||
{
|
||||
foreach (var control in controls)
|
||||
SetValidationRule(control, rule);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -15,11 +15,13 @@ public partial class RadFlyoutBase : UserControl
|
||||
protected TableLayoutPanel tableLayoutPanel_ActionPanel;
|
||||
protected TableLayoutPanel tableLayoutPanel_TitlePanel;
|
||||
protected RadLabel radLabel_Title;
|
||||
protected RadValidationProviderEx validationProvider = new();
|
||||
|
||||
public static RadSvgImage? CancelSvg { get; set; } = null;
|
||||
public static RadSvgImage? ConfirmSvg { get; set; } = null;
|
||||
|
||||
[Browsable(false)]
|
||||
public RadValidationProviderEx ValidationProvider { get; } = new();
|
||||
|
||||
[ReadOnly(true)]
|
||||
public DialogResult Result { get; protected set; }
|
||||
|
||||
@@ -98,14 +100,11 @@ public partial class RadFlyoutBase : UserControl
|
||||
}
|
||||
}
|
||||
|
||||
[Browsable(false)]
|
||||
public FilterDescriptorCollection ValidationRules => validationProvider.ValidationRules;
|
||||
|
||||
[DefaultValue(typeof(ValidationMode), "OnValidating")]
|
||||
public ValidationMode ValidationMode
|
||||
{
|
||||
get => validationProvider.ValidationMode;
|
||||
set => validationProvider.ValidationMode = value;
|
||||
get => ValidationProvider.ValidationMode;
|
||||
set => ValidationProvider.ValidationMode = value;
|
||||
}
|
||||
|
||||
protected RadFlyoutBase()
|
||||
@@ -264,7 +263,7 @@ public partial class RadFlyoutBase : UserControl
|
||||
|
||||
protected virtual bool ValidateOK()
|
||||
{
|
||||
return validationProvider.ValidateAll();
|
||||
return ValidationProvider.ValidateAll();
|
||||
}
|
||||
|
||||
protected virtual void SetShowTitlePanel()
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>2.10.0</Version>
|
||||
<Version>2.10.1</Version>
|
||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user