Exemple #1
0
 private void TextOptionsUpdated(object sender, TextChangedEventArgs args)
 {
     SettingsLoader.changedData.maxImageCount        = Convert.ToInt32(view.maxImageCount);
     SettingsLoader.changedData.plz                  = view.plz;
     SettingsLoader.changedData.openWeatherMapAPIKey = view.apiKey;
     SettingsLoader.UpdateSettings();
 }
Exemple #2
0
 private void OptionsUpdated(object sender, RoutedEventArgs e)
 {
     SettingsLoader.changedData.startWithWindows   = view.chkBxStartWithWindows;
     SettingsLoader.changedData.changeInBackground = view.chkBxChangeInBackground;
     SettingsLoader.changedData.autoImageSearch    = view.chkBxAutoImageSearch;
     SettingsLoader.UpdateSettings();
     SettingsLoader.ApplyAutoStart();
 }
Exemple #3
0
        private void BanUseUpdated(object sender, RoutedEventArgs e)
        {
            if (view.imageSelection == null || view.imageSelection == "")
            {
                return;
            }
            PersistentData data = new PersistentData(SettingsLoader.GetCurrentSettingsData());

            for (int i = 0; i < data.imageData.Count; i++)
            {
                if (data.imageData[i].fileName == view.imageSelection)
                {
                    DataStructures.ImageData temp = data.imageData[i];
                    temp.banUse                = view.chkBxBanUse;
                    data.imageData[i]          = temp;
                    SettingsLoader.changedData = data;
                    SettingsLoader.UpdateSettings();
                }
            }
        }
Exemple #4
0
        private void ComboboxUpdated(object sender, SelectionChangedEventArgs args)
        {
            if (view.imageSelection == null || view.imageSelection == "")
            {
                return;
            }
            PersistentData data = new PersistentData(SettingsLoader.GetCurrentSettingsData());

            for (int i = 0; i < data.imageData.Count; i++)
            {
                if (data.imageData[i].fileName == view.imageSelection)
                {
                    DataStructures.ImageData temp = data.imageData[i];
                    temp.targetDaytime         = Helperfunctions.ConvertComboIntToDaytime(view.selectedItemDayTime);
                    temp.targetSeason          = Helperfunctions.ConvertComboIntToSeason(view.selectedItemSeason);
                    temp.targetWeather         = Helperfunctions.ConvertComboIntToWeather(view.selectedItemWeather);
                    data.imageData[i]          = temp;
                    SettingsLoader.changedData = data;
                    SettingsLoader.UpdateSettings();
                }
            }
        }
Exemple #5
0
        public void ImageClicked(Image sender)
        {
            string filePath = sender.Source.ToString();

            view.imageSelection = filePath;
            BitmapImage image = new BitmapImage();

            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource   = new Uri(filePath);
            image.EndInit();
            SelectedImageBox.Source = image;
            PersistentData data = SettingsLoader.GetCurrentSettingsData();

            for (int i = 0; i < data.imageData.Count(); i++)
            {
                if (data.imageData[i].fileName == filePath)
                {
                    //update displayed imagedata
                    view.selectedItemWeather = Helperfunctions.ConvertWeatherEnumToComboInt(data.imageData[i].targetWeather);
                    view.selectedItemDayTime = Helperfunctions.ConvertDayTimeToComboInt(data.imageData[i].targetDaytime);
                    view.selectedItemSeason  = Helperfunctions.ConvertSeasonToComboInt(data.imageData[i].targetSeason);
                    view.chkBxBanUse         = data.imageData[i].banUse;
                    return;
                }
            }

            //file has no data yet, write entry
            DataStructures.ImageData newEntry = new DataStructures.ImageData();
            newEntry.fileName      = filePath;
            newEntry.targetDaytime = DataStructures.enumDayTime.DAWN;
            newEntry.targetSeason  = DataStructures.enumSeason.SPRING;
            newEntry.targetWeather = DataStructures.enumWeather.CLEAR_SKY;
            newEntry.banUse        = false;
            data.imageData.Add(newEntry);
            SettingsLoader.changedData.imageData = data.imageData;
            SettingsLoader.UpdateSettings();
            ImageClicked(sender);
        }