private async void BtnApply_Click(object sender, EventArgs e) { string path = null; if (SelectMenu.IsFromWeb) { path = selectMenu.GetPathFromWeb(); } else { path = selectMenu.GetImageLocalPath(); } DesktopWallpaperChangerService wallpaper = new DesktopWallpaperChangerService(); if (RbStretched.Checked) { await DesktopChangerMainMenuController.SetNewDesktopStretchedAsync(path, wallpaper); } else if (RbTiled.Checked) { await DesktopChangerMainMenuController.SetNewDesktopTiledAsync(path, wallpaper); } else { await DesktopChangerMainMenuController.SetDesktopCentredAsync(path, wallpaper); } }
public static async Task SetNewDesktopStretchedAsync(string path, DesktopWallpaperChangerService wallpaper) { await Task.Run(() => wallpaper.Set(path, DesktopWallpaperChangerService.Style.Stretched)); }