private async void doLogin(string studentID, string password)
        {
            //loading
            LoadingOverlay.Instance.showLoading(this);

            StudentList studentList = new StudentList();
            bool        loginStatus = await studentList.login(studentID, password);

            if (loginStatus)
            {
                //Get student profile from api
                LoadingOverlay.Instance.showLoading(this);
                Student std = await studentList.getById(studentID);

                if (std != null)
                {
                    AppParam.Instance.student = std;
                    this.showNext();
                }
                else
                {
                    //show register screen
                    this.doRegistration(studentID);
                }
                this.showNext();
            }
            else
            {
                AppParam.Instance.showAlertMessage("Login Status", "Student ID and Password are not match!");
            }
        }
Example #2
0
        private async void doRegister(StudentReg stdReg)
        {
            LoadingOverlay.Instance.showLoading(this);
            StudentList stdList = new StudentList();

            try{
                await stdList.create(stdReg);

                await this.DismissViewControllerAsync(true);
            }
            catch (Exception ex) {
                AppParam.Instance.showAlertMessage("Register", "Registration Fail!");
                Console.WriteLine(ex);
            }
        }