private void CbWallpaperMode_SelectedValueChanged(object sender, EventArgs e) { if (!this.parentForm.applyingSettings) { // enumStringToType: this.parentForm.settings.WallpaperMode = (Wallpaper.WallpaperModes)Enum.Parse(typeof(Wallpaper.WallpaperModes), cbWallpaperMode.SelectedItem.ToString()); parentForm.AdjustDesktopImages(); } }
//private void cbPopularLocations_SelectedIndexChanged(object sender, EventArgs e) //{ // //if (this.parentForm.applyingSettings == false) // { // if (cbPopularLocations.SelectedItem.ToString(CultureInfo.InvariantCulture) != "[NONE]") // { // /// more locations: http://www.tageo.com/index-e-as-cities-AU.htm // double lat = 0; // double lng = 0; // FrmMain.GetLatLongByName(cbPopularLocations.SelectedItem.ToString(CultureInfo.InvariantCulture), out lat, out lng); // txtLatitude.Text = lat.ToString(CultureInfo.InvariantCulture); // txtLongitude.Text = lng.ToString(CultureInfo.InvariantCulture); // setLocationInfo(); // SetUseSunriseSunset(); // doTimerCheckChanged(); // SetUseSunriseSunset(); // //doTimerCheckChanged(); // } // else // { // txtLatitude.Text = "-0.000000"; // txtLongitude.Text = "0.000000"; // } // // either way, set the values // //setLocationInfo(); // //SetUseSunriseSunset(); // //doTimerCheckChanged(); // //if (parentForm.settings.UseSunriseSunset) // //{ // // GetSunriseSunset(); // //} // } //} //private void GetSunriseSunset() //{ // int offsetMins = 0; // offsetMins = int.Parse(txtOffsetMins.Text); // SunTimes.LatitudeCoords.Direction latDirection = SunTimes.LatitudeCoords.Direction.South; // SunTimes.LongitudeCoords.Direction longDirection = SunTimes.LongitudeCoords.Direction.East; // if (double.Parse(txtLatitude.Text) > 0) latDirection = SunTimes.LatitudeCoords.Direction.North; // if (double.Parse(txtLongitude.Text) <= 0) longDirection = SunTimes.LongitudeCoords.Direction.West; // parentForm.GetSunriseSunset(double.Parse(txtLatitude.Text), double.Parse(txtLongitude.Text), latDirection, longDirection); // DateTime sunrise = parentForm.sunrise; // DateTime sunset = parentForm.sunset; // sunrise = sunrise.AddMinutes(offsetMins); // sunset = sunset.AddMinutes(offsetMins); // // round mins to nearest 5 // double sunriseMins = sunrise.Minute; // double sunsetMins = sunset.Minute; // sunriseMins = MathExtra.RoundCustom(sunriseMins, 5); // sunsetMins = MathExtra.RoundCustom(sunsetMins, 5); // if (sunriseMins > 55) sunriseMins = 55; // if (sunsetMins > 55) sunsetMins = 55; // parentForm.sunrise = new DateTime(sunrise.Year, sunrise.Month, sunrise.Day, sunrise.Hour, (int)(sunriseMins), 0); // parentForm.sunset = new DateTime(sunset.Year, sunset.Month, sunset.Day, sunset.Hour, (int)(sunsetMins), 0); // lblSunriseSunset.Text = ("Sunrise @ " + sunrise.ToString("HH:mm") + "\nSunset @ " + sunset.ToString("HH:mm")); // if (parentForm.settings.UseSunriseSunset) // { // if (cbPopularLocations.SelectedItem.ToString(CultureInfo.InvariantCulture) != "[NONE]") // { // parentForm.settings.LightSunriseTime = parentForm.sunrise; // parentForm.settings.DarkSunsetTime = parentForm.sunset; // // Set the Light and Dark Times // SetLightDarkTimeControls(); // } // } //} private void GetSunriseSunset() { int offsetMins;// = 0; offsetMins = int.Parse(txtOffsetMins.Text, CultureInfo.InvariantCulture); SunTimes.LatitudeCoords.Direction latDirection = SunTimes.LatitudeCoords.Direction.North; SunTimes.LongitudeCoords.Direction longDirection = SunTimes.LongitudeCoords.Direction.East; double lat = double.Parse(txtLatitude.Text, CultureInfo.InvariantCulture); double lon = double.Parse(txtLongitude.Text, CultureInfo.InvariantCulture); if (lat < 0) { latDirection = SunTimes.LatitudeCoords.Direction.South; } if (lon < 0) { longDirection = SunTimes.LongitudeCoords.Direction.West; } parentForm.GetSunriseSunset(lat, lon, latDirection, longDirection); DateTime sunrise = parentForm.sunrise; DateTime sunset = parentForm.sunset; sunrise = sunrise.AddMinutes(offsetMins); sunset = sunset.AddMinutes(offsetMins); // round mins to nearest 5 double sunriseMins = sunrise.Minute; double sunsetMins = sunset.Minute; sunriseMins = MathExtra.RoundCustom(sunriseMins, 5); sunsetMins = MathExtra.RoundCustom(sunsetMins, 5); if (sunriseMins > 55) { sunriseMins = 55; } if (sunsetMins > 55) { sunsetMins = 55; } parentForm.sunrise = new DateTime(sunrise.Year, sunrise.Month, sunrise.Day, sunrise.Hour, (int)(sunriseMins), 0); parentForm.sunset = new DateTime(sunset.Year, sunset.Month, sunset.Day, sunset.Hour, (int)(sunsetMins), 0); lblSunriseSunset.Text = ("Sunrise @ " + sunrise.ToString("HH:mm", CultureInfo.InvariantCulture) + "\nSunset @ " + sunset.ToString("HH:mm", CultureInfo.InvariantCulture)); if (parentForm.settings.UseSunriseSunset) { parentForm.settings.LightSunriseTime = parentForm.sunrise; parentForm.settings.DarkSunsetTime = parentForm.sunset; // Set the Light and Dark Times SetLightDarkTimeControls(); if (!parentForm.applyingSettings) { // if not on NULL ISLAND (0,0) //https://en.wikipedia.org/wiki/Null_Island if ((double.Parse(txtLatitude.Text, CultureInfo.InvariantCulture) == 0 && double.Parse(txtLongitude.Text, CultureInfo.InvariantCulture) == 0) == false) { parentForm.AdjustDesktopImages(); //(false); } } } }