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


C# ComponentType.ToString方法代码示例

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


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

示例1: AddDradisComponentsControl

 public AddDradisComponentsControl(ComponentType componentType)
 {
     InitializeComponent();
     ComponentNameLabel.Text = componentType.ToString();
     _componentType = componentType;
     requestedNumberComboBox.SelectedIndex = 0;
 }
开发者ID:MaxPeck,项目名称:DeckManager,代码行数:7,代码来源:AddDradisComponentsControl.cs

示例2: getService

 private Service getService(ComponentType type)
 {
     switch (type)
     {
         case ComponentType.Animation:
             return _animationService;
         case ComponentType.Collision:
             return _collisionService;
         case ComponentType.GUI:
             return _guiService;
         case ComponentType.Input:
             return _inputService;
         case ComponentType.Movement:
             return _movementService;
         case ComponentType.Physics:
             return _physicsService;
         case ComponentType.Rendering:
             return _renderingService;
         default:
             throw new Exception("ComponentType not recognized by ServiceRegistrar: " + type.ToString());
     }
 }
开发者ID:WorldBeard,项目名称:worldbeardsource,代码行数:22,代码来源:ServiceRegistrar.cs

示例3: SaveComponentElements

        /// <summary>
        /// Sets a new representation of all components of a particular type.
        /// </summary>
        /// <param name="componentType">type of the components</param>
        /// <param name="xNewComponents">XML element containing the
        /// component representations as its children.</param>
        public void SaveComponentElements(ComponentType componentType, XElement xNewComponents)
        {
            string componentElementName = componentType.ToString().ToLower();
            RemoveElements(string.Format("/configuration/components/{0}", componentElementName));

            var xComponents = Content.XDocument.XPathSelectElement("/configuration/components");
            foreach (var xNewComponent in xNewComponents.Elements())
            {
                xComponents.Add(xNewComponent);
            }
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:17,代码来源:ApplicationConfiguration.cs

示例4: SaveComponentElement

        /// <summary>
        /// Sets a new representation of a single component of a particular type.
        /// </summary>
        /// <param name="componentType">type of the component</param>
        /// <param name="xComponent">XML element containing the component
        /// representation</param>
        public void SaveComponentElement(ComponentType componentType, XElement xComponent)
        {
            string componentElementName = componentType.ToString().ToLower();
            string name = xComponent.Attribute(XName.Get("name")).Value;
            var xOldComponent = Content.XDocument.XPathSelectElement(
                string.Format("/configuration/components/{0}[@name='{1}']", componentElementName, name));
            if (xOldComponent != null)
            {
                xOldComponent.Remove();
            }

            var xComponents = Content.XDocument.XPathSelectElement("/configuration/components");
            xComponents.Add(xComponent);
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:20,代码来源:ApplicationConfiguration.cs

示例5: GetComponentElements

 /// <summary>
 /// Gets a representation of all components of a particular type.
 /// </summary>
 /// <param name="componentType">type of the components</param>
 /// <returns>An XML element which has the same name as the type of
 /// the component and contains the component representations as its
 /// children.</returns>
 public XElement GetComponentElements(ComponentType componentType)
 {
     string componentElementName = componentType.ToString().ToLower();
     var xComponents = Content.XDocument.XPathSelectElements(
         string.Format("/configuration/components/{0}", componentElementName));
     XElement xRoot = new XElement(XName.Get(componentElementName));
     // NOTE: sort elements in order to provide consistent result
     // eg. the first component of a type is always selected the same
     // for the same data
     foreach (var xComponenent in xComponents.OrderBy((comp) => comp.Name))
     {
         xRoot.Add(xComponenent);
     }
     return xRoot;
 }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:22,代码来源:ApplicationConfiguration.cs

示例6: AddComponent

        /// <summary>
        /// Add a new component with a specified name and component type.
        /// </summary>
        /// <remarks>
        /// Initializes the configuration of the component with a default value
        /// </remarks>
        /// <param name="componentType">type of the new component</param>
        /// <param name="name">name of the new component</param>
        public void AddComponent(ComponentType componentType, string name)
        {
            XElement xComponent;
            switch (componentType)
            {
                case ComponentType.Gateway:
                    xComponent = XElement.Parse(string.Format(@"
            <gateway name='{0}'>
            <adapters>
            </adapters>
            </gateway>
            ", name));
                    break;
                case ComponentType.Processor:
                    xComponent = XElement.Parse(string.Format(@"
            <processor name='{0}' concurrent-threads='4'>
            </processor>
            ", name));

                    break;
                default:
                    throw new ArgumentException(string.Format(
                        "Cannot add a component named '{0}', unknown component type {1}.",
                        name, componentType.ToString()), "componentType");
            }
            var xComponents = Content.XDocument.XPathSelectElement("/configuration/components");
            xComponents.Add(xComponent);
        }
开发者ID:bzamecnik,项目名称:XRouter,代码行数:36,代码来源:ApplicationConfiguration.cs


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