示例#1
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);
        }
示例#2
0
 public string Load()
 {
     return(RockList.ToJson(UseAsOutput));
 }