コード例 #1
0
        public async Task UpdateWallpaper()
        {
            if (Settings.PauseWallpaperUpdate)
            {
                return;
            }

            MainWindow.log.Info("Updating wallpaper - starting...");
            Settings.CurrentDate = DateTime.Now;

            for (int i = 0; i < 6; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    if (Settings.SelectedMonthDays[(i * 7) + j].Date.ToString("MM/dd/yyyy") == Settings.CurrentDate.ToString("MM/dd/yyyy"))
                    {
                        CurrentDateCell.X = j + 1;
                        CurrentDateCell.Y = i + 1;
                    }
                }
            }

            await Task.Run(() => Wallpaper.CreateCalendar(Settings.DarkMode, Settings.CurrentDate,
                                                          CurrentDateCell, Settings.SelectedMonthDays.ToList(), Settings.HabitDays.ToList()));

            Wallpaper.Set(IOPath.Combine(AppDomain.CurrentDomain.BaseDirectory, "output.png"));
        }