示例#1
0
        private async void OnRegister(object sender, CredentialsOverlayEventArgs e)
        {
            switch (await this.Rpc.Event(LoginEvents.Register).Request <RegisterResponse>(e.Credentials))
            {
            case RegisterResponse.AccountLimitReached:
                e.Reply(new
                {
                    Success = false,
                    Message = "You have reached the maximum number of accounts for this GTAV license!"
                });

                break;

            case RegisterResponse.EmailExists:
                e.Reply(new
                {
                    Success = false,
                    Message = "The email address you entered already has an account registered!"
                });

                break;

            case RegisterResponse.Created:
                e.Reply(new
                {
                    Success = true,
                    Message = string.Empty
                });

                this.overlay.Dispose();

                // Release focus hold
                this.loggedIn = true;

                break;

            // ReSharper disable once RedundantCaseLabel
            case RegisterResponse.Error:
            default:
                e.Reply(new
                {
                    Success = false,
                    Message = "An unexpected error has occured. Please notify a server administrator."
                });

                break;
            }
        }
示例#2
0
        private async void OnLogin(object sender, CredentialsOverlayEventArgs e)
        {
            switch (await this.Rpc.Event(LoginEvents.Login).Request <LoginResponse>(e.Credentials))
            {
            case LoginResponse.Invalid:
                e.Reply(new
                {
                    Success = false,
                    Message = "You have entered an incorrect email/password combination!<br>Forgotten your password? Contact a server administrator."
                });

                break;

            case LoginResponse.Valid:
                e.Reply(new
                {
                    Success = true,
                    Message = string.Empty
                });

                this.overlay.Dispose();

                // Release focus hold
                this.loggedIn = true;

                break;

            // ReSharper disable once RedundantCaseLabel
            case LoginResponse.Error:
            default:
                e.Reply(new
                {
                    Success = false,
                    Message = "An unexpected error has occured. Please notify a server administrator."
                });

                break;
            }
        }