本文整理汇总了C#中MgaProject.get_ObjectByPath方法的典型用法代码示例。如果您正苦于以下问题:C# MgaProject.get_ObjectByPath方法的具体用法?C# MgaProject.get_ObjectByPath怎么用?C# MgaProject.get_ObjectByPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MgaProject
的用法示例。
在下文中一共展示了MgaProject.get_ObjectByPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DesignSpaceWithRefs
//[Fact]
public void DesignSpaceWithRefs()
{
var fullTestPath = Path.Combine(_exportModelDirectory, "DesignSpaceWithRefs");
var xmeFilePath = Path.Combine(fullTestPath, "DesignSpaceWithRefs.xme");
var pathExportedDesign = Path.Combine(fullTestPath, "DesignSpace.adm");
// delete design file if it already exists
if (File.Exists(pathExportedDesign))
{
File.Delete(pathExportedDesign);
}
String connectionString;
GME.MGA.MgaUtils.ImportXMEForTest(xmeFilePath, out connectionString);
var proj = new MgaProject();
bool ro_mode;
proj.Open(connectionString, out ro_mode);
proj.EnableAutoAddOns(true);
try
{
var designExporter = new CyPhyDesignExporter.CyPhyDesignExporterInterpreter();
designExporter.Initialize(proj);
var mgaGateway = new MgaGateway(proj);
MgaFCO currentFCO = null;
mgaGateway.PerformInTransaction(delegate
{
currentFCO = proj.get_ObjectByPath("/@DesignSpaces|kind=DesignSpace|relpos=0/@DesignSpace|kind=DesignContainer|relpos=0") as MgaFCO;
Assert.NotNull(currentFCO);
});
var parameters = new CyPhyGUIs.InterpreterMainParameters()
{
CurrentFCO = currentFCO,
Project = proj,
OutputDirectory = fullTestPath
};
var result = designExporter.Main(parameters);
var design = avm.Design.LoadFromFile(pathExportedDesign);
/// Add assert statements to check structure
var root = design.RootContainer;
Assert.NotNull(root);
Assert.Equal(1, root.Container1.Count(c => c.Name == "AltContainer"));
var AltContainer = root.Container1.First(c => c.Name == "AltContainer");
Assert.Equal(1, AltContainer.ComponentInstance.Count(ci => ci.Name == "CompA_5"));
Assert.Equal(1, AltContainer.ComponentInstance.Count(ci => ci.Name == "CompA_6"));
Assert.Equal(1, AltContainer.ComponentInstance.Count(ci => ci.Name == "CompA_7"));
Assert.Equal(1, root.Container1.Count(c => c.Name == "DesignContainer"));
var DesignContainer = root.Container1.First(c => c.Name == "DesignContainer");
Assert.Equal(1, DesignContainer.ComponentInstance.Count(ci => ci.Name == "CompA3"));
Assert.Equal(1, DesignContainer.Container1.Count(c => c.Name == "Assembly1"));
var Assembly1 = DesignContainer.Container1.First(c => c.Name == "Assembly1");
Assert.Equal(1, Assembly1.ComponentInstance.Count(ci => ci.Name == "CompA1"));
Assert.Equal(1, Assembly1.ComponentInstance.Count(ci => ci.Name == "CompA2"));
Assert.Equal(1, root.Container1.Count(c => c.Name == "ReusableContainer"));
var ReusableContainer = root.Container1.First(c => c.Name == "ReusableContainer");
Assert.Equal(1, ReusableContainer.Container1.Count(c => c.Name == "Assembly4"));
var Assembly4 = ReusableContainer.Container1.First(c => c.Name == "Assembly4");
Assert.Equal(1, Assembly4.ComponentInstance.Count(ci => ci.Name == "CompA1"));
Assert.Equal(1, Assembly4.ComponentInstance.Count(ci => ci.Name == "CompA2"));
Assert.Equal(1, ReusableContainer.ComponentInstance.Count(ci => ci.Name == "CompA4"));
Assert.Equal(1, root.ComponentInstance.Count(ci => ci.Name == "CompA"));
Assert.Equal(1, root.ComponentInstance.Count(ci => ci.Name == "CompA"));
}
finally
{
proj.Close();
}
}