Exemplo n.º 1
0
        private void OnRegisterCallback(long statusCode, string json)
        {
            switch (statusCode)
            {
            case 200:     // Ok
            {
                onRegistrationFinishedListener.OnRegistrationSucceed();
                break;
            }

            case 400:     // Bad Request
            {
                var errorMessage = ErrorData.FromJsonToErrorMessage(json);
                if (errorMessage == string.Empty)
                {
                    errorMessage = NoticeMessages.AuthView.UnknownError;
                }

                onRegistrationFinishedListener.OnRegistrationFailed(errorMessage);
                break;
            }

            default:
            {
                var errorMessage = NoticeMessages.AuthView.UnknownError;

                onRegistrationFinishedListener.OnRegistrationFailed(errorMessage);
                break;
            }
            }
        }
Exemplo n.º 2
0
        private void OnLoginCallback(long statusCode, string json)
        {
            switch (statusCode)
            {
            case 200:     // Ok
            {
                // TODO: Get user id from the server
                UserData.Id = 1;

                onLoginFinishedListener.OnLoginSucceed();
                break;
            }

            case 404:     // Not Found
            {
                var errorMessage = ErrorData.FromJsonToErrorMessage(json);
                if (errorMessage == string.Empty)
                {
                    errorMessage = NoticeMessages.AuthView.UnknownError;
                }

                onLoginFinishedListener.OnLoginFailed(errorMessage);
                break;
            }

            default:
            {
                var errorMessage = NoticeMessages.AuthView.UnknownError;

                onLoginFinishedListener.OnLoginFailed(errorMessage);
                break;
            }
            }
        }