protected async override void OnAppearing() { try { StepCountController stepCountController = new StepCountController(); List <StepCount> stepCounts = await stepCountController.GetAllStepCountsAsync(); PlotModel plotModel = new PlotModel(); plotModel.Axes.Add(new LinearAxis { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, IsPanEnabled = false, Minimum = 0 }); DateTime dateTime = DateTime.Today; plotModel.Axes.Add(new DateTimeAxis { MajorGridlineStyle = LineStyle.Solid, MinorGridlineStyle = LineStyle.Dot, Position = AxisPosition.Bottom, Minimum = DateTimeAxis.ToDouble(dateTime.AddDays(-14)), Maximum = DateTimeAxis.ToDouble(dateTime) }); LineSeries lineSeries = new LineSeries(); lineSeries.Points.AddRange(stepCountController.GetStepCountDataPoints(stepCounts)); plotModel.Series.Add(lineSeries); plotView.Model = plotModel; } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void Submit_PressedAsync(object sender, EventArgs e) { if (Password1.Text != Password2.Text) { await DisplayAlert("Password mismatch", "Passwords do not match", "OK"); } else { try { Patient patient = await patientController.CreatePatientAsync(FirstName.Text, LastName.Text, Email.Text, Password1.Text); await DisplayAlert("Success", "Account created", "OK"); Application.Current.MainPage = new MasterPage(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } } }
private async void LogoTapped(object sender, EventArgs e) { try { Image image = (Image)sender; ExerciseViewModel exercise = (ExerciseViewModel)image.BindingContext; if (exercise.Type == ExerciseType.Normal) { if (await exerciseController.FavoriteExerciseAsync(exercise)) { exercise.Type = ExerciseType.Favorite; SortAndRefresh(); } } else if (exercise.Type == ExerciseType.Favorite) { if (await exerciseController.UnfavoriteExerciseAsync(exercise)) { exercise.Type = ExerciseType.Normal; SortAndRefresh(); } } } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void Edit_PressedAsync(object sender, EventArgs e) { string h = Height.Text; short height = Convert.ToInt16(h); string w = Weight.Text; short weight = Convert.ToInt16(w); if ((CurrentPassword.Text != null || NewPassword.Text != null || NewPassword2.Text != null) && (NewPassword.Text != NewPassword2.Text || CurrentPassword.Text == null)) { await DisplayAlert("Password error", "Passwords do not match or you're missing a field", "OK"); } else { try { if (ZipCode.Text != null) { patient.ZipCode = ZipCode.Text; } if (Address.Text != null) { patient.Address = Address.Text; } if (PhoneNumber.Text != null) { patient.Phone = PhoneNumber.Text; } if (Height.Text != null) { patient.Height = height; } if (Weight.Text != null) { patient.Weight = weight; } patient.BirthDate = datePicked; patient.Sex = sex; patient.CountryCode = country.Code; await patientController.UpdatePatientAsync(patient, CurrentPassword.Text, NewPassword.Text); await DisplayAlert("Success", "Profile updated", "OK"); Application.Current.MainPage = new MasterPage(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } } }
protected override async void OnAppearing() { try { List <Enum> sexes = new List <Enum>() { Sex.Female, Sex.Male }; genderPicker.ItemsSource = sexes; CountryPicker.ItemsSource = await countryController.GetAllCountriesAsync(); patient = await patientController.GetPatientAsync(Resource.Token.Subject); patientViewModel = new PatientViewModel(patient); sex = (Sex)patientViewModel.Sex; BindingContext = patientViewModel; if (patient.ZipCode != null) { ZipCode.Placeholder = patient.ZipCode.ToString(); } if (patient.Address != null) { Address.Placeholder = patient.Address; } if (patient.ZipCode != null && patient.CountryCode != null) { city = await cityController.GetCityAsync(patient.ZipCode, patient.CountryCode); City.Text = city.Name; } if (patient.CountryCode != null) { country = await countryController.GetCountryAsync(patient.CountryCode); CountryPicker.Title = country.Name; } } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected override async void OnAppearing() { try { ExerciseView.OnAppear(_selectedExercise); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected override async void OnAppearing() { try { ListViewExercises.ItemsSource = new List <ExerciseViewModel>(await new ExerciseController().GetGlobalExerciseViewModelsAsync()); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void Save_Pressed(object sender, EventArgs e) { try { await new DizzinessController().CreateDizzinessAsync(selectedExercise.Id, DizzyView.DizzyLevel, DizzyView.DizzinessRegisterNote.Text); await Navigation.PopModalAsync(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void SubmitJournalEntryButton_Clicked(object sender, EventArgs e) { try { await new JournalEntryController().CreateJournalEntryAsync(JournalEntryInputEditor.Text); await Navigation.PopModalAsync(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected override async void OnAppearing() { try { _journalViewModels = await new JournalController().GetAllJournalItemsAsync(_dateTime, _patientId); ListViewJournalItems.ItemsSource = _journalViewModels; } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected override async void OnAppearing() { try { exercises = new List <ExerciseViewModel>(await exerciseController.GetAllExerciseViewModelsAsync(null)); SortAndRefresh(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void SubmitExerciseButton_Clicked(object sender, EventArgs e) { try { await new ExerciseController().CreateExerciseAsync(ExerciseNameEntry.Text, ExerciseDescriptionEditor.Text); await Navigation.PopModalAsync(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void Login_Pressed(object sender, EventArgs e) { try { User user = await _controller.LoginAsync(EmailEntry.Text, PasswordEntry.Text); Application.Current.MainPage = new MasterPage(); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected override async void OnAppearing() { try { patientController = new PatientController(); patients = await patientController.GetAllPatientsAsync(); ListViewPatients.ItemsSource = patients; } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected async override void OnAppearing() { DizzinessController dizzinessController = new DizzinessController(); StepCountController stepCountController = new StepCountController(); try { List <Dizziness> dizzinesses = await dizzinessController.GetAllDizzinessesWithLevelAsync(); List <StepCount> stepCounts = await stepCountController.GetAllStepCountsAsync(); PlotModel plotModel = new PlotModel(); plotModel.Axes.Add(new LinearAxis { MajorGridlineStyle = LineStyle.Solid, IsPanEnabled = false, Position = AxisPosition.Left, Key = "DizzyLevelAxis" }); plotModel.Axes.Add(new LinearAxis { MajorGridlineStyle = LineStyle.Solid, IsPanEnabled = false, Position = AxisPosition.Right, Key = "StepsAxis" }); DateTime dateTime = DateTime.Today; plotModel.Axes.Add(new DateTimeAxis { MajorGridlineStyle = LineStyle.Solid, Position = AxisPosition.Bottom, Minimum = DateTimeAxis.ToDouble(dateTime.AddDays(-14)), Maximum = DateTimeAxis.ToDouble(dateTime) }); LineSeries lineSeries = new LineSeries(); lineSeries.Points.AddRange(dizzinessController.GetDizzinessDataPoints(dizzinesses)); lineSeries.YAxisKey = "DizzyLevelAxis"; plotModel.Series.Add(lineSeries); LineSeries lineSeries2 = new LineSeries(); lineSeries2.Points.AddRange(stepCountController.GetStepCountDataPoints(stepCounts)); lineSeries2.YAxisKey = "StepsAxis"; plotModel.Series.Add(lineSeries2); plotView.Model = plotModel; } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
private async void Submit_Pressed(object sender, EventArgs e) { try { bool answer = await DisplayAlert("Submit", "Are you sure you want to submit your answer?", "Yes", "No"); if (answer) { await new DizzinessController().CreateDizzinessAsync(null, DizzyView.DizzyLevel, DizzyView.DizzinessRegisterNote.Text); } } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }
protected async override void OnAppearing() { try { journalLogs = await journalLogController.GetAllJournalLogsAsync(_patientId); ListViewJournal.ItemsSource = journalLogController.GetThisWeekJournals(journalLogs); timeRange = SelectedTimeRange.ThisWeek; ThisWeekButton.BackgroundColor = Color.FromHex("#2f89cc"); ThisMonthButton.BackgroundColor = Color.FromHex("#82b8e0"); LaterButton.BackgroundColor = Color.FromHex("#82b8e0"); } catch (ApiException ex) { await DisplayAlert(AppResources.ErrorTitle, LogicHelper.ErrorMessage(ex.ErrorCode), AppResources.DialogOk); } catch (ConnectionException) { await DisplayAlert(AppResources.ErrorTitle, AppResources.ConnectionException, AppResources.DialogOk); } }