Ejemplo n.º 1
0
 /// <summary>
 /// Creates a Gallery
 /// </summary>
 /// <param name="root">The Ribbon that this Gallery was created by and is a part of.</param>
 /// <param name="id">The Component id of this Gallery.</param>
 /// <param name="title">The Title of this Gallery.</param>
 /// <param name="description">The Description of this Gallery</param>
 /// <param name="properties">The properties of this Gallery</param>
 public Gallery(Root root, string id, string title, string description, GalleryProperties properties)
     : base(root, id, title, description)
 {
     Properties        = properties;
     Width             = Int32.Parse(Properties.Width);
     ElementDimensions = Gallery.ConvertStringToGalleryElementDimensions(Properties.ElementDimensions);
 }
Ejemplo n.º 2
0
        private Gallery BuildGallery(object data, BuildContext bc, bool isInMenu)
        {
            JSObject          attrs      = DataNodeWrapper.GetNodeAttributes(data);
            GalleryProperties properties = DataNodeWrapper.GetNodeAttributes(data).To <GalleryProperties>();
            Gallery           gallery    = Root.CreateGallery(properties.Id,
                                                              DataNodeWrapper.GetAttribute(attrs, DataNodeWrapper.TITLE),
                                                              DataNodeWrapper.GetAttribute(attrs, DataNodeWrapper.DESCRIPTION),
                                                              properties);

            string displayMode = isInMenu ? "Menu" : "Default";

            JSObject[] children = DataNodeWrapper.GetNodeChildren(data);
            int        l        = children.Length;

            for (int i = 0; i < l; i++)
            {
                JSObject child = children[i];
                if (IsNodeTrimmed(child))
                {
                    continue;
                }

                // NOTE: currently, galleries can only host GalleryButton controls.
                // In the future, the gallery could support other control types, so those should be added here.
                Control control;
                switch (DataNodeWrapper.GetNodeName(child))
                {
                case DataNodeWrapper.GalleryButton:
                    control = BuildGalleryButton(child, bc, properties.ElementDimensions);
                    break;

                default:
                    control = BuildControl(child, bc);
                    break;
                }
                gallery.AddChild(control.CreateComponentForDisplayMode(displayMode));
            }

            return(gallery);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a Gallery
        /// </summary>
        /// <param name="id">Component id of the Gallery</param>
        /// <param name="title">Title of the Gallery</param>
        /// <param name="description">Description of the Gallery</param>
        /// <param name="properties">A GalleryProperties object with the properties of the Gallery</param>
        /// <returns>the created Gallery</returns>

        internal Gallery CreateGallery(string id, string title, string description, GalleryProperties properties)
        {
            return new Gallery(this, id, title, description, properties);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a Gallery
 /// </summary>
 /// <param name="root">The Ribbon that this Gallery was created by and is a part of.</param>
 /// <param name="id">The Component id of this Gallery.</param>
 /// <param name="title">The Title of this Gallery.</param>
 /// <param name="description">The Description of this Gallery</param>
 /// <param name="properties">The properties of this Gallery</param>
 public Gallery(Root root, string id, string title, string description, GalleryProperties properties)
     : base(root, id, title, description)
 {
     Properties = properties;
     Width = Int32.Parse(Properties.Width);
     ElementDimensions = Gallery.ConvertStringToGalleryElementDimensions(Properties.ElementDimensions);
 }