Пример #1
0
 // Token: 0x06000F6C RID: 3948 RVA: 0x0003EF10 File Offset: 0x0003D110
 public bool TestUserCanLogon(SmtpAddress email, ref string userName, SecureString password)
 {
     if (password == null)
     {
         throw new ArgumentNullException("password", "The password argument cannot be null.");
     }
     if (!email.IsValidAddress)
     {
         throw new ArgumentException("The email argument must have a valid value.", "email");
     }
     foreach (string text in this.FindUserNamesIfNecessary(userName, email))
     {
         OperationStatusCode logonResult = this.TestUserCanLogonWithCurrentSettings(email, text, password);
         this.LogonResult = logonResult;
         if (this.LogonResult == OperationStatusCode.Success)
         {
             userName = text;
             break;
         }
         if (this.LogonResult != OperationStatusCode.ErrorInvalidCredentials)
         {
             break;
         }
     }
     return(this.LogonResult == OperationStatusCode.Success);
 }
 // Token: 0x0600005E RID: 94 RVA: 0x00002760 File Offset: 0x00000960
 private static void ThrowIfStatusIsNotFailure(OperationStatusCode result)
 {
     if (result == OperationStatusCode.None || result == OperationStatusCode.Success)
     {
         throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "The specified status code does not indicate a failure: {0}.", new object[]
         {
             result
         }));
     }
 }
        // Token: 0x0600005B RID: 91 RVA: 0x00002658 File Offset: 0x00000858
        public static bool IsLogonFailedDueToInvalidConnectionSettings(OperationStatusCode result)
        {
            OperationStatusCodeClassification.ThrowIfStatusIsNotFailure(result);
            switch (result)
            {
            case OperationStatusCode.ErrorInvalidCredentials:
            case OperationStatusCode.ErrorCannotCommunicateWithRemoteServer:
                return(false);

            case OperationStatusCode.ErrorInvalidRemoteServer:
            case OperationStatusCode.ErrorUnsupportedProtocolVersion:
                return(true);

            default:
                throw new NotImplementedException(string.Format(CultureInfo.InvariantCulture, "Unexpected OperationStatusCode value encountered in IsLogonFailedDueToInvalidConnectionSettings(): {0}", new object[]
                {
                    result
                }));
            }
        }
Пример #4
0
        /// <summary>
        /// Converts an operation status code (int) value to a Color value.
        /// </summary>
        /// <param name="value">The value to convert.</param>
        /// <param name="targetType">The target type (not used).</param>
        /// <param name="parameter">Specifies the Color to use as the default.</param>
        /// <param name="culture">Culture information used to affect the behavior of the conversion.</param>
        /// <returns>Blue if InProgress, Green if CompletedSuccessfully, Red if Failed or Unknown, and the Color passed as the converter parameter if Not Started or any other value.</returns>
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            OperationStatusCode status = (OperationStatusCode)value;

            switch (status)
            {
            case OperationStatusCode.InProgress:
                return(new SolidColorBrush(Colors.Blue));

            case OperationStatusCode.CompletedSuccessfully:
                return(new SolidColorBrush(Colors.Green));

            case OperationStatusCode.Failed:
            case OperationStatusCode.Unknown:
                return(new SolidColorBrush(Colors.Red));

            case OperationStatusCode.NotStarted:
            default:
                return(new SolidColorBrush((Color)System.Windows.Media.ColorConverter.ConvertFromString((string)parameter)));
            }
        }
Пример #5
0
 public new static Result <T> Fail(OperationStatusCode statusCode, string errorMessage = null)
 => new Result <T>
 {
     IsSuccess = false, StatusCode = statusCode, ErrorMessage = errorMessage
 };
Пример #6
0
 internal void Finished(OperationStatusCode statusCode)
 {
     _watch.Stop();
     StatusCode = statusCode;
 }