Example #1
0
        private void App_Startup(object sender, StartupEventArgs e)
        {
            if (Settings.Default.RunOnStartup)
            {
                WindowsUtility.EnableRunOnStartup();
            }
            else
            {
                WindowsUtility.DisableRunOnStartup();
            }

            #region Setting
            var path = Path.Combine(GetFolderPath(SpecialFolder.MyPictures), "BingWallpaper");
            if (string.IsNullOrEmpty(Settings.Default.FolderPath) || !Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
                Settings.Default.FolderPath = $"{path}\\";
            }

            if (string.IsNullOrEmpty(Settings.Default.CompanyName))
            {
                Settings.Default.CompanyName = Assembly.GetExecutingAssembly().GetName().Name.Replace(' ', '_');
            }

            Settings.Default.Save();
            #endregion

            ApplicationDbContext.Seed();

            Task.Run(() => DownloadTodayImage());
        }