本文整理汇总了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);
}
}
示例2: ElementCreation
public ElementCreation(IModelElement createdElement)
{
if (createdElement == null)
throw new ArgumentNullException(nameof(createdElement));
Element = createdElement;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
}
}
示例8: CompareTo
public int CompareTo(IModelElement other)
{
int retVal = -1;
if (other != null)
{
retVal = Name.CompareTo(other.Name);
}
return retVal;
}
示例9: AddModelElement
public void AddModelElement(IModelElement element)
{
// Nothing to do
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}