private void loadSettings()
        {
            StreamResourceInfo xml = Application.GetResourceStream(new Uri("/MySchoolApp;component/Data/Settings.xml", UriKind.Relative));
            XDocument settingsDoc = XDocument.Load(xml.Stream);

            Settings = new Settings()
            {
                Name = settingsDoc.Root.Element("name").Value,
                NewsUrl = settingsDoc.Root.Element("newsUrl").Value,
                BingMapsKey = settingsDoc.Root.Element("bingMapsKey").Value,
                MapsApplicationId = settingsDoc.Root.Element("mapsApplicationId").Value,
                MapsAuthenticationToken = settingsDoc.Root.Element("mapsAuthenitcationToken").Value,
                WeatherApiKey = settingsDoc.Root.Element("weatherApiKey").Value,
                ThemeColor1 = Utils.GetColorFromRGB(settingsDoc.Root.Element("themeColor1").Value),
                ThemeColor2 = Utils.GetColorFromRGB(settingsDoc.Root.Element("themeColor2").Value)
            };
        }
Exemplo n.º 2
0
        private void loadSettings()
        {
            StreamResourceInfo xml = Application.GetResourceStream(new Uri("/MySchoolApp;component/Data/Settings.xml", UriKind.Relative));
            XDocument settingsDoc;
            try
            {
                settingsDoc = XDocument.Load(xml.Stream);
            }
            catch (Exception e)
            {
                settingsDoc = null;
            }

            if (settingsDoc != null)
            {
                Settings = new Settings()
                {
                    Name = settingsDoc.Root.Element("name").Value,
                    NewsUrl = settingsDoc.Root.Element("newsUrl").Value,
                    BingMapsKey = settingsDoc.Root.Element("bingMapsKey").Value,
                    ThemeColor1 = Utils.GetColorFromRGB(settingsDoc.Root.Element("themeColor1").Value),
                    ThemeColor2 = Utils.GetColorFromRGB(settingsDoc.Root.Element("themeColor2").Value)
                };
            }
        }