コード例 #1
0
ファイル: CImage.cs プロジェクト: AngelOD/jet-banjo
        public CImage(string resourceString, ImageType type) : base()
        {
            Type = type;
            if (!resourceString.StartsWith("JetBanjo.Resources."))
            {
                ResourcesString = "JetBanjo.Resources." + resourceString;
            }
            else
            {
                ResourcesString = resourceString;
            }

            if (!ResourcesString.EndsWith(".png"))
            {
                ResourcesString += ".png";
            }

            //Such that it is posssible to unit test, because the FFImageLoading does not want to be used outside of Shared or platform specific projects
            if (!App.IsTesting)
            {
                image = new CachedImage()
                {
                    Source = ImageSource.FromResource(ResourcesString)
                }
            }
            ;
        }
コード例 #2
0
ファイル: CImage.cs プロジェクト: AngelOD/jet-banjo
        /// <summary>
        /// Used for sorting and follows the image specification
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            if (obj is CImage)
            {
                CImage other = obj as CImage;
                int    res   = Type.CompareTo(other.Type);
                return(res != 0 ? res : ResourcesString.CompareTo(other.ResourcesString));
            }

            return(0);
        }
コード例 #3
0
ファイル: CImage.cs プロジェクト: AngelOD/jet-banjo
 /// <summary>
 /// Method to compare two CImage object to check if the are "the same"
 /// </summary>
 /// <param name="obj">Other object</param>
 /// <returns>True if the objects can be considered "the same"</returns>
 public override bool Equals(object obj)
 {
     if (obj is CImage)
     {
         CImage temp = obj as CImage;
         return(ResourcesString.Equals(temp.ResourcesString) && Type.Equals(temp.Type));
     }
     else
     {
         return(false);
     }
 }
コード例 #4
0
ファイル: CImage.cs プロジェクト: AngelOD/jet-banjo
 public override int GetHashCode()
 {
     return(ResourcesString.GetHashCode());
 }