示例#1
0
        //private string UserName = "******";
        //private string Pwd = "qiandt.com";
        private AsyncCompletedEventArgs GetEventArgs(string result, object userToken)
        {
            if (string.IsNullOrWhiteSpace(result)) {
                return new AsyncCompletedEventArgs(new ApplicationException("调用远程短信发送接口,返回未知的状态错误"), false, userToken);
            }

            int index;

            if (int.TryParse(result, out index)) {
                var info = new ResultInfo();
                if (index == 1) {
                    return new AsyncCompletedEventArgs(null, false, userToken);
                }
                return new AsyncCompletedEventArgs(new ApplicationException(info.GetErrorInfo(index)), false, userToken);
            }

            return new AsyncCompletedEventArgs(new ApplicationException("未知错误"), false, userToken);
        }