public void SaveOrdrer() { foreach (var ordre in OrdrerCollection) { if (ordre.Aktiveret == false) { OrdrerCollection.Remove(ordre); DeaktiveredeOrdrerCollection.Add(ordre); } else { DeaktiveredeOrdrerCollection.Remove(ordre); } } GemAktiveredeOrdre.SaveOrdreAsJsonAsync(OrdrerCollection); GemDeaktiveredeOrdrer.SaveOrdreAsJsonAsync(DeaktiveredeOrdrerCollection); }
public async void Load() { string curFile = @"C:\Users\rasmu\AppData\Local\Packages\347085fc-770a-47bf-87e0-14e3e41dd8a6_2g8htre5d9nf2\LocalState\Ordrer.json"; if (File.Exists(curFile)) { var ordrerCollection = await GemAktiveredeOrdre.LoadOrdreFromJsonAsync(); OrdrerCollection.Clear(); foreach (var ordre in ordrerCollection) { OrdrerCollection.Add(ordre); } } string curFile2 = @"C:\Users\rasmu\AppData\Local\Packages\347085fc-770a-47bf-87e0-14e3e41dd8a6_2g8htre5d9nf2\LocalState\DeaktiveredeOrdrer.json"; if (File.Exists(curFile2)) { var deaktiveredeOrdrerCollection = await GemDeaktiveredeOrdrer.LoadOrdreFromJsonAsync(); DeaktiveredeOrdrerCollection.Clear(); foreach (var ordre in deaktiveredeOrdrerCollection) { DeaktiveredeOrdrerCollection.Add(ordre); } } string curFile3 = @"C:\Users\rasmu\AppData\Local\Packages\347085fc-770a-47bf-87e0-14e3e41dd8a6_2g8htre5d9nf2\LocalState\Kunder.json"; if (File.Exists(curFile3)) { var kundeCollection = await GemKunde.LoadKunderFromJsonAsync(); KundeCollection.Clear(); foreach (var kunde in kundeCollection) { KundeCollection.Add(kunde); } } }