예제 #1
0
        public void HandleException(object sender, Exception ex)
        {
            if (RegisteredExceptions.ContainsKey(ex.GetType()))
            {
                string message = RegisteredExceptions[ex.GetType()];
                alertDisplayer.DisplayAlert(sender, "Teacher Hiring App", message, "Ok");

                return;
            }

            alertDisplayer.DisplayAlert(sender, "Teacher Hiring App", "Ha ocurrido un problema desconocido", "Ok");
        }
예제 #2
0
        private async Task AcceptButton_Clicked(object sender, EventArgs e)
        {
            try
            {
                counselRequestDetailViewModel.IsBusy = true;

                CounselRequestDto responseCounselRequest = await counselService.AcceptCounselRequest(counselRequest);

                if (responseCounselRequest != null)
                {
                    await alertDisplayer.DisplayAlert(this, "Asesoría", "Confirmación exitosa!", "Ok");

                    App.Current.MainPage = new Dashboard.DashboardPage();
                }
            }
            catch (Exception ex)
            {
                exceptionHandler.HandleException(this, ex);
            }
            finally { counselRequestDetailViewModel.IsBusy = false; }
        }
        private async Task RequestButton_Clicked(object sender, EventArgs e)
        {
            try
            {
                counselSignupViewModel.IsBusy = true;

                UserDto           user           = (UserDto)App.LogicContext.SessionStorage.Get("CurrentUser");
                StudentCounselDto studentCounsel = await counselService.SignupToCounsel(user, counselSignupViewModel.Counsel);

                if (studentCounsel != null)
                {
                    await alertDisplayer.DisplayAlert(this, "Asesoría", "Solicitud exitosa!", "Ok");

                    App.Current.MainPage = new Dashboard.DashboardPage();
                }
            }
            catch (Exception ex)
            {
                exceptionHandler.HandleException(this, ex);
            }
            finally { counselSignupViewModel.IsBusy = false; }
        }
예제 #4
0
        private async Task SaveButton_Clicked(object sender, EventArgs e)
        {
            try
            {
                registerCounselViewModel.IsBusy = true;

                CounselDto counsel         = buildCounsel();
                CounselDto responseCounsel = await counselService.RegisterCounsel(counsel);

                if (responseCounsel != null)
                {
                    await alertDisplayer.DisplayAlert(this, "Asesoría", "Asesoría registrada exitosamente!", "Ok");

                    App.Current.MainPage = new Dashboard.DashboardPage();
                }
            }
            catch (Exception ex)
            {
                exceptionHandler.HandleException(this, ex);
            }
            finally { registerCounselViewModel.IsBusy = false; }
        }