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


C# IModelElement类代码示例

本文整理汇总了C#中IModelElement的典型用法代码示例。如果您正苦于以下问题:C# IModelElement类的具体用法?C# IModelElement怎么用?C# IModelElement使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: Serialize

 public static void Serialize(this IModelSerializer serializer, IModelElement element, string path, Uri uri)
 {
     using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write))
     {
         serializer.Serialize(element, fs, uri);
     }
 }
开发者ID:FrederikP,项目名称:NMF,代码行数:7,代码来源:ModelExtensions.cs

示例2: ElementCreation

        public ElementCreation(IModelElement createdElement)
        {
            if (createdElement == null)
                throw new ArgumentNullException(nameof(createdElement));

            Element = createdElement;
        }
开发者ID:NMFCode,项目名称:NMF,代码行数:7,代码来源:ElementCreation.cs

示例3: HandleValueChange

        /// <summary>
        ///     Allows to refresh the view, when the value of a model changed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns>True if the view should be refreshed</returns>
        public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = base.HandleValueChange(modelElement, changeKind);

            shortcutTreeView.RefreshModel(modelElement);

            return retVal;
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:14,代码来源:Window.cs

示例4: ModelPropertyChange

        public ModelPropertyChange(IModelElement element, string reference, object value)
        {
            if (element == null) throw new ArgumentNullException("element");
            if (reference == null) throw new ArgumentNullException("reference");

            Element = element;
            Reference = reference;
            NewValue = value;
        }
开发者ID:FrederikP,项目名称:NMF,代码行数:9,代码来源:ModelPropertyChange.cs

示例5: HandleValueChange

        /// <summary>
        ///     Allows to refresh the view, when the value of a model changed
        /// </summary>
        /// <param name="modelElement"></param>
        /// <param name="changeKind"></param>
        /// <returns>True if the view should be refreshed</returns>
        public override bool HandleValueChange(IModelElement modelElement, Context.ChangeKind changeKind)
        {
            bool retVal = base.HandleValueChange(modelElement, changeKind);

            if (retVal)
            {
                propertyGrid.Refresh();
            }

            return retVal;
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:17,代码来源:Window.cs

示例6: Serialize

 public static void Serialize(this IModelSerializer serializer, IModelElement element, string path)
 {
     Uri uri;
     Model model = element.Model;
     if (model == null || model.ModelUri == null)
     {
         if (!Uri.TryCreate(path, UriKind.Absolute, out uri))
         {
             uri = new Uri(Path.GetFullPath(path));
         }
     }
     else
     {
         uri = model.ModelUri;
     }
     serializer.Serialize(element, path, uri);
 }
开发者ID:NMFCode,项目名称:NMF,代码行数:17,代码来源:ModelExtensions.cs

示例7: GetRelativePathForNonIdentifiedChild

 protected override string GetRelativePathForNonIdentifiedChild(IModelElement child)
 {
     if (RootElements.Count == 1)
     {
         return string.Empty;
     }
     else
     {
         var index = RootElements.IndexOf(child);
         if (index != -1)
         {
             return ModelHelper.CreatePath("#", index);
         }
         else
         {
             return null;
         }
     }
 }
开发者ID:FrederikP,项目名称:NMF,代码行数:19,代码来源:Model.cs

示例8: CompareTo

        public int CompareTo(IModelElement other)
        {
            int retVal = -1;

            if (other != null)
            {
                retVal = Name.CompareTo(other.Name);
            }

            return retVal;
        }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:11,代码来源:Field.cs

示例9: AddModelElement

 public void AddModelElement(IModelElement element)
 {
     // Nothing to do
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:4,代码来源:Field.cs

示例10: AddModelElement

        /// <summary>
        ///     Adds a model element in this model element
        /// </summary>
        /// <param name="copy"></param>
        public override void AddModelElement(IModelElement element)
        {
            {
                Step item = element as Step;
                if (item != null)
                {
                    appendSteps(item);
                }
            }

            base.AddModelElement(element);
        }
开发者ID:nikiforovandrey,项目名称:ERTMSFormalSpecs,代码行数:16,代码来源:TestCase.cs

示例11: EnsureModelIsKnown

 private void EnsureModelIsKnown(IModelElement element)
 {
     var model = element.Model;
     Model existingModel;
     if (models.TryGetValue(model.ModelUri, out existingModel))
     {
         if (model != existingModel)
         {
             throw new InvalidOperationException(string.Format("This repository already contains a different model with the Uri {0}", model.ModelUri));
         }
     }
     else
     {
         models.Add(model.ModelUri, model);
     }
 }
开发者ID:NMFCode,项目名称:NMF,代码行数:16,代码来源:ModelRepository.cs

示例12: Save

 /// <summary>
 /// Saves the given model element to the specified stream
 /// </summary>
 /// <param name="element">The model element</param>
 /// <param name="stream">The stream to save the model element to</param>
 /// <param name="uri">The uri under which the model element shall be retrievable</param>
 public void Save(IModelElement element, Stream stream, Uri uri)
 {
     Serializer.Serialize(element, stream, uri);
     EnsureModelIsKnown(element);
 }
开发者ID:NMFCode,项目名称:NMF,代码行数:11,代码来源:ModelRepository.cs

示例13: GetValues

        public StandardValuesCollection GetValues(IModelElement element)
        {
            FinderRepository.INSTANCE.ClearCache();

            Dictionary dictionary = EnclosingFinder<Dictionary>.find(element);
            NameSpace nameSpace = EnclosingNameSpaceFinder.find(element);

            List<string> retVal = new List<string>();
            if (nameSpace != null)
            {
                OverallTypeFinder.INSTANCE.findAllValueNames("", nameSpace, true, retVal);
            }
            else
            {
                OverallTypeFinder.INSTANCE.findAllValueNames("", dictionary, false, retVal);
            }
            retVal.Sort();

            foreach (string name in dictionary.EFSSystem.PredefinedTypes.Keys)
            {
                retVal.Add(name);
            }

            return new StandardValuesCollection(retVal);
        }
开发者ID:JamesOakey,项目名称:ERTMSFormalSpecs,代码行数:25,代码来源:TypeConverters.cs

示例14: ShouldTrackSelectionChange

 /// <summary>
 ///     Indicates that the model element should be displayed
 /// </summary>
 /// <param name="modelElement"></param>
 /// <returns></returns>
 protected override bool ShouldTrackSelectionChange(IModelElement modelElement)
 {
     // Once created, this view does not change displayed model
     return false;
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:10,代码来源:Window.cs

示例15: ShouldDisplayChange

 /// <summary>
 ///     Indicates that a change event should be displayed
 /// </summary>
 /// <param name="modelElement"></param>
 /// <param name="changeKind"></param>
 /// <returns></returns>
 protected override bool ShouldDisplayChange(IModelElement modelElement, Context.ChangeKind changeKind)
 {
     // There is no smart way to determine whether the change should be taken into account or not
     return true;
 }
开发者ID:GautierBerck,项目名称:ERTMSFormalSpecs,代码行数:11,代码来源:Window.cs


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