Example #1
0
        public void SaveSettings(IEnumerable <BrieflyVM> brieflies, BrieflyVM loadOnStart = null)
        {
            Locations = brieflies.Select(item => new LocationInfo(item.Location)).ToList();

            if (loadOnStart != null)
            {
                DefaultLocation = new LocationInfo(loadOnStart.Location);
            }

            FileStream fs = new FileStream("settings.xml", FileMode.Create);

            XmlSerializer xmlSerializer = new XmlSerializer(typeof(UserSettings));

            xmlSerializer.Serialize(fs, this);

            fs.Close();
        }
Example #2
0
        public CommonVM(MainVM main, BrieflyVM vm)
        {
            mainVM    = main;
            brieflyVM = vm;

            Location = brieflyVM.Location;

            TemperatureVM = brieflyVM.ForecastModel?.GetTemperature();

            City = brieflyVM.City;

            try
            {
                Icon = new BitmapImage(brieflyVM.Icon?.UriSource);
                Icon.Freeze();
            }
            catch { };
        }