|
using System;
using System.Collections.Generic;
using Microsoft.VisualStudio.Modeling;
using Dawliasoft.Sculpture;
using Dawliasoft.Sculpture.SerializableTypes;
using Dawliasoft.Sculpture.CommonHelpers;
using System.Collections.ObjectModel;
namespace WPFMold.Helpers
{
public static class MoldHelper
{
public const string MoldName = "WPFMold";
public static String GetPropertyValue(ModelElement element, string PropertyName)
{
List<Mold> molds = ((SculptureModel)element.Store.ElementDirectory.FindElements<SculptureModel>()[0]).Molds;
return ModelElementHelper.GetModelElementPropertyValue(molds, element, MoldHelper.MoldName, PropertyName);
}
public static void SetPropertyValue(ModelElement element, string PropertyName, String value)
{
List<Mold> molds = ((SculptureModel)element.Store.ElementDirectory.FindElements<SculptureModel>()[0]).Molds;
using (Transaction transaction = element.Store.TransactionManager.BeginTransaction())
{
ModelElementHelper.SetModelElementPropertyValue(molds, element, MoldHelper.MoldName, PropertyName, value);
transaction.Commit();
}
}
public static ReadOnlyCollection<T> Enumerate<T>(ModelElement element) where T : ModelElement
{
return element.Store.ElementDirectory.FindElements<T>();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Program Manager in Sculpture project, Interesting in .NET Model driven development.