示例#1
0
        private async Task ChangeBackgroundAsync()
        {
            if (ImageDataService.UsedList == null)
            {
                ImageDataService.UsedList = new List <Photo>();
            }
            if (UserProfilePersonalizationSettings.IsSupported() && ImageDataService.CuratedWallpaperCollection?.Count > 0)
            {
                try
                {
                    IsBusy        = true;
                    SelectedPhoto = await GetNewPhotoAsync();

                    if (SelectedPhoto != null)
                    {
                        await BackgroundHelper.SetBackgroundAsync(SelectedPhoto);
                    }
                }
                catch (Exception ex)
                {
                    Telemetry.LogException(ex);
                    await DialogHelper.ShowDialogAsync("Something went wrong.");
                }
                finally
                {
                    IsBusy = false;
                }
            }
        }