ClientModel

This is an open source package designed to define MVVM client application based on XAML (WinUI, UWP, WPF, or Xamarin)
Nuget | Github

Add validation rules to detect errors on property changes. You can add Error, Warning or Information results for validations.
static RegisterNewContactEditorVM()
{
    RegisterProperty(x => x.Email)
        .Validate<ValidEmail>(message: "Wrong email format"); // If not indicated, Error kind is assumed by default
        .Validate((vm, val) => existsInMyUsersDB(val), ValidationKind.Error, "email already registered"));

    RegisterProperty(x => x.Password)   
        .Validate((vm, val) => weakness(val) == Weakness.Low, ValidationKind.Warning, "Weak password"))
        .Validate((vm, val) => weakness(val) == Weakness.High, ValidationKind.Error, "Unacceptable password"));

    RegisterProperty(x => x.MultiFactorAddresses)   
        .Validate((vm, col) => col.Count < 1, ValidationKind.Warning, "Strong authentication have 2 or more factors"))
        .Validate((vm, col) => col.Count == 0, ValidationKind.Error, "At least one more factor is needed"));
}

public string Email {  set => SetValue(value); get => GetValue<string>(); }
public string Password {  set => SetValue(value); get => GetValue<string>(); }
public ObservableCollection<Address> MultiFactorAddresses {  get => GetCollection<ObservableCollection<Address>>(); }

An error has occurred. This application may no longer respond until reloaded. Reload 🗙