HasError() public method

public HasError ( DataSubmitErrorCode errorCode ) : bool
errorCode DataSubmitErrorCode
return bool
示例#1
0
 internal void SetErrors(DataSubmitErrorArgs dataSubmitErrorArgs)
 {
     if (!Dispatcher.CheckAccess())
         Dispatcher.Invoke(new Action(() => SetErrors(dataSubmitErrorArgs)));
     else
     {
         ResetStatus();
         bool foundError = false;
         if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("email"))
         {
             Email.Background = new SolidColorBrush(Colors.MistyRose);
             _validator.SetError("Email address in use");
             foundError = true;
         }
         if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.InUse) && dataSubmitErrorArgs.HasErrorField("username"))
         {
             Username.Background = new SolidColorBrush(Colors.MistyRose);
             _validator.SetError("Username already in use");
             foundError = true;
         }
         if (dataSubmitErrorArgs.HasError(DataSubmitErrorCode.NotComplexEnough))
         {
             Password.Background = new SolidColorBrush(Colors.MistyRose);
             _validator.SetError("Password is insecure");
             foundError = true;
         }
         if (!foundError)
         {
             _validator.SetError("Unknown Error");
         }
     }
 }
示例#2
0
 public bool LoginFailed(DataSubmitErrorArgs dataSubmissionErrors)
 {
     if (dataSubmissionErrors.HasErrorField("PasswordHash"))
     {
         Password.Password = "";
         Validate();
         return true;
     }
     else if (dataSubmissionErrors.HasError(DataSubmitErrorCode.DataIncomplete))
     {
         Password.Password = "";
         Username.Text = "";
         Validate();
         return true;
     }
     return false;
 }