private async void InitAllPages() { Title = "Statistics"; var loading = new LoadingAnimation(); Children.Add(loading); //make sure all tables are loaded when creating the following pages var model = await MeasurementsPageViewModel.GetInstance(); await model.InitializeActivities(); await model.InitializeMeasurement(); Children.Add(new CalendarStats() { Title = "Calendar", Icon = "calendar.png" }); Children.Add(new PinPage() { Title = "Map", Icon = "map.png" }); //TODO: consider removing these pages: Children.Add(new LastMeasurementsListPage() { Title = "All", Icon = "list.png" }); //Children.Add(new ActivitiesListPage() { Title = "Activities", Icon = "activity.png" }); loading.Complete(); Children.Remove(loading); this.CurrentPageChanged += CurrentTabChanged; }
private async Task Initialize() { BindingContext = await MeasurementsPageViewModel.GetInstance(); model = ((MeasurementsPageViewModel)BindingContext); model.FilteredMeasurementsObj.Clear(); setChart(); }
private async void UpdateViewModel() { var model = await MeasurementsPageViewModel.GetInstance(); int index = model.MeasurementsObj.IndexOf(measurement); model.MeasurementsObj.Remove(measurement); model.MeasurementsObj.Insert(index, measurement); }
public async Task GetMeasurements() { MeasurementsPageViewModel model = await MeasurementsPageViewModel.GetInstance(); DateTime weekAgo = DateTime.Today.AddDays(-30); filteredMeasurements = model.MeasurementsObj .Where(item => item.Date.CompareTo(weekAgo) > 0) //measurements from last week .Where(item => item.IsStressed > 0) //show only stressed measurements .ToList(); }
private async void ListView_ItemSelected(object sender, SelectedItemChangedEventArgs e) { var selectedUser = (Users)allowedUsersListView.SelectedItem; if (selectedUser != null) { Login.Default.CurrentUser.WatchingUserID = selectedUser.id; if (!firstUserClicked) { //get the newly selected user's measurements var model = await MeasurementsPageViewModel.GetInstance(); await model.InitializeMeasurement(); } firstUserClicked = false; await Navigation.PushAsync(new StatsTabbedPage()); allowedUsersListView.SelectedItem = null; } }