SenseNet.Portal.UI.PortletFramework.PortletInventoryItem.GetImageFieldData C# (CSharp) Method

GetImageFieldData() public method

public GetImageFieldData ( ) : SenseNet.ContentRepository.Fields.ImageField.ImageFieldData
return SenseNet.ContentRepository.Fields.ImageField.ImageFieldData
        public SenseNet.ContentRepository.Fields.ImageField.ImageFieldData GetImageFieldData()
        {
            if (this.ImageStream == null)
                return null;

            var binaryData = new BinaryData();
            binaryData.SetStream(this.ImageStream);
            return new SenseNet.ContentRepository.Fields.ImageField.ImageFieldData(null, binaryData);
        }
        public static PortletInventoryItem Create(PortletBase portlet, Assembly assembly)

Usage Example

Ejemplo n.º 1
0
        public static void ImportPortlet(PortletInventoryItem portlet, IEnumerable <Node> repoPortlets)
        {
            var nameText    = SenseNetResourceManager.Current.GetString(portlet.Portlet.Name);
            var portletName = GetValidName(nameText, false);

            // check if already exists
            if (repoPortlets.Any(c => c.Name == portletName))
            {
                return;
            }

            // create portlet node
            var categoryNode = Node.LoadNode(RepositoryPath.Combine(PortletsFolderPath, GetValidName(portlet.Portlet.Category.Title)));

            if (categoryNode == null)
            {
                return;
            }

            var portletNode = Content.CreateNew("Portlet", categoryNode, portlet.Portlet.GetType().Name);

            portletNode["DisplayName"] = portlet.Portlet.Name;
            portletNode["Description"] = portlet.Portlet.Description;
            portletNode["TypeName"]    = GetPortletTypeName(portlet.Portlet.GetType());
            var imageData = portlet.GetImageFieldData(portletNode.Fields["PortletImage"]);

            if (imageData != null)
            {
                portletNode["PortletImage"] = imageData;
            }
            portletNode.Save();
        }
All Usage Examples Of SenseNet.Portal.UI.PortletFramework.PortletInventoryItem::GetImageFieldData
PortletInventoryItem