private async Task SaveToFile() { List <MachineToTest> toSaveList = ListeDesMachines.ToList <MachineToTest>(); string output = JsonConvert.SerializeObject(toSaveList); File.WriteAllText(PathSaveFile, output); }
internal async Task DeleteMachine(MachineToTestDisplay selected) { try { ListeDesMachines.Remove(selected); await SaveToFile(); } catch (Exception ex) { LogErreur(ex); Notify.ShowNotification("Erreur", "Erreur ajouté au fichier log", System.Windows.Forms.ToolTipIcon.Error); } }
internal async Task AddMachine(string machine, string description) { try { MachineToTestDisplay nouvelleMachine = new MachineToTestDisplay(machine, description); ListeDesMachines.Add(nouvelleMachine); await SaveToFile(); } catch (Exception ex) { LogErreur(ex); Notify.ShowNotification("Erreur", "Erreur ajouté au fichier log", System.Windows.Forms.ToolTipIcon.Error); } }