Beispiel #1
0
        protected async void Save_Clicked(object sender, EventArgs e)
        {
            var newRun = new Run
            {
                PersonID      = PersonID,
                DistanceInKM  = float.Parse(DistanceInKMCell.Text, CultureInfo.InvariantCulture),
                TimeInMins    = Int32.Parse(TimeInMinsCell.Text),
                TimeInSeconds = Int32.Parse(TimeInSecondsCell.Text),
                Terrain       = TerrainCell.Text,
            };

            newRun.setPace();

            try
            {
                using (var runningContext = new RunningContext())
                {
                    await runningContext.Runs.AddAsync(newRun);

                    await runningContext.SaveChangesAsync();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }

            await Navigation.PopModalAsync();
        }
Beispiel #2
0
        async void DeleteAll_Clicked(object sender, EventArgs e)
        {
            using (var runningContext = new RunningContext())
            {
                runningContext.RemoveRange(runningContext.People);

                await runningContext.SaveChangesAsync();

                peopleCollectionView.ItemsSource = runningContext.People.ToList();
            }
        }
Beispiel #3
0
        protected async override void OnAppearing()
        {
            peopleCollectionView.SelectedItem = null;

            using (var runningContext = new RunningContext())
            {
                var thePeople = runningContext.People.ToList();

                peopleCollectionView.ItemsSource = thePeople;
            }
        }
Beispiel #4
0
        protected override void OnAppearing()
        {
            using (var runningContext = new RunningContext())
            {
                List <Run> runsList = runningContext.Runs
                                      .Where(p => p.PersonID == PersonId)
                                      .ToList();
                runsList.Count();

                runsCollection.ItemsSource = runsList;
            }
        }
Beispiel #5
0
        async void Save_Clicked(System.Object sender, System.EventArgs e)
        {
            var person = new Person {
                Name = Name.Text, Age = Int32.Parse(Age.Text), EmailAddress = EmailAddress.Text, Gender = Gender.Text
            };

            using (var runningContext = new RunningContext())
            {
                runningContext.Add(person);

                await runningContext.SaveChangesAsync();
            }

            await Navigation.PopModalAsync();
        }