private void SetRandomWallpaperBtn_Click(object sender, EventArgs e) { for (int i = 0; i < 6; i++) { try { Uri randomPic = PictureController.GetRandomUriPic(); WallpaperController.Set(randomPic, WallpaperController.Style.Stretched); return; } catch { MessageBox.Show(MessageHelper.GetMessageByName("RandomPicError")); } } }
private void SetWallpaperBtn_Click(object sender, EventArgs e) { string pictureKey = this.PictureListCB.SelectedItem.ToString(); if (String.IsNullOrEmpty(pictureKey)) { MessageBox.Show(MessageHelper.GetMessageByName("EmptyPictureKey")); return; } try { Uri Pic = PictureController.GetUriPicByName(pictureKey); WallpaperController.Set(Pic, WallpaperController.Style.Stretched); } catch { MessageBox.Show(MessageHelper.GetMessageByName("SetPictureError")); } }