mirror of https://github.com/AMT-Cheif/Stylet.git
Minor tweaks to ValidatingModelBase
This commit is contained in:
parent
aa259c378c
commit
ef01444611
|
@ -16,6 +16,9 @@ namespace Stylet
|
|||
/// </summary>
|
||||
public class Screen : ValidatingModelBase, IScreen
|
||||
{
|
||||
public Screen() : base() { }
|
||||
public Screen(IValidatorAdapter validator) : base(validator) { }
|
||||
|
||||
#region WeakEventManager
|
||||
|
||||
private Lazy<IWeakEventManager> lazyWeakEventManager = new Lazy<IWeakEventManager>(() => new WeakEventManager(), true);
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
@ -45,6 +46,11 @@ namespace Stylet
|
|||
this.autoValidate = true;
|
||||
}
|
||||
|
||||
public ValidatingModelBase(IValidatorAdapter validator) : this()
|
||||
{
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
private bool ErrorsEqual(string[] e1, string[] e2)
|
||||
{
|
||||
if (e1 == null && e2 == null)
|
||||
|
@ -96,7 +102,7 @@ namespace Stylet
|
|||
/// Validate a single property, by name. If you override this, you MUST fire ErrorsChange and call OnValidationStateChanged() if appropriate
|
||||
/// </summary>
|
||||
/// <param name="propertyName">Property to validate</param>
|
||||
protected virtual async Task ValidatePropertyAsync(string propertyName)
|
||||
protected virtual async Task ValidatePropertyAsync([CallerMemberName] string propertyName = null)
|
||||
{
|
||||
if (this.validator == null)
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue