Пример #1
0
        public void SaveSettings()
        {
            var xml = new StringBuilder();

            xml.AppendLine(@"<Settings>");
            if (!String.IsNullOrEmpty(SelectedColor))
            {
                xml.AppendLine(@"<SelectedColor>" + SelectedColor.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SelectedColor>");
            }
            xml.AppendLine(@"<UseSlideMaster>" + UseSlideMaster + @"</UseSlideMaster>");
            xml.AppendLine(@"<BroadcastCalendarSettings>" + BroadcastCalendarSettings.Serialize() + @"</BroadcastCalendarSettings>");
            if (!String.IsNullOrEmpty(SalesRep))
            {
                xml.AppendLine(@"<SalesRep>" + SalesRep.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SalesRep>");
            }
            if (!String.IsNullOrEmpty(SelectedStarOutputItemsEncoded))
            {
                xml.AppendLine(@"<SelectedStarOutputItemsEncoded>" + SelectedStarOutputItemsEncoded.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SelectedStarOutputItemsEncoded>");
            }
            if (!String.IsNullOrEmpty(SelectedShiftOutputItemsEncoded))
            {
                xml.AppendLine(@"<SelectedShiftOutputItemsEncoded>" + SelectedShiftOutputItemsEncoded.Replace(@"&", "&#38;").Replace("\"", "&quot;") + @"</SelectedShiftOutputItemsEncoded>");
            }
            xml.AppendLine(@"<ApplyThemeForAllSlideTypes>" + ApplyThemeForAllSlideTypes + @"</ApplyThemeForAllSlideTypes>");
            xml.AppendLine(_themeSaveHelper.Serialize());
            xml.AppendLine(@"</Settings>");
            using (var sw = new StreamWriter(Asa.Common.Core.Configuration.ResourceManager.Instance.AppSettingsFile.LocalPath, false))
            {
                sw.Write(xml);
                sw.Flush();
            }
        }
Пример #2
0
        public void LoadSettings()
        {
            SettingsManager.Instance.LoadSharedSettings();

            if (!Asa.Common.Core.Configuration.ResourceManager.Instance.AppSettingsFile.ExistsLocal())
            {
                return;
            }
            var document = new XmlDocument();

            document.Load(Asa.Common.Core.Configuration.ResourceManager.Instance.AppSettingsFile.LocalPath);

            var node = document.SelectSingleNode(@"/Settings/SelectedColor");

            if (node != null)
            {
                SelectedColor = node.InnerText;
            }
            node = document.SelectSingleNode(@"/Settings/UseSlideMaster");
            if (node != null)
            {
                if (Boolean.TryParse(node.InnerText, out var tempBool))
                {
                    UseSlideMaster = tempBool;
                }
            }
            node = document.SelectSingleNode(@"/Settings/BroadcastCalendarSettings");
            if (node != null)
            {
                BroadcastCalendarSettings.Deserialize(node);
            }
            node = document.SelectSingleNode(@"/Settings/SalesRep");
            if (node != null)
            {
                SalesRep = node.InnerText;
            }
            node = document.SelectSingleNode(@"/Settings/SelectedStarOutputItemsEncoded");
            if (node != null)
            {
                SelectedStarOutputItemsEncoded = node.InnerText;
            }
            node = document.SelectSingleNode(@"/Settings/SelectedShiftOutputItemsEncoded");
            if (node != null)
            {
                SelectedShiftOutputItemsEncoded = node.InnerText;
            }
            node = document.SelectSingleNode(@"/Settings/ApplyThemeForAllSlideTypes");
            if (node != null)
            {
                if (Boolean.TryParse(node.InnerText, out var tempBool))
                {
                    ApplyThemeForAllSlideTypes = tempBool;
                }
            }
            _themeSaveHelper.Deserialize(document.SelectNodes(@"//Settings/SelectedTheme").OfType <XmlNode>());
        }