Example #1
0
        /// <summary>
        /// Decodes an export code and applies it to the current state.
        /// </summary>
        public ItemListSettings ImportFromCode(string code)
        {
            if (string.IsNullOrEmpty(code) || string.IsNullOrWhiteSpace(code))
            {
                ValidationMessage = "You must enter an import/export code";
                Logger.Log("You must enter an import/export code");
            }
            try
            {
                var decompressedXml = ExportHelper.Decompress(ExportCode);
                var newSettings     = TrinitySetting.GetSettingsInstance <ItemListSettings>(decompressedXml);

                Grouping = newSettings.Grouping;

                using (Collection.DeferRefresh())
                {
                    SelectedItems = newSettings.SelectedItems;
                    UpdateSelectedItems();
                }
            }
            catch (Exception ex)
            {
                ValidationMessage = string.Format("Error importing itemlist. {0} {1}", ex.Message, ex.InnerException);
                Logger.Log("Error importing itemlist. {0} {1}", ex.Message, ex.InnerException);
            }
            return(this);
        }