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.Drawing.Design;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -672,13 +674,33 @@ public class RadValidationProviderEx : Component, ISupportInitialize, IExtenderP
|
|||||||
[Editor(DesignerConsts.RadValidationRuleEditorString, typeof(UITypeEditor))]
|
[Editor(DesignerConsts.RadValidationRuleEditorString, typeof(UITypeEditor))]
|
||||||
public void SetValidationRule(RadControl control, FilterDescriptor rule)
|
public void SetValidationRule(RadControl control, FilterDescriptor rule)
|
||||||
{
|
{
|
||||||
var radValidationRule = rule as IRadValidationRuleEx;
|
if (rule is not IRadValidationRuleEx radValidationRule)
|
||||||
if (radValidationRule == null)
|
|
||||||
RemoveControlFromRules(control);
|
RemoveControlFromRules(control);
|
||||||
else
|
else
|
||||||
{
|
|
||||||
radValidationRule.AddControl(control);
|
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>
|
/// <summary>
|
||||||
|
|||||||
@@ -15,11 +15,13 @@ public partial class RadFlyoutBase : UserControl
|
|||||||
protected TableLayoutPanel tableLayoutPanel_ActionPanel;
|
protected TableLayoutPanel tableLayoutPanel_ActionPanel;
|
||||||
protected TableLayoutPanel tableLayoutPanel_TitlePanel;
|
protected TableLayoutPanel tableLayoutPanel_TitlePanel;
|
||||||
protected RadLabel radLabel_Title;
|
protected RadLabel radLabel_Title;
|
||||||
protected RadValidationProviderEx validationProvider = new();
|
|
||||||
|
|
||||||
public static RadSvgImage? CancelSvg { get; set; } = null;
|
public static RadSvgImage? CancelSvg { get; set; } = null;
|
||||||
public static RadSvgImage? ConfirmSvg { get; set; } = null;
|
public static RadSvgImage? ConfirmSvg { get; set; } = null;
|
||||||
|
|
||||||
|
[Browsable(false)]
|
||||||
|
public RadValidationProviderEx ValidationProvider { get; } = new();
|
||||||
|
|
||||||
[ReadOnly(true)]
|
[ReadOnly(true)]
|
||||||
public DialogResult Result { get; protected set; }
|
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")]
|
[DefaultValue(typeof(ValidationMode), "OnValidating")]
|
||||||
public ValidationMode ValidationMode
|
public ValidationMode ValidationMode
|
||||||
{
|
{
|
||||||
get => validationProvider.ValidationMode;
|
get => ValidationProvider.ValidationMode;
|
||||||
set => validationProvider.ValidationMode = value;
|
set => ValidationProvider.ValidationMode = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected RadFlyoutBase()
|
protected RadFlyoutBase()
|
||||||
@@ -264,7 +263,7 @@ public partial class RadFlyoutBase : UserControl
|
|||||||
|
|
||||||
protected virtual bool ValidateOK()
|
protected virtual bool ValidateOK()
|
||||||
{
|
{
|
||||||
return validationProvider.ValidateAll();
|
return ValidationProvider.ValidateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void SetShowTitlePanel()
|
protected virtual void SetShowTitlePanel()
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>2.10.0</Version>
|
<Version>2.10.1</Version>
|
||||||
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
<GenerateDocumentationFile>True</GenerateDocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user