Exemple #1
0
        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;
        }
Exemple #2
0
        /// <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);
        }
Exemple #3
0
 public string Load()
 {
     return(RockList.ToJson(UseAsOutput));
 }
Exemple #4
0
 public void Save(string JSON)
 {
     LastResult = RockList.FromJson(JSON);
 }
Exemple #5
0
 public MockRockList(RockList list)
 {
     UseAsOutput = list;
 }