Ejemplo n.º 1
0
        public static async Task SetBothAsync(StorageFile savedFile)
        {
            Events.LogSetAsBoth();

            var uc = new LoadingTextControl()
            {
                LoadingText = ResourcesHelper.GetResString("SettingDesktopAndLockHint")
            };
            await PopupService.Instance.ShowAsync(uc, solidBackground : false).ConfigureAwait(true);

            var file = await PrepareImageFileAsync(savedFile).ConfigureAwait(true);

            if (file != null)
            {
                var result0 = await UserProfilePersonalizationSettings.Current.TrySetWallpaperImageAsync(file);

                var result1 = await UserProfilePersonalizationSettings.Current.TrySetLockScreenImageAsync(file);

                if (!result0 || !result1)
                {
                    ShowFailedToast();
                }
            }

            PopupService.Instance.TryHide(500);
        }
Ejemplo n.º 2
0
        public static async Task SetBothAsync(StorageFile savedFile)
        {
            var uc = new LoadingTextControl()
            {
                LoadingText = "Setting background and lockscreen..."
            };
            await PopupService.Instance.ShowAsync(uc);

            var file = await PrepareImageFileAsync(savedFile);

            if (file != null)
            {
                var result1 = await UserProfilePersonalizationSettings.Current.TrySetWallpaperImageAsync(file);

                var result2 = await UserProfilePersonalizationSettings.Current.TrySetLockScreenImageAsync(file);

                //var task = file.DeleteAsync(StorageDeleteOption.PermanentDelete);

                if (result1 && result2)
                {
                    ToastService.SendToast("Set as background and lock screen successfully.");
                }
                else
                {
                    ToastService.SendToast("Fail to set both. #API ERROR.");
                }
            }

            PopupService.Instance.TryHide(500);
        }
        public static async Task SetAsLockscreenAsync(StorageFile savedFile)
        {
            var uc = new LoadingTextControl()
            {
                LoadingText = "Setting background and lockscreen..."
            };
            await PopupService.Instance.ShowAsync(uc);

            var file = await PrepareImageFileAsync(savedFile);

            if (file != null)
            {
                var result = await UserProfilePersonalizationSettings.Current.TrySetLockScreenImageAsync(file);

                if (!result)
                {
                    ToastService.SendToast("Fail to set both. #API ERROR.");
                }
            }

            PopupService.Instance.TryHide(500);
        }
        public static async Task SetAsLockscreenAsync(StorageFile savedFile)
        {
            var uc = new LoadingTextControl()
            {
                LoadingText = ResourcesHelper.GetResString("SettingLockHint")
            };
            await PopupService.Instance.ShowAsync(uc, solidBackground : false);

            var file = await PrepareImageFileAsync(savedFile);

            if (file != null)
            {
                var result = await UserProfilePersonalizationSettings.Current.TrySetLockScreenImageAsync(file);

                if (!result)
                {
                    ShowFailedToast();
                }
            }

            PopupService.Instance.TryHide(500);
        }