private void btnSave_Clicked(object sender, EventArgs e) { if (rake.Wagons.Count < 1) { DisplayAlert("No Wagons", "You need to add wagons before saving", "OK"); return; } if (dtpDeadlineDate.Date == null || dtpDeadlineTime.Time == null) { DisplayAlert("No Deadline", "You need to set the deadline before saving", "OK"); return; } rake.PlacementDeadline = dtpDeadlineDate.Date + dtpDeadlineTime.Time; rake.CreatedOn = DateTime.Now; rake.Status = Rake.RakeStatus.Pending; RakeList rakeList = new RakeList(); rakeList.PopulateList(); rakeList.rakes.Add(rake); rakeList.SaveList(); MessagingCenter.Send <ContentPage>(this, "RefreshMainPage"); Navigation.PopAsync(true); }
private void Button_Clicked(object sender, EventArgs e) { if (string.IsNullOrEmpty(rake.PlaceLocation)) { DisplayAlert("", "Please scan a siding barcode", "Back"); return; } if (IsLate) { if (pckLateReason.SelectedItem == null) { DisplayAlert("", "Please select a late reason", "Back"); return; } if (pckLateReason.SelectedItem.ToString() == "Other" && string.IsNullOrEmpty(txtOther.Text)) { DisplayAlert("", "Please type a reason in or select one from the list", "Back"); return; } } if (IsLate) { rake.Status = Rake.RakeStatus.PlacedLate; rake.LateReason = (pckLateReason.SelectedItem?.ToString() == "Other") ? txtOther.Text : pckLateReason.SelectedItem.ToString(); } else { rake.Status = Rake.RakeStatus.PlacedOnTime; } var rl = new RakeList(); rl.PopulateList(); var removed = rl.rakes.Single(x => x.ID == rake.ID); rl.rakes.Remove(removed); rl.rakes.Add(rake); rl.SaveList(); MessagingCenter.Send <ContentPage>(this, "RefreshMainPage"); Navigation.PopToRootAsync(); }
void FillList() { rakeList = new RakeList(); rakeList.PopulateList(); RakeList.ItemsSource = rakeList.rakes; }