예제 #1
0
 /// <summary>
 /// Remove any cached image identified by an ImageList and an index.
 /// </summary>
 /// <param name="imglist">an <b>ImageList</b></param>
 /// <param name="idx">the non-negative index of a particular image;
 /// but if this value is negative, this clears all cached images associated
 /// with the <paramref name="imglist" /></param>
 /// <remarks>
 /// Calling this method does not modify any existing <see cref="T:Northwoods.Go.GoImage" />,
 /// so no Images will be "lost".  However, future calls to <see cref="M:Northwoods.Go.GoImage.LoadImage" />
 /// will have to re-load from the given ImageList an image at the given index.
 /// </remarks>
 /// <seealso cref="M:Northwoods.Go.GoImage.UnloadImage" />
 public static void ClearCachedImage(ImageList imglist, int idx)
 {
     if (imglist != null)
     {
         lock (myImages)
         {
             if (idx >= 0)
             {
                 myInfo.Source  = imglist;
                 myInfo.Index   = idx;
                 myInfo.Name    = null;
                 myInfo.Culture = CultureInfo.InvariantCulture;
                 myImages.Remove(myInfo);
             }
             else
             {
                 List <GoImageInfo> list = new List <GoImageInfo>();
                 foreach (KeyValuePair <GoImageInfo, WeakReference> myImage2 in myImages)
                 {
                     GoImageInfo key = myImage2.Key;
                     if (key.Source == imglist)
                     {
                         list.Add(key);
                     }
                 }
                 foreach (GoImageInfo item in list)
                 {
                     myImages.Remove(item);
                 }
             }
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Remove any cached image identified by a ResourceManager and a name in a particular culture.
 /// </summary>
 /// <param name="resmgr">a <b>ResourceManager</b></param>
 /// <param name="name">the name of a particular image object;
 /// if this value is null, this clears all cached images associated
 /// with the <paramref name="resmgr" /></param>
 /// <param name="cinfo">a <b>CultureInfo</b></param>
 /// <remarks>
 /// Calling this method does not modify any existing <see cref="T:Northwoods.Go.GoImage" />,
 /// so no Images will be "lost".  However, future calls to <see cref="M:Northwoods.Go.GoImage.LoadImage" />
 /// will have to re-load any image with the given name from the given ResourceManager.
 /// </remarks>
 /// <seealso cref="M:Northwoods.Go.GoImage.UnloadImage" />
 public static void ClearCachedImage(ResourceManager resmgr, string name, CultureInfo cinfo)
 {
     if (resmgr != null)
     {
         lock (myImages)
         {
             if (name != null)
             {
                 myInfo.Source  = resmgr;
                 myInfo.Index   = 0;
                 myInfo.Name    = name;
                 myInfo.Culture = cinfo;
                 myImages.Remove(myInfo);
             }
             else
             {
                 List <GoImageInfo> list = new List <GoImageInfo>();
                 foreach (KeyValuePair <GoImageInfo, WeakReference> myImage2 in myImages)
                 {
                     GoImageInfo key = myImage2.Key;
                     if (key.Source == resmgr)
                     {
                         list.Add(key);
                     }
                 }
                 foreach (GoImageInfo item in list)
                 {
                     myImages.Remove(item);
                 }
             }
         }
     }
 }
예제 #3
0
 public GoImageInfo(GoImageInfo other)
 {
     Source  = other.Source;
     Index   = other.Index;
     Name    = other.Name;
     Culture = other.Culture;
 }
예제 #4
0
            public override bool Equals(object obj)
            {
                GoImageInfo goImageInfo = obj as GoImageInfo;

                if (goImageInfo == null)
                {
                    return(false);
                }
                if (Source == goImageInfo.Source && Index == goImageInfo.Index && Name == goImageInfo.Name)
                {
                    return(Culture == goImageInfo.Culture);
                }
                return(false);
            }