public FormWrapper() { Application.ApplicationExit += new EventHandler(OnApplicationExit); SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged); JsonConfig.LoadConfig(); RegistryKey startupKey = Registry.CurrentUser.OpenSubKey(registryStartupLocation); startOnBoot = startupKey.GetValue("WinDynamicDesktop") != null; startupKey.Close(); InitializeComponent(); if (!Directory.Exists("images")) { DownloadImages(); } else if (JsonConfig.firstRun) { UpdateLocation(); } else { wcsService.StartScheduler(); } }
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; }
public FormWrapper() { Application.ApplicationExit += new EventHandler(OnApplicationExit); EnforceSingleInstance(); SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged); JsonConfig.LoadConfig(); _wcsService = new WallpaperChangeScheduler(); InitializeComponent(); _startupManager = UwpDesktop.GetStartupManager(notifyIcon.ContextMenu.MenuItems[6]); if (!Directory.Exists("images")) { DownloadImages(); } else if (JsonConfig.firstRun) { UpdateLocation(); } else { _wcsService.StartScheduler(); } }
public FormWrapper() { Application.ApplicationExit += new EventHandler(OnApplicationExit); SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(OnPowerModeChanged); InitializeComponent(); JsonConfig.LoadConfig(); if (JsonConfig.firstRun) { ShowMainForm(); } else { wcsService.StartScheduler(); } if (!File.Exists("images.zip")) { DownloadImagesZip(); } }
private void OnPowerModeChanged(object sender, PowerModeChangedEventArgs e) { if (e.Mode == PowerModes.Suspend) { if (wcsService.wallpaperTimer != null) { wcsService.wallpaperTimer.Stop(); } wcsService.enableTransitions = false; } else if (e.Mode == PowerModes.Resume) { if (JsonConfig.settings.location != null) { wcsService.StartScheduler(); } wcsService.enableTransitions = true; } }
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"); } }
private void OnRefreshItemClick(object sender, EventArgs e) { _wcsService.StartScheduler(true); }