当前位置: 首页>>代码示例>>C#>>正文


C# IElement.GetType方法代码示例

本文整理汇总了C#中IElement.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# IElement.GetType方法的具体用法?C# IElement.GetType怎么用?C# IElement.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IElement的用法示例。


在下文中一共展示了IElement.GetType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddElement

     /**
     * Adds content to this object.
     * @param element
     * @throws BadElementException
     */
     public void AddElement(IElement element) {
         if (cellgroup) {
             if (element is SimpleCell) {
                 if (((SimpleCell)element).Cellgroup) {
                     throw new BadElementException("You can't add one row to another row.");
                 }
                 content.Add(element);
                 return;
             }
             else {
                 throw new BadElementException("You can only add cells to rows, no objects of type " + element.GetType().ToString());
             }
         }
         if (element.Type == Element.PARAGRAPH
                 || element.Type == Element.PHRASE
                 || element.Type == Element.ANCHOR
                 || element.Type == Element.CHUNK
                 || element.Type == Element.LIST
                 || element.Type == Element.MARKED
                 || element.Type == Element.JPEG
 				|| element.Type == Element.JPEG2000
                 || element.Type == Element.JBIG2
                 || element.Type == Element.IMGRAW
                 || element.Type == Element.IMGTEMPLATE) {
             content.Add(element);
         }
         else {
             throw new BadElementException("You can't add an element of type " + element.GetType().ToString() + " to a SimpleCell.");
         }
     }
开发者ID:nicecai,项目名称:iTextSharp-4.1.6,代码行数:35,代码来源:SimpleCell.cs

示例2: ReflectiveVisit

        public void ReflectiveVisit(IElement element)
        {
            var types = new Type[] { element.GetType() };
            var mi = this.GetType().GetMethod("Visit", types);

            if (mi != null)
            {
                mi.Invoke(this, new object[] { element });
            }
        }
开发者ID:onurak,项目名称:GOFDesignPatterns,代码行数:10,代码来源:Visitor.cs

示例3: BindTemplate

        public IWebControlTemplate BindTemplate(IElement element, RenderContext renderContext)
        {
            Type type = element.GetType();

            var types = this.GetType().Assembly.GetTypes().Where(t => typeof(IWebControlTemplate).IsAssignableFrom(t));

            Type template = types.Where(t => t.GetInterfaces().Any(i => i.IsGenericType && i.GenericTypeArguments.All(a => a.Equals(type)))).Single(t => typeof(IWebControlTemplate).IsAssignableFrom(t));

            var templateInstance = (IWebControlTemplate)Activator.CreateInstance(template, element, renderContext);

            var collectionTemplate = templateInstance as IWebControlCollectionTemplate;
            
            if (collectionTemplate != null)
            {
                var elementContainer = element as IElementContainer;
                foreach(IElement childElement in elementContainer.Elements)
                {
                    collectionTemplate.ChildTemplates.Add(BindTemplate(childElement, renderContext));
                }
            }

            return templateInstance;
        }
开发者ID:OpenBusinessFramework,项目名称:OpenB.Web,代码行数:23,代码来源:BootstrapControlTemplateBinder.cs

示例4: GetTypeId

 /// <summary>
 /// Returns the Guid element type id corresponding to <paramref name="elementType"/>.  If
 /// elementType is not an element type, then Guid.Empty is returned.
 /// </summary>
 /// <param name="elementType">An element Type.</param>
 /// <returns>The unique Guid id corresponding to a type of element, or Guid.Empty.</returns>
 public static Guid GetTypeId(IElement element)
 {
     var elementType = element.GetType();
     return GetTypeId(elementType);
 }
开发者ID:BgRva,项目名称:Blob1,代码行数:11,代码来源:ElementTypeId.cs

示例5: AddElement

 /**
 * Add an element to be rendered in a column.
 * Note that you can only add a <CODE>Phrase</CODE>
 * or a <CODE>Chunk</CODE> if the columns are
 * not all simple.  This is an underlying restriction in
 * {@link com.lowagie.text.pdf.ColumnText}
 *
 * @param element element to add
 * @throws DocumentException if element can't be added
 */
 public void AddElement(IElement element)
 {
     if (simple) {
         columnText.AddElement(element);
     } else if (element is Phrase) {
         columnText.AddText((Phrase) element);
     } else if (element is Chunk) {
         columnText.AddText((Chunk) element);
     } else {
         throw new DocumentException(MessageLocalization.GetComposedMessage("can.t.add.1.to.multicolumntext.with.complex.columns", element.GetType().ToString()));
     }
 }
开发者ID:boecko,项目名称:iTextSharp,代码行数:22,代码来源:MultiColumnText.cs

示例6: setStatusDisplay

        /// <summary>
        /// Met en place l'affichage pour un élément
        /// </summary>
        /// <param name="_item"></param>
        /// <param name="_element"></param>
        private void setStatusDisplay(ListViewItem _item, IElement _element)
        {
            Font _itemFont = _item.Font;
            // On fait un traitement sépcifique selon le type
            if (_element.GetType().Name.Equals("Person"))
            {
                Person _myPerson = (Person)_element;
                if (_myPerson.TypePerson.Equals(Constantes.cstProf)) { _item.Font = new Font(_itemFont, _itemFont.Style | FontStyle.Italic); }
                _itemFont = _item.Font;
                if (!_myPerson.Absent.Equals(Constantes.cstNon)) { _item.Font = new Font(_itemFont, _itemFont.Style | FontStyle.Strikeout); }
                else { _item.Font = new Font(_itemFont, _itemFont.Style & ~FontStyle.Strikeout); }
            }
            Color _colorItem;
            string _free = String.Empty;
            string _nbEx = String.Empty;
            if (!_element.PoseB && (_element.InfosPDV.NbExemplaires > 0)) { _nbEx = _element.InfosPDV.NbExemplaires.ToString(); }

            if (_element.InfosPDV.IsGratis) { _free = Constantes.cstOui; }

            if (_element.Passed)
            {
                _item.SubItems[0].Text = "OK";
                _item.UseItemStyleForSubItems = false;
                _colorItem = SystemColors.GrayText;
                _item.SubItems[4].BackColor = Color.Red;
                _item.SubItems[4].Text = "-";
                _item.SubItems[5].Text = _free;
                _item.SubItems[6].Text = _nbEx;
            }
            else {
                _item.SubItems[0].Text = String.Empty;
                _item.UseItemStyleForSubItems = false;
                _colorItem = SystemColors.WindowText;
                _item.SubItems[4].BackColor = Color.Transparent;
                _item.SubItems[4].Text = String.Empty;
                _item.SubItems[5].Text = _free;
                _item.SubItems[6].Text = _nbEx;
            }

            if (_element.InfosPDV.Ignore) { _item.Font = new Font(_itemFont, _itemFont.Style | FontStyle.Strikeout); }
            for (int i = 0; i <= 3; i++)
            {
                _item.SubItems[i].ForeColor = _colorItem;
                _item.SubItems[i].Font = _item.Font;
            }
        }
开发者ID:StephOfPixVert,项目名称:ShootingLab,代码行数:51,代码来源:frmPdVMain.cs

示例7: AddElement

 /**
 * Add an element to be rendered in a column.
 * Note that you can only add a <CODE>Phrase</CODE>
 * or a <CODE>Chunk</CODE> if the columns are
 * not all simple.  This is an underlying restriction in
 * {@link com.lowagie.text.pdf.ColumnText}
 *
 * @param element element to add
 * @throws DocumentException if element can't be added
 */
 public void AddElement(IElement element)
 {
     if (simple) {
         columnText.AddElement(element);
     } else if (element is Phrase) {
         columnText.AddText((Phrase) element);
     } else if (element is Chunk) {
         columnText.AddText((Chunk) element);
     } else {
         throw new DocumentException("Can't add " + element.GetType().ToString() + " to MultiColumnText with complex columns");
     }
 }
开发者ID:hjgode,项目名称:iTextSharpCF,代码行数:22,代码来源:MultiColumnText.cs

示例8: ApplyProperties

        /// <summary>
        /// Applies the provided values to the properties of the provided element.
        /// </summary>
        /// <param name="element"></param>
        /// <param name="propertyValues"></param>
        private void ApplyProperties(IElement element, NameValueCollection propertyValues)
        {
            using (LogGroup logGroup = LogGroup.StartDebug("Applying property values to dynamically loaded element."))
            {
                if (element == null)
                    throw new ArgumentNullException("element");

                if (propertyValues == null)
                    throw new ArgumentNullException("propertyValues");

                ApplyDataSourceProperty(element);

                foreach (string propertyName in propertyValues.Keys)
                {
                    using (LogGroup logGroup2 = LogGroup.StartDebug("Applying property '" + propertyName + "'."))
                    {
                        LogWriter.Debug("Value: " + propertyValues[propertyName]);

                        Type elementType = element.GetType();

                        LogWriter.Debug("Element type: " + elementType.ToString());

                        PropertyInfo propertyInfo = elementType.GetProperty(propertyName);

                        if (propertyInfo == null)
                        {
                            LogWriter.Error("Property not found.");

                            throw new ArgumentException("Can't find property '" + propertyName + "' on type '" + elementType + "'.");
                        }

                        if (propertyInfo.CanWrite)
                            propertyInfo.SetValue(Target, ConvertValue(propertyValues[propertyName], propertyInfo.PropertyType), null);
                    }
                }
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:42,代码来源:ElementControl.cs

示例9: ApplyDataSourceProperty

        private void ApplyDataSourceProperty(IElement element)
        {
            if (DataSource != null)
            {
                PropertyInfo property = element.GetType().GetProperty("DataSource");

                if (property != null)
                {
                    property.SetValue(element, DataSource, null);
                }
            }
        }
开发者ID:jeremysimmons,项目名称:sitestarter,代码行数:12,代码来源:ElementControl.cs


注:本文中的IElement.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。