Ejemplo n.º 1
0
        /// <summary>
        /// 服务器发过来的注册结果
        /// </summary>
        /// <param name="obj"></param>
        private void RegisterCallBack(IMessage obj)
        {
            ResponseMessage msg = obj as ResponseMessage;

            if (!msg.Message.Equals("Y"))
            {
                System.Windows.Application.Current.Dispatcher.Invoke((Action)(async() =>
                {
                    string error = String.Empty;
                    switch (msg.Error)
                    {
                    case ErrorCode.ERR_EXISTPHONE:
                        error = "手机号已注册";
                        break;

                    case ErrorCode.ERR_EXISTEMAIL:
                        error = "邮箱已注册";
                        break;

                    case ErrorCode.ERR_UNKNOWN:
                        error = "服务器未知错误";
                        break;
                    }
                    await registerWin.ShowMessageAsync("", $"注册失败,{error}", MessageDialogStyle.Affirmative);
                }));
            }
            else
            {
                System.Windows.Application.Current.Dispatcher.Invoke((Action)(async() =>
                {
                    await registerWin.ShowMessageAsync("", "注册成功", MessageDialogStyle.Affirmative);
                    registerWin.Close();
                }));
            }
        }