public static async Task ReloadData() { Vendors.Clear(); Fuelings.Clear(); Summary.Clear(); await InitData(silent : true); }
public static async Task DeleteFueling(Fueling fueling) { if (fueling == null) { return; } Fuelings.Remove(fueling); if (!fueling.IsNew) { await AppStorage.Instance.DeleteFueling(fueling); } }
void CreateCells(bool reload) { if (reload) { App.Fuelings.CollectionChanged -= Fuelings_CollectionChanged; Fuelings.Clear(); } foreach (var fueling in App.Fuelings) { Fuelings.Add(new FuelingCell(fueling)); } App.Fuelings.CollectionChanged += Fuelings_CollectionChanged; }
private void Fuelings_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { if (e.Action == NotifyCollectionChangedAction.Add) { foreach (var item in e.NewItems) { if (item is Fueling fueling) { Fuelings.Add(new FuelingCell(fueling)); } else { Debug.Print($"Unknown item in Fueligs list: {item.GetType()}"); } } } else { CreateCells(true); } }
public static async Task NewFueling(Fueling fueling) { await AppStorage.Instance.AddFueling(fueling); Fuelings.Add(fueling); }
public static Fueling GetFueling(string id) { return(Fuelings.FirstOrDefault((fueling) => fueling.Id == id)); }