Exemplo n.º 1
0
        /// <summary>Load settings from AppData</summary>
        public override void LoadSettingsFromStorage()
        {
            // Note: the 'LoadSettingsFromXml' and 'SaveSettingsToXml' methods are
            // only used when the user Exports or Imports their settings.
            // To/From storage are used for normal saving.
            try
            {
                var filepath = SettingsFilepath;
                if (!Path_.FileExists(filepath))
                {
                    return;
                }

                // Load the settings XML file
                var root = XDocument.Load(filepath).Root;
                var grps = root.Elements(nameof(Groups), nameof(AlignGroup)).Select(x => x.As <AlignGroup>());
                Groups.Assign(grps);

                // Load other settings
                AlignStyle = root.Element(nameof(AlignStyle)).As <EAlignCharacters>(EAlignCharacters.Spaces);
            }
            catch { }             // Don't allow anything to throw from here, otherwise VS locks up... :-/
        }