public void Initialise() { this.rockList = RockList.FromJson(fileService.Load()); //We want to set either way to make way this.selected = hasElements() ? this.rockList.Clone(0) : null; }
/// <summary> /// /// </summary> /// <returns>True if the form may close.</returns> public bool TryClose() { var res = messageService.DisplayYesNoCancel(SAVE_BEFORE_EXIT); if (res == MessageResult.Cancel) { return(false); } if (res == MessageResult.Yes) { //If the save fails, stop. if (!TrySave()) { return(false); } //Save the RockList try { this.fileService.Save(RockList.ToJson(this.rockList)); } catch (Exception e) { messageService.DisplayError(e, "Failed to save Rock List"); return(false); } } return(true); }
public string Load() { return(RockList.ToJson(UseAsOutput)); }
public void Save(string JSON) { LastResult = RockList.FromJson(JSON); }
public MockRockList(RockList list) { UseAsOutput = list; }