本文整理汇总了C#中ModelApplicationBase类的典型用法代码示例。如果您正苦于以下问题:C# ModelApplicationBase类的具体用法?C# ModelApplicationBase怎么用?C# ModelApplicationBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ModelApplicationBase类属于命名空间,在下文中一共展示了ModelApplicationBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAllLayers
protected IEnumerable<ModelApplicationBase> GetAllLayers(IEnumerable<ModelDifferenceObject> differenceObjects, ModelApplicationBase master) {
if (GetttingNonAppModels(differenceObjects))
differenceObjects = differenceObjects.Where(o => o.CombineOrder < CombineOrder);
var modelApplicationBases = differenceObjects.Distinct().Select(differenceObject => differenceObject.GetModel(master));
modelApplicationBases = modelApplicationBases.Concat(new List<ModelApplicationBase> { GetModel(master) });
return modelApplicationBases;
}
示例2: ReplaceLayer
protected override void ReplaceLayer(ModelApplicationBase model, ModelApplicationBase layer, bool isCurrentUserModel, ShowViewParameters showViewParameters){
var showViewStrategyBase = (WinShowViewStrategyBase)Application.ShowViewStrategy;
var modelApplicationBase = ((ModelApplicationBase)Application.Model);
var lastLayer = modelApplicationBase.LastLayer;
modelApplicationBase.RemoveLayer(lastLayer.Id);
var dummyLayer = modelApplicationBase.CreatorInstance.CreateModelApplication();
dummyLayer.Id = lastLayer.Id;
ModelApplicationHelper.AddLayer(modelApplicationBase, dummyLayer);
var keyValue = ObjectSpace.GetKeyValue(View.CurrentObject);
var objectType = View.ObjectTypeInfo.Type;
var modelDetailView = View.Model;
showViewStrategyBase.CloseAllWindows();
base.ReplaceLayer(model, layer, isCurrentUserModel,showViewParameters);
showViewStrategyBase.ShowStartupWindow();
var xafApplication = ApplicationHelper.Instance.Application;
var objectSpace = xafApplication.CreateObjectSpace();
var objectByKey = objectSpace.GetObjectByKey(objectType,keyValue);
showViewStrategyBase = (WinShowViewStrategyBase)xafApplication.ShowViewStrategy;
showViewParameters.CreatedView = xafApplication.CreateDetailView(objectSpace, modelDetailView, true, objectByKey);
showViewStrategyBase.ShowView(showViewParameters, new ShowViewSource(null,null));
}
示例3: AddLayers
void AddLayers(ModelApplicationBase modelApplication, ApplicationModulesManager applicationModulesManager, PathInfo pathInfo) {
var resourceModelCollector = new ResourceModelCollector();
var dictionary = resourceModelCollector.Collect(applicationModulesManager.Modules.Select(@base => @base.GetType().Assembly), null);
AddLayersCore(dictionary.Where(pair => !PredicateLastLayer(pair, pathInfo)), modelApplication);
ModelApplicationBase lastLayer = modelApplication.CreatorInstance.CreateModelApplication();
modelApplication.AddLayer(lastLayer);
}
示例4: AddLayerBeforeLast
public static void AddLayerBeforeLast(this ModelApplicationBase application, ModelApplicationBase layer) {
ModelApplicationBase lastLayer = application.LastLayer;
if (lastLayer.Id != "After Setup" && lastLayer.Id != "UserDiff")
throw new ArgumentException("LastLayer.Id", lastLayer.Id);
ModelApplicationHelper.RemoveLayer(application);
ModelApplicationHelper.AddLayer(application, layer);
ModelApplicationHelper.AddLayer(application, lastLayer);
}
示例5: OnDifferenceObjectSaving
protected internal override void OnDifferenceObjectSaving(ModelDifferenceObject userModelDifferenceObject, ModelApplicationBase model) {
var userStoreObject = ((UserModelDifferenceObject)userModelDifferenceObject);
if (!userStoreObject.NonPersistent) {
userModelDifferenceObject.CreateAspectsCore(model);
base.OnDifferenceObjectSaving(userModelDifferenceObject, model);
}
CombineModelFromPermission(model);
}
示例6: RemoveLayers
IEnumerable<ModelApplicationBase> RemoveLayers(ModelApplicationBase modelApplicationBase, IEnumerable<string> strings) {
var modelApplicationBases = new List<ModelApplicationBase>();
while (modelApplicationBase.LastLayer.Id != "Unchanged Master Part") {
if (!(strings.Contains(modelApplicationBase.LastLayer.Id)))
modelApplicationBases.Add(modelApplicationBase.LastLayer);
ModelApplicationHelper.RemoveLayer(modelApplicationBase.LastLayer);
}
return modelApplicationBases;
}
示例7: GetLoadedModelDifferenceObjectInfos
Dictionary<string, ModelDifferenceObjectInfo> GetLoadedModelDifferenceObjectInfos(ModelApplicationBase model) {
Dictionary<string, ModelDifferenceObjectInfo> loadedModelDifferenceObjectInfos = GetLoadedModelApplications(model);
if (!loadedModelDifferenceObjectInfos.Any())
if (ObjectSpace.IsServerSide() || !(Application is ServerApplication))
return CreateNew(model);
else
return loadedModelDifferenceObjectInfos;
return loadedModelDifferenceObjectInfos;
}
示例8: ReadFromModel
public static void ReadFromModel(this ModelXmlReader modelXmlReader, ModelApplicationBase modelNode,
ModelApplicationBase readFrom, Func<string, bool> aspectNamePredicate) {
for (int i = 0; i < readFrom.AspectCount; i++) {
string aspect = readFrom.GetAspect(i);
string xml = new ModelXmlWriter().WriteToString(readFrom, i);
if (!(string.IsNullOrEmpty(xml)))
new ModelXmlReader().ReadFromString(modelNode, aspect, xml);
}
}
示例9: LoadApplicationModels
void LoadApplicationModels(bool loadResources, ModelApplicationBase model) {
var userDiffLayer = model.LastLayer;
ModelApplicationHelper.RemoveLayer(model);
var customModelDifferenceStoreEventArgs = new CreateCustomModelDifferenceStoreEventArgs();
OnCreateCustomModelDifferenceStore(customModelDifferenceStoreEventArgs);
if (!customModelDifferenceStoreEventArgs.Handled)
new XpoModelDictionaryDifferenceStore(Application, GetPath(), customModelDifferenceStoreEventArgs.ExtraDiffStores, loadResources).Load(model);
ModelApplicationHelper.AddLayer((ModelApplicationBase)Application.Model, userDiffLayer);
RuntimeMemberBuilder.CreateRuntimeMembers(Application.Model);
}
示例10: CombineWithActiveDifferenceObjects
void CombineWithActiveDifferenceObjects(ModelApplicationBase model, IEnumerable<ModelDifferenceObject> modelDifferenceObjects) {
var reader = new ModelXmlReader();
foreach (var modelDifferenceObject in modelDifferenceObjects) {
foreach (var aspectObject in modelDifferenceObject.AspectObjects) {
var xml = aspectObject.Xml;
if (!string.IsNullOrEmpty(xml))
reader.ReadFromString(model, modelDifferenceObject.GetAspectName(aspectObject), xml);
}
}
}
示例11: SaveDifference
public override void SaveDifference(ModelApplicationBase model) {
if (model != null) {
_objectSpace = _application.CreateObjectSpace() as ObjectSpace;
ModelDifferenceObject modelDifferenceObject =
GetActiveDifferenceObject(model.Id) ??
GetNewDifferenceObject(_objectSpace)
.InitializeMembers(model.Id == "Application" ? Application.Title : model.Id, Application.Title, Application.GetType().FullName);
OnDifferenceObjectSaving(modelDifferenceObject, model);
}
}
示例12: Load
public override void Load(ModelApplicationBase model) {
base.Load(model);
var modelDifferenceObjects = GetActiveDifferenceObjects().ToList();
if (modelDifferenceObjects.Count() == 0) {
SaveDifference(model);
return;
}
CombineWithActiveDifferenceObjects(model, modelDifferenceObjects);
}
示例13: AddLayers
public void AddLayers(string modelApplicationPrefix, Dictionary<string, ModelDifferenceObjectInfo> loadedModelDifferenceObjectInfos, ModelApplicationBase model) {
var modelXmlReader = new ModelXmlReader();
var assemblies = _xafApplication.Modules.Select(module => module.GetType().Assembly);
var resourceModelCollector = new ResourceModelCollector();
foreach (var keyValuePair in resourceModelCollector.Collect(assemblies, modelApplicationPrefix)) {
var modelDifferenceObjectInfo = GetModelDifferenceObjectInfo(modelApplicationPrefix, loadedModelDifferenceObjectInfos, keyValuePair.Key, model);
foreach (var aspectInfo in keyValuePair.Value.AspectInfos) {
modelXmlReader.ReadFromString(modelDifferenceObjectInfo.Model, aspectInfo.AspectName, aspectInfo.Xml);
}
modelDifferenceObjectInfo.ModelDifferenceObject.CreateAspects(modelDifferenceObjectInfo.Model);
}
}
示例14: AddLayersCore
void AddLayersCore(IEnumerable<KeyValuePair<string, ResourceInfo>> layers, ModelApplicationBase modelApplication) {
IEnumerable<KeyValuePair<string, ResourceInfo>> keyValuePairs = layers;
foreach (var pair in keyValuePairs) {
ModelApplicationBase layer = modelApplication.CreatorInstance.CreateModelApplication();
layer.Id = pair.Key;
modelApplication.AddLayer(layer);
var modelXmlReader = new ModelXmlReader();
foreach (var aspectInfo in pair.Value.AspectInfos) {
modelXmlReader.ReadFromString(layer, aspectInfo.AspectName, aspectInfo.Xml);
}
}
}
示例15: CombineModelFromPermission
void CombineModelFromPermission(ModelApplicationBase model) {
if (SecuritySystem.Instance is ISecurityComplex && IsGranted()) {
var space = Application.CreateObjectSpace();
ModelDifferenceObject difference = GetDifferenceFromPermission((XPObjectSpace)space);
var master = new ModelLoader(difference.PersistentApplication.ExecutableName).GetMasterModel(true);
var diffsModel = difference.GetModel(master);
new ModelXmlReader().ReadFromModel(diffsModel, model);
difference.CreateAspectsCore(diffsModel);
space.SetModified(difference);
space.CommitChanges();
}
}