示例#1
0
        private static List <ToolStripItem> GetOptionsMenuItems()
        {
            List <ToolStripItem> items = new List <ToolStripItem>();

            items.Add(new ToolStripMenuItem(_("Select &Language..."), null, OnLanguageItemClick));
            items.Add(new ToolStripSeparator());

            items.Add(new ToolStripMenuItem(_("Edit Configuration File"), null, OnEditConfigFileClick));
            items.Add(new ToolStripMenuItem(_("Reload Configuration File"), null, OnReloadConfigFileClick));
            items.Add(new ToolStripSeparator());

            shuffleItem         = new ToolStripMenuItem(_("Shuffle wallpaper daily"), null, OnShuffleItemClick);
            shuffleItem.Checked = JsonConfig.settings.enableShuffle;
            items.Add(shuffleItem);

            fullScreenItem         = new ToolStripMenuItem(_("Pause while fullscreen apps running"), null, OnFullScreenItemClick);
            fullScreenItem.Checked = JsonConfig.settings.fullScreenPause;
            items.Add(fullScreenItem);

            if (BrightnessController.IsDDCSupported)
            {
                items.Add(new ToolStripSeparator());
                items.Add(new ToolStripMenuItem(_("Set Auto Brightness"), null, OnSetAutoBrightnessItemClick));
            }

            items.AddRange(SystemThemeChanger.GetMenuItems());
            items.AddRange(WallpaperCompressionChanger.GetMenuItems());
            items.AddRange(UpdateChecker.GetMenuItems());

            return(items);
        }
示例#2
0
        private static List <ToolStripItem> GetOptionsMenuItems()
        {
            List <ToolStripItem> items = new List <ToolStripItem>();

            items.AddRange(SystemThemeChanger.GetMenuItems());
            items.AddRange(UpdateChecker.GetMenuItems());

            return(items);
        }
示例#3
0
        private static List <ToolStripItem> GetOptionsMenuItems()
        {
            List <ToolStripItem> items = new List <ToolStripItem>();

            items.Add(new ToolStripMenuItem(_("Select &Language..."), null, OnLanguageItemClick));
            items.AddRange(SystemThemeChanger.GetMenuItems());
            items.AddRange(UpdateChecker.GetMenuItems());

            return(items);
        }
示例#4
0
        public void RunScheduler(bool forceImageUpdate = false)
        {
            if (!LaunchSequence.IsLocationReady() || !LaunchSequence.IsThemeReady())
            {
                return;
            }

            schedulerTimer.Stop();

            SolarData data = SunriseSunsetService.GetSolarData(DateTime.Today);

            isSunUp = (data.sunriseTime <= DateTime.Now && DateTime.Now < data.sunsetTime);
            DateTime?nextImageUpdateTime = null;

            if (ThemeManager.currentTheme != null)
            {
                if (forceImageUpdate)
                {
                    lastImagePath = null;
                }

                WallpaperShuffler.MaybeShuffleWallpaper();
                SchedulerState imageData = GetImageData(data, ThemeManager.currentTheme);
                SetWallpaper(imageData.imageId);
                nextImageUpdateTime = new DateTime(imageData.nextUpdateTicks);
            }

            SystemThemeChanger.TryUpdateSystemTheme();

            if (data.polarPeriod != PolarPeriod.None)
            {
                nextUpdateTime = DateTime.Today.AddDays(1);
            }
            else 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);
        }
示例#5
0
        private static List <MenuItem> GetOptionsMenuItems()
        {
            List <MenuItem> items = new List <MenuItem>();

            startOnBootItem = new MenuItem("&Start when Windows boots", OnStartOnBootClick);
            items.Add(startOnBootItem);

            items.AddRange(SystemThemeChanger.GetMenuItems());
            items.AddRange(UpdateChecker.GetMenuItems());

            return(items);
        }
示例#6
0
        public void RunScheduler()
        {
            if (ThemeManager.currentTheme == null)
            {
                return;
            }

            wallpaperTimer.Stop();

            if (JsonConfig.settings.useWindowsLocation)
            {
                Task.Run(() => UwpLocation.UpdateGeoposition());
            }

            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();
        }
示例#7
0
        public void RunScheduler(bool forceImageUpdate = false)
        {
            if (!LaunchSequence.IsLocationReady() || !ThemeManager.filesVerified)
            {
                return;
            }

            schedulerTimer.Stop();

            SolarData data = SunriseSunsetService.GetSolarData(DateTime.Today);

            isSunUp = (data.sunriseTime <= DateTime.Now && DateTime.Now < data.sunsetTime);
            DateTime?nextImageUpdateTime = null;

            if (ThemeManager.currentTheme != null)
            {
                if (forceImageUpdate)
                {
                    lastImagePath = null;
                }

                Tuple <int, long> imageData = GetImageData(data, ThemeManager.currentTheme,
                                                           JsonConfig.settings.darkMode);
                SetWallpaper(imageData.Item1);
                nextImageUpdateTime = new DateTime(imageData.Item2);
            }

            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);
        }
示例#8
0
        public void RunScheduler()
        {
            if (ThemeManager.currentTheme == null)
            {
                return;
            }

            wallpaperTimer.Stop();

            DateTime today = DateTime.Today;

            todaysData = GetSolarData(today);

            if (DateTime.Now < todaysData.SunriseTime + timerError)
            {
                // Before sunrise
                yesterdaysData = GetSolarData(today.AddDays(-1));
                tomorrowsData  = null;
            }
            else if (DateTime.Now >= todaysData.SunsetTime - timerError)
            {
                // After sunset
                yesterdaysData = null;
                tomorrowsData  = 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();
        }
示例#9
0
        private static List <ToolStripItem> GetOptionsMenuItems()
        {
            List <ToolStripItem> items = new List <ToolStripItem>();

            items.Add(new ToolStripMenuItem(_("Select &Language..."), null, OnLanguageItemClick));

            if (BrightnessController.IsDDCSupported)
            {
                items.Add(new ToolStripMenuItem(_("Set Auto Brightness"), null, OnSetAutoBrightnessItemClick));
            }

            items.Add(new ToolStripSeparator());
            items.AddRange(SystemThemeChanger.GetMenuItems());
            items.AddRange(WallpaperCompressionChanger.GetMenuItems());
            items.AddRange(UpdateChecker.GetMenuItems());

            return(items);
        }
示例#10
0
        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();
        }