private void ToggleDarkMode() { _wcsService.ToggleDarkMode(); notifyIcon.ContextMenu.MenuItems[5].Checked = JsonConfig.settings.darkMode; JsonConfig.SaveConfig(); }
private void okButton_Click(object sender, EventArgs e) { okButton.Enabled = false; LocationIQData data = LocationIQService.GetLocationData(inputBox.Text); if (data != null) { JsonConfig.settings.location = inputBox.Text; JsonConfig.settings.latitude = data.lat; JsonConfig.settings.longitude = data.lon; JsonConfig.SaveConfig(); wcsService.StartScheduler(true); MessageBox.Show("Location set successfully to: " + data.display_name + Environment.NewLine + "Latitude = " + data.lat + ", Longitude = " + data.lon, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } else { MessageBox.Show("The location you entered was invalid, or you are not connected to " + "the Internet", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); } okButton.Enabled = true; }
private void ToggleAutoUpdate() { JsonConfig.settings.disableAutoUpdate ^= true; notifyIcon.ContextMenu.MenuItems[9].Checked = !JsonConfig.settings.disableAutoUpdate; UpdateChecker.TryCheckAuto(); JsonConfig.SaveConfig(); }
private void ToggleDarkMode() { JsonConfig.settings.darkMode ^= true; notifyIcon.ContextMenu.MenuItems[5].Checked = JsonConfig.settings.darkMode; _wcsService.RunScheduler(); JsonConfig.SaveConfig(); }
private static void OnAutoUpdateItemClick(object sender, EventArgs e) { bool isEnabled = JsonConfig.settings.disableAutoUpdate ^ true; JsonConfig.settings.disableAutoUpdate = isEnabled; menuItem.Checked = isEnabled; TryCheckAuto(true); JsonConfig.SaveConfig(); }
private static void ToggleAutoUpdate() { bool isEnabled = JsonConfig.settings.disableAutoUpdate ^ true; JsonConfig.settings.disableAutoUpdate = isEnabled; menuItem.Checked = isEnabled; TryCheckAuto(true); JsonConfig.SaveConfig(); }
private static void OnThemeItemClick(object sender, EventArgs e) { bool isEnabled = JsonConfig.settings.changeSystemTheme ^ true; JsonConfig.settings.changeSystemTheme = isEnabled; menuItem.Checked = isEnabled; TryUpdateSystemTheme(); JsonConfig.SaveConfig(); }
private static void ToggleChangeSystemTheme() { bool isEnabled = JsonConfig.settings.changeSystemTheme ^ true; JsonConfig.settings.changeSystemTheme = isEnabled; menuItem.Checked = isEnabled; TryUpdateSystemTheme(); JsonConfig.SaveConfig(); }
public void RunScheduler() { if (ThemeManager.currentTheme == null) { return; } wallpaperTimer.Stop(); string currentDate = GetDateString(); todaysData = GetWeatherData(currentDate); if (DateTime.Now < todaysData.SunriseTime + timerError) { // Before sunrise yesterdaysData = GetWeatherData(GetDateString(-1)); tomorrowsData = null; } else if (DateTime.Now >= todaysData.SunsetTime - timerError) { // After sunset yesterdaysData = null; tomorrowsData = GetWeatherData(GetDateString(1)); } else { // Between sunrise and sunset yesterdaysData = null; tomorrowsData = null; } isDayNow = (yesterdaysData == null && tomorrowsData == null); lastImageId = -1; if (isDayNow) { UpdateDayImage(); } else { UpdateNightImage(); } SystemThemeChanger.TryUpdateSystemTheme(); JsonConfig.SaveConfig(); }
private static void CheckAuto() { string currentVersion = GetCurrentVersion(); string latestVersion = GetLatestVersion(); if (latestVersion == null) { return; } else if (IsUpdateAvailable(currentVersion, latestVersion)) { AppContext.ShowPopup("WinDynamicDesktop " + latestVersion + " is available. " + "Click here to download it.", "Update Available"); } JsonConfig.settings.lastUpdateCheck = DateTime.Now.ToString(); JsonConfig.SaveConfig(); }
public void RunScheduler() { wallpaperTimer.Stop(); DateTime today = DateTime.Today; todaysData = SunriseSunsetService.GetSolarData(today); if (DateTime.Now < todaysData.SunriseTime + timerError) { // Before sunrise yesterdaysData = SunriseSunsetService.GetSolarData(today.AddDays(-1)); tomorrowsData = null; } else if (DateTime.Now >= todaysData.SunsetTime - timerError) { // After sunset yesterdaysData = null; tomorrowsData = SunriseSunsetService.GetSolarData(today.AddDays(1)); } else { // Between sunrise and sunset yesterdaysData = null; tomorrowsData = null; } isDayNow = (yesterdaysData == null && tomorrowsData == null); lastImageId = -1; if (isDayNow) { UpdateDayImage(); } else { UpdateNightImage(); } SystemThemeChanger.TryUpdateSystemTheme(); JsonConfig.SaveConfig(); }
private static void CheckAuto() { string currentVersion = GetCurrentVersion(); string latestVersion = GetLatestVersion(); if (latestVersion == null) { return; } else if (IsUpdateAvailable(currentVersion, latestVersion)) { _notifyIcon.BalloonTipTitle = "Update Available"; _notifyIcon.BalloonTipText = "WinDynamicDesktop " + latestVersion + " is available. " + "Click here to download it."; _notifyIcon.ShowBalloonTip(10000); } JsonConfig.settings.lastUpdateCheck = DateTime.Now.ToString("yyyy-MM-dd"); JsonConfig.SaveConfig(); }
private void setLocationButton_Click(object sender, EventArgs e) { LocationIQService service = new LocationIQService(); LocationIQData data = service.GetLocationData(locationInput.Text); if (data != null) { AppendToLog("Location set successfully to: " + data.display_name); AppendToLog("Latitude = " + data.lat + ", Longitude= " + data.lon); JsonConfig.settings.Location = locationInput.Text; JsonConfig.settings.Latitude = data.lat; JsonConfig.settings.Longitude = data.lon; JsonConfig.SaveConfig(); wcsService.StartScheduler(); } else { MessageBox.Show("The location you entered was invalid, or you are not connected to " + "the Internet", "Error"); } }
public static void TryCheckAuto() { if (UwpDesktop.IsRunningAsUwp() || JsonConfig.settings.disableAutoUpdate) { return; } if (JsonConfig.settings.lastUpdateCheck != null) { DateTime lastUpdateCheck = DateTime.Parse(JsonConfig.settings.lastUpdateCheck); int dayDiff = (new TimeSpan(DateTime.Now.Ticks - lastUpdateCheck.Ticks)).Days; if (dayDiff < 7) { return; } } CheckAuto(); JsonConfig.settings.lastUpdateCheck = DateTime.Now.ToString("yyyy-MM-dd"); JsonConfig.SaveConfig(); }
public void RunScheduler(bool forceImageUpdate = false) { schedulerTimer.Stop(); SolarData data = SunriseSunsetService.GetSolarData(DateTime.Today); DaySegment currentSegment; if (data.solarTimes[0] <= DateTime.Now && DateTime.Now < data.solarTimes[1]) { currentSegment = DaySegment.Sunrise; } else if (data.solarTimes[1] <= DateTime.Now && DateTime.Now < data.solarTimes[2]) { currentSegment = DaySegment.Day; } else if (data.solarTimes[2] <= DateTime.Now && DateTime.Now < data.solarTimes[3]) { currentSegment = DaySegment.Sunset; } else { currentSegment = DaySegment.Night; } isSunUp = (data.sunriseTime <= DateTime.Now && DateTime.Now < data.sunsetTime); DateTime?nextImageUpdateTime = null; if (ThemeManager.currentTheme != null) { if (forceImageUpdate) { lastImagePath = null; } nextImageUpdateTime = UpdateImage(data, currentSegment); } SystemThemeChanger.TryUpdateSystemTheme(); if (isSunUp) { nextUpdateTime = data.sunsetTime; } else if (DateTime.Now < data.solarTimes[0]) { nextUpdateTime = data.sunriseTime; } else { SolarData tomorrowsData = SunriseSunsetService.GetSolarData( DateTime.Today.AddDays(1)); nextUpdateTime = tomorrowsData.sunriseTime; } if (nextImageUpdateTime.HasValue && nextImageUpdateTime.Value < nextUpdateTime.Value) { nextUpdateTime = nextImageUpdateTime; } StartTimer(nextUpdateTime.Value); JsonConfig.SaveConfig(); }