예제 #1
0
        /// <summary>
        /// Attempts to enter the proctor session
        /// </summary>
        /// <returns>true if successes, false if fails</returns>
        private async Task <bool> Attempt()
        {
            var result = await ExamServices.AttemptProctor(_examId);

            if (result == ErrorCodes.NotLoggedIn)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title = "You must login first",
                });

                NavManager.NavigateTo("/User/Login");
                return(false);
            }

            if (result != ErrorCodes.Success)
            {
                await Modal.ErrorAsync(new ConfirmOptions()
                {
                    Title   = "Enter proctor failed",
                    Content = ErrorCodes.MessageMap[result]
                });

                NavManager.NavigateTo("/");
                return(false);
            }

            return(true);
        }