Esempio n. 1
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));
            }
Esempio n. 2
0
            public BarItem CopyBarItem(BarItem barItem, out ICollection <BarItemLinkBase> barItemLinks)
            {
                BarItem copiedBarItem = (BarItem)Activator.CreateInstance(barItem.GetType());

                copiedBarItem.Name            = "CopiedBarItem" + namesGenerator.Get();
                copiedBarItem.Content         = barItem.Content;
                copiedBarItem.ContentTemplate = barItem.ContentTemplate;
                copiedBarItem.Glyph           = barItem.Glyph;
                copiedBarItem.LargeGlyph      = barItem.LargeGlyph;
                copiedBarItem.Hint            = barItem.Hint;
                copiedBarItem.GlyphAlignment  = barItem.GlyphAlignment;
                RibbonManager.SetAction(copiedBarItem, RibbonManager.GetAction(barItem));
                CopyBarItemEditSettings(barItem, copiedBarItem);
                CopyBarItemPopupControl(barItem, copiedBarItem);
                barItemLinks = CopyBarItemItemLinks(barItem, copiedBarItem);
                return(copiedBarItem);
            }
Esempio n. 3
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);
            }
Esempio n. 4
0
 public int GetHashCode(BarItem obj)
 {
     return(RibbonManager.GetActualAction(obj).GetHashCode());
 }
Esempio n. 5
0
 public bool Equals(BarItem x, BarItem y)
 {
     return(object.Equals(RibbonManager.GetActualAction(x), RibbonManager.GetActualAction(y)));
 }