예제 #1
0
        private void Set_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(Filepath.Text))
            {
                MessageBox.Show("please select a file");
                return;
            }

            if (Uri.IsWellFormedUriString(Filepath.Text, UriKind.RelativeOrAbsolute))
            {
                //string folder = @"C:\Users\skoley\Pictures\Saved Pictures\";
                //string filename = DateTime.Now.ToString("dd_MM_yyyy_hh_mm_ss") + ".png";
                try
                {
                    string savedFilePath = _picture.DownloadImage(Filepath.Text);//,folder,filename);
                    //string savedFilePath = _picture.DownloadImage(Filepath.Text,folder,filename);
                    if (!string.IsNullOrEmpty(savedFilePath))
                    {
                        WallpaperStyle _style = (WallpaperStyle)Style.SelectedItem;
                        Wallpaper.SilentSet(savedFilePath, _style);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                WallpaperStyle _style = (WallpaperStyle)Style.SelectedItem;
                Wallpaper.SilentSet(Filepath.Text, _style);
            }
        }
예제 #2
0
 private void setBingImage_Click(object sender, EventArgs e)
 {
     try
     {
         string savedFilePath = bingobj.GetDownloadedImagePath();
         //string savedFilePath = BingBackground.GetDownloadedImagePath();
         if (!string.IsNullOrEmpty(savedFilePath))
         {
             WallpaperStyle _style = (WallpaperStyle)Style.SelectedItem;
             Wallpaper.SilentSet(savedFilePath, _style);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }