Ejemplo n.º 1
0
            public override int GetHashCode()
            {
                int hash = 0;

                hash += this.type.GetHashCode();
                hash += this.content == null ? 0 : this.content.GetHashCode();
                hash += ImageSourceHelper.ImageSourceToString(this.glyph).GetHashCode();
                hash += ImageSourceHelper.ImageSourceToString(this.largeGlyph).GetHashCode();
                return(hash);
            }
Ejemplo n.º 2
0
            public string BarItemToString(BarItem barItem)
            {
                string type           = ReflectionHelper.ObjectToString(barItem.GetType());
                string content        = ReflectionHelper.ObjectToString(barItem.Content);
                string glyph          = ImageSourceHelper.ImageSourceToString(barItem.Glyph);
                string largeGlyph     = ImageSourceHelper.ImageSourceToString(barItem.LargeGlyph);
                string hint           = ReflectionHelper.ObjectToString(barItem.Hint);
                string glyphAlignment = ReflectionHelper.ObjectToString(barItem.GlyphAlignment);
                string action         = ReflectionHelper.ObjectToString(RibbonManager.GetAction(barItem));

                return(ReflectionHelper.CombineStrings(type, content, glyph, largeGlyph, hint, glyphAlignment, action));
            }
Ejemplo n.º 3
0
 static bool AreEqual(DefaultAction action1, DefaultAction action2)
 {
     if (action1.type != action2.type)
     {
         return(false);
     }
     if (!object.Equals(action1.content, action2.content))
     {
         return(false);
     }
     if (ImageSourceHelper.ImageSourceToString(action1.glyph) != ImageSourceHelper.ImageSourceToString(action2.glyph))
     {
         return(false);
     }
     if (ImageSourceHelper.ImageSourceToString(action1.largeGlyph) != ImageSourceHelper.ImageSourceToString(action2.largeGlyph))
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 4
0
            public BarItem BarItemFromString(string s)
            {
                string[] parts = ReflectionHelper.SplitString(s);
                if (parts.Length != 7)
                {
                    return(null);
                }
                Type type = (Type)ReflectionHelper.ObjectFromString(parts[0]);

                if (type == null)
                {
                    return(null);
                }
                BarItem barItem = (BarItem)Activator.CreateInstance(type);

                barItem.Content        = ReflectionHelper.ObjectFromString(parts[1]);
                barItem.Glyph          = ImageSourceHelper.ImageSourceFromString(parts[2]);
                barItem.LargeGlyph     = ImageSourceHelper.ImageSourceFromString(parts[3]);
                barItem.Hint           = ReflectionHelper.ObjectFromString(parts[4]);
                barItem.GlyphAlignment = (Dock)ReflectionHelper.ObjectFromString(parts[5]);
                RibbonManager.SetAction(barItem, ReflectionHelper.ObjectFromString(parts[6]));
                return(barItem);
            }