public async void StartWithOS()
        {
            IsAutoLaunch = !IsAutoLaunch;
            await _startupManager.Set(IsAutoLaunch);

            IsAutoLaunch = await _startupManager.Check();
        }
Example #2
0
        internal static async Task SaveUserSetting(UserSetting setting)
        {
            try
            {
                await _startupManager.Set(setting.General.StartWithSystem);

                await JsonHelper.JsonSerializeAsync(setting, _userSettingFilePath);

                //更细内存对象
                UserSetting = setting;
                //检查开机启动
                if (setting?.General?.StartWithSystem != null)
                {
                    setting.General.StartWithSystem = await _startupManager.Check();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
        }
Example #3
0
        public static async Task ApplySetting(SettingObject setting)
        {
            LocalWallpaperDir = Setting.General.WallpaperSaveDir;
            string cultureName = setting.General.CurrentLan;

            if (cultureName == null)
            {
                cultureName = Thread.CurrentThread.CurrentUICulture.Name;
            }

            Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(cultureName);
            await LanService.UpdateLanguage();

            try
            {
                await _startupManager.Set(setting.General.StartWithWindows);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex);
            }
            setting.General.StartWithWindows = await _startupManager.Check();

            var screenSetting = WallpaperManager.Instance.ScreenIndexs.Select((m) => new ScreenOption()
            {
                ScreenIndex      = m,
                WhenAppMaximized = setting.Wallpaper.ActionWhenMaximized,
            }).ToList();

            var liveWallpaperOptions = new LiveWallpaperOptions
            {
                AppMaximizedEffectAllScreen = true,
                AudioScreenIndex            = setting.Wallpaper.AudioSource,
                ScreenOptions = screenSetting
            };

            await WallpaperManager.Instance.SetOptions(liveWallpaperOptions);
        }
Example #4
0
        private static async Task ApplySetting(UserSetting setting)
        {
            //设置开机启动
            _ = await _startupManager.Set(setting.General.StartWithSystem);

            // 更新开机启动结果
            if (setting?.General?.StartWithSystem != null)
            {
                setting.General.StartWithSystem = await _startupManager.Check();
            }

            string ffmpegSaveDir = FFmpegSaveDir;

            if (_FFMpegDownloader != null)
            {
                _FFMpegDownloader.DistDir = ffmpegSaveDir;
            }

            ProcessHelper.AddPathToEnvoirment(ffmpegSaveDir);

            //设置壁纸参数
            _ = await WallpaperApi.SetOptions(setting.Wallpaper);
        }