/// <summary> /// Increment the slideshow pointer and display the next image. /// Also trim to 250 slides if needed. /// </summary> private void SetImage() { if (lblImageInfo.InvokeRequired) { Invoke(new SetImageDelegate(SetImage)); return; } try { //Only keep 250 images in the slideshow and kick out the oldest. if (Playlist.Count > 250) { Playlist.RemoveAt(0); if (PlaylistIndex > 0) { PlaylistIndex--; } } if (PlaylistIndex > Playlist.Count) { PlaylistIndex--; } CachedSearchResults result = Playlist[PlaylistIndex - 1]; this.BackgroundImage = Image.FromFile(result.Path); lblImageInfo.Text = result.Wallpaper.name + Environment.NewLine + "ID: " + result.Wallpaper.id; if (result.Wallpaper.sub_category != null && result.Wallpaper.sub_category.Trim().Length > 0) { lblImageInfo.Text += Environment.NewLine + "Category: " + result.Wallpaper.category; } if (result.Wallpaper.sub_category != null && result.Wallpaper.sub_category.Trim().Length > 0) { lblImageInfo.Text += " Sub: " + result.Wallpaper.sub_category; } } catch (Exception ex) { Console.WriteLine("MainForm.SetImage: " + Environment.NewLine + ex.Message + Environment.NewLine + ex.StackTrace); } }
//private static void OnRenamed(object source, RenamedEventArgs e) //{ // // Specify what is done when a file is renamed. // Console.WriteLine("File: {0} renamed to {1}", e.OldFullPath, e.FullPath); //} private void SetImage(Screen screen, CachedSearchResults result) { bgSetter.setWallforScreen(screen, result.Path); //this.BackgroundImageLayout = Settings.Instance.Layout; //if (!Settings.Instance.ShowDescription) // pnlDescription.Visible = false; //this.BackgroundImage = Image.FromFile(result.Path); ////CollectionListItem cat = WallpaperAbyssApiV2.WallpaperAbyss.GetCategoryList().Find(x => x.Id == result.Wallpaper.id); //label3.Text = result.Wallpaper.name + Environment.NewLine + "ID: " + result.Wallpaper.id; //if (result.Wallpaper.sub_category != null && result.Wallpaper.sub_category.Trim().Length > 0) // label3.Text += Environment.NewLine + "Category: " + result.Wallpaper.category; //if (result.Wallpaper.sub_category != null && result.Wallpaper.sub_category.Trim().Length > 0) // label3.Text += " Sub: " + result.Wallpaper.sub_category; }
/// <summary> /// Add an image to the slideshow. /// If the playlist pointer isn't at the end the image will be added but the picture displayed will be the next one in /// the slideshow after the current image displayed and not the one being added. /// </summary> /// <param name="result">The image to add</param> private void SetImage(CachedSearchResults result) { Playlist.Add(result); PlaylistIndex++; SetImage(); }