private void OnMaidThumbnailChanged(object sender, ThumbnailEventArgs args)
        {
            if (!IsMaidLoaded(args.Maid))
            {
                return;
            }

            Image img;

            using (MemoryStream stream = new MemoryStream(args.Maid.GetThumIcon().EncodeToPNG()))
            {
                img = Image.FromStream(stream);
            }

            if (!maidThumbnails.ContainsKey(args.Maid.Param.status.guid))
            {
                maidThumbnails.Add(args.Maid.Param.status.guid, img);
            }
            else
            {
                maidThumbnails[args.Maid.Param.status.guid].Dispose();
                maidThumbnails.Remove(args.Maid.Param.status.guid);
                maidThumbnails.Add(args.Maid.Param.status.guid, img);
            }

            listBox1.Invalidate();
        }
Exemple #2
0
 /// <summary>
 /// Notify from thumbnailthread. Next Thumbnail is ready
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void thumbnailtread_NewFrame(object sender, ThumbnailEventArgs e)
 {
     if (tvaFiles.InvokeRequired)
     {
         tvaFiles.Invoke(new MethodInvoker(
                             delegate()
         {
             SetThumbnail(e);
         }));
     }
     else
     {
         SetThumbnail(e);
     }
 }
Exemple #3
0
        /// <summary>
        /// Set the Thumbnail in Treeview
        /// </summary>
        /// <param name="tnea"></param>
        private void SetThumbnail(ThumbnailEventArgs tnea)
        {
            if (tnea.Count >= tnea.TotalCount)
            {
                tspbThumbnailsLoad.Value = 0;
                tsslMessage.Text         = "Thumbnail download done.";
            }
            //Get Node from dir and filename
            Node n = GetNode(tnea.Filename);

            if (n != null)
            {
                tspbThumbnailsLoad.Minimum = 0;
                tspbThumbnailsLoad.Maximum = tnea.TotalCount;
                tspbThumbnailsLoad.Value   = tnea.Count;
                tsslMessage.Text           = string.Format("... loading thumbnail {0} of {1}", tnea.Count, tnea.TotalCount);

                n.Image = ks2.ResizeImage(tnea.Bitmap, 64, 48);
            }
        }