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


C# MgaProject类代码示例

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


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

示例1: InvokeEx

        public void InvokeEx(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, int param)
        {
            if (!enabled)
            {
                return;
            }

            try
            {
                GMEConsole = GMEConsole.CreateFromProject(project);
                MgaGateway = new MgaGateway(project);
                project.CreateTerritoryWithoutSink(out MgaGateway.territory);

                MgaGateway.PerformInTransaction(delegate
                {
                    Main(project, currentobj, selectedobjs, Convert(param));
                },
                abort: true);
            }
            finally
            {
                if (MgaGateway.territory != null)
                {
                    MgaGateway.territory.Destroy();
                }
                MgaGateway = null;
                project = null;
                currentobj = null;
                selectedobjs = null;
                GMEConsole = null;
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:34,代码来源:DesignConsistencyChecker.cs

示例2: myMigrator

        public myMigrator(MgaProject p)
        {
            project = p;
            GMEConsole = GMEConsole.CreateFromProject(p);
            oldToNewRole = new Dictionary<string, string>()
            {
                { "StructuralInterface" , "Connector" },
                {"AxisGeometry", "Axis"},
                {"SurfaceGeometry", "Surface"},
                {"PointGeometry", "Point"},
                {"CoordinateSystemGeometry", "CoordinateSystem"},
                {"StructuralInterfaceForwarder", "Connector"},
                {"FeatureMap", "PortComposition"},
                {"AnalysisPointMap", "PortComposition"},
                {"AnalysisPoint", "Point"},
                {"JoinStructures", "ConnectorComposition"},
                //{"FeatureMap", "SurfaceReverseMap"}, //special, not general case
                //{"CADModel", ""}, //special, addition not replacement
            };
            oldToNewFCO = new Dictionary<MgaFCO, MgaFCO>();
            oldConnsAndRefs = new List<MgaFCO>();
            oldSubsAndInstances = new List<MgaFCO>();
            migratedModels = new List<MgaModel>();

            foreach (MgaFolder child in project.RootFolder.ChildFolders)
                if (child.MetaFolder.Name == "Components")
                {
                    List<MgaFolder> folders = getAllFolders(child);
                    foreach (MgaFolder folder in folders)
                        foreach (MgaModel model in folder.ChildObjects.OfType<MgaModel>())
                            createNewFCOs(model);
                }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:33,代码来源:myMigrator2.cs

示例3: ImportXME

        public static void ImportXME(string xmePath, string mgaPath, bool enableAutoAddons=false)
        {
            MgaParser parser = new MgaParser();
            string paradigm;
            string paradigmVersion;
            object paradigmGuid;
            string basename;
            string version;
            parser.GetXMLInfo(xmePath, out paradigm, out paradigmVersion, out paradigmGuid, out basename, out version);

            parser = new MgaParser();
            MgaProject project = new MgaProject();
            MgaResolver resolver = new MgaResolver();
            resolver.IsInteractive = false;
            dynamic dynParser = parser;
            dynParser.Resolver = resolver;
            project.Create("MGA=" + Path.GetFullPath(mgaPath), paradigm);
            if (enableAutoAddons)
            {
                project.EnableAutoAddOns(true);
            }
            try
            {
                parser.ParseProject(project, xmePath);
                project.Save();
            }
            finally
            {
                project.Close();
            }
        }
开发者ID:neemask,项目名称:meta-core,代码行数:31,代码来源:MgaUtils.cs

示例4: GetProject

        /* Copied/Adapted from CyPhyCompomponentExporterCL Proj */
        public static MgaProject GetProject(String mgaFilename)
        {
            MgaProject result = null;

            if (mgaFilename != null && mgaFilename != "")
            {
                if (Path.GetExtension(mgaFilename) == ".mga")
                {
                    result = new MgaProject();
                    if (System.IO.File.Exists(mgaFilename))
                    {
                        Console.Out.Write("Opening {0} ... ", mgaFilename);
                        bool ro_mode = true;
                        result.Open("MGA=" + Path.GetFullPath(mgaFilename), out ro_mode);
                        Console.Out.WriteLine("Done.");
                    }
                    else
                    {
                        Console.Error.WriteLine("{0} file must be an existing mga project.", mgaFilename);
                    }
                }
                else
                {
                    Console.Error.WriteLine("{0} file must be an mga project.", mgaFilename);
                }
            }
            else
            {
                Console.Error.WriteLine("Please specify an Mga project.");
            }

            return result;
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:34,代码来源:MgaUtil.cs

示例5: RunElaborator

        public static bool RunElaborator(string projectPath, string absPath)
        {
            bool result = false;
            Assert.True(File.Exists(projectPath), "Project file does not exist.");
            string ProjectConnStr = "MGA=" + Path.GetFullPath(projectPath);

            MgaProject project = new MgaProject();
            project.OpenEx(ProjectConnStr, "CyPhyML", null);
            try
            {
                var terr = project.BeginTransactionInNewTerr();
                var testObj = project.ObjectByPath[absPath] as MgaFCO;
                if (testObj == null)
                {
                    throw new ApplicationException(absPath + " not found in " + project.ProjectConnStr);
                }
                project.AbortTransaction();

                MgaFCOs fcos = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs"));

                var elaborator = new CyPhyElaborateCS.CyPhyElaborateCSInterpreter();
                result = elaborator.RunInTransaction(project, testObj, fcos, 128);
            }
            finally
            {
                project.Close(true);
            }

            return result;
        }
开发者ID:neemask,项目名称:meta-core,代码行数:30,代码来源:ElaboratorRunner.cs

示例6: Initialize

 /// <summary>
 /// This function is called for each interpreter invocation before Main.
 /// Don't perform MGA operations here unless you open a tansaction.
 /// </summary>
 /// <param name="project">The handle of the project opened in GME, for which the interpreter was called.</param>
 public void Initialize(MgaProject project)
 {
     if (Logger == null)
     {
         Logger = new GMELogger(project, this.ComponentName);
     }
 }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:12,代码来源:CyPhy2CADPCB.cs

示例7: Initialize

        public void Initialize(MgaProject project)
        {
            try
            {
                Configuration = MetaLinkConfiguration.Create(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "metalink.config"));
            }
            catch (Exception e)
            {
                GMEConsole.Warning.WriteLine("Unable to read Meta-Link configuration: " + e.Message);
                Configuration = new MetaLinkConfiguration();
            }

            // Creating addon 
            project.CreateAddOn(this, out addon);

            // Setting event mask (see ComponentConfig.eventMask)
            unchecked
            {
                addon.EventMask = (uint)ComponentConfig_Addon.eventMask;
            }
            // DISABLE BY DEFAULT
            Enable(false);

            // Create the proxy windows control which sends-receives messages
            this.SyncControl = new System.Windows.Forms.Control();
            IntPtr handle = SyncControl.Handle; // If the handle has not yet been created, referencing this property will force the handle to be created.
        }
开发者ID:neemask,项目名称:meta-core,代码行数:27,代码来源:CyPhyMetaLinkAddon.cs

示例8: RunFormulaEvaluate

        public static void RunFormulaEvaluate(string projectPath, string absPath, bool automation)
        {
            Assert.True(File.Exists(projectPath), "Project file does not exist.");
            string ProjectConnStr = "MGA=" + Path.GetFullPath(projectPath);

            MgaProject project = new MgaProject();
            project.OpenEx(ProjectConnStr, "CyPhyML", null);
            try
            {
                var terr = project.BeginTransactionInNewTerr();
                var testObj = project.ObjectByPath[absPath] as MgaFCO;
                project.AbortTransaction();
                MgaFCOs fcos = (MgaFCOs)Activator.CreateInstance(Type.GetTypeFromProgID("Mga.MgaFCOs"));

                Type tFormulaEval = Type.GetTypeFromProgID("MGA.Interpreter.CyPhyFormulaEvaluator");
                var formulaEval = Activator.CreateInstance(tFormulaEval) as GME.MGA.IMgaComponentEx;
                formulaEval.ComponentParameter["automation"] = automation ? "true" : "false";
                formulaEval.ComponentParameter["console_messages"] = "on";
                formulaEval.ComponentParameter["expanded"] = "true";

                //formulaEval.Initialize(project);
                formulaEval.InvokeEx(project, testObj, fcos, 16);
            }
            finally
            {
                project.Close(true);
            }
        }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:28,代码来源:FormulaEvaluateRunner.cs

示例9: Initialize

 /// <summary>
 /// This function is called for each interpreter invocation before Main.
 /// Don't perform MGA operations here unless you open a tansaction.
 /// </summary>
 /// <param name="project">The handle of the project opened in GME, for 
 /// which the interpreter was called.</param>
 public void Initialize(MgaProject project)
 {
     if (project == null)
     {
         throw new ArgumentNullException("project");
     }
 }
开发者ID:neemask,项目名称:meta-core,代码行数:13,代码来源:CyPhyMasterInterpreter.cs

示例10: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            this.Logger.WriteInfo("Running Component Authoring interpreter.");

            // verify we are running in a component and that it is not an instance or library
            string return_msg;
            if (!CheckPreConditions(currentobj, out return_msg))
            {
                this.Logger.WriteFailed(return_msg);
                return;
            }

            // assuming a component is open
            // stash off the project, currentobj and CurrentComponent parameters for use in the event handlers
            StashProject = project;
            StashCurrentObj = currentobj;
            StashCurrentComponent = CyPhyClasses.Component.Cast(currentobj);

            // use reflection to populate the dialog box objects
            PopulateDialogBox();

            // To use the domain-specific API:
            //  Create another project with the same name as the paradigm name
            //  Copy the paradigm .mga file to the directory containing the new project
            //  In the new project, install the GME DSMLGenerator NuGet package (search for DSMLGenerator)
            //  Add a Reference in this project to the other project
            //  Add "using [ParadigmName] = ISIS.GME.Dsml.[ParadigmName].Classes.Interfaces;" to the top of this file
            // if (currentobj.Meta.Name == "KindName")
            // [ParadigmName].[KindName] dsCurrentObj = ISIS.GME.Dsml.[ParadigmName].Classes.[KindName].Cast(currentobj);			
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:30,代码来源:CyPhyComponentAuthoring.cs

示例11: GetConfigurations

        public static bool GetConfigurations(string projectPath, string absPath)
        {

            bool result = false;
            Assert.True(File.Exists(projectPath), "Project file does not exist.");
            string ProjectConnStr = "MGA=" + Path.GetFullPath(projectPath);

            MgaProject project = new MgaProject();
            project.OpenEx(ProjectConnStr, "CyPhyML", null);
            try
            {
                var terr = project.BeginTransactionInNewTerr();
                var testObj = project.ObjectByPath[absPath] as MgaFCO;
                project.AbortTransaction();

                using (var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI(project))
                {
                    IMgaFCOs configurations = null;

                    Assert.ThrowsDelegate d = () =>
                    {
                        configurations = masterInterpreter.GetConfigurations(testObj as MgaModel);
                    };

                    Assert.DoesNotThrow(d);
                }
            }
            finally
            {
                project.Close(true);
            }

            return result;
        }
开发者ID:neemask,项目名称:meta-core,代码行数:34,代码来源:CyPhyMasterInterpreterRunner.cs

示例12: RunContextCheck

        public static bool RunContextCheck(string projectPath, string absPath)
        {
            bool result = false;
            Assert.True(File.Exists(projectPath), "Project file does not exist.");
            string ProjectConnStr = "MGA=" + Path.GetFullPath(projectPath);

            MgaProject project = new MgaProject();
            project.OpenEx(ProjectConnStr, "CyPhyML", null);
            try
            {
                var terr = project.BeginTransactionInNewTerr();
                var testObj = project.ObjectByPath[absPath] as MgaFCO;
                project.AbortTransaction();

                using (var masterInterpreter = new CyPhyMasterInterpreter.CyPhyMasterInterpreterAPI(project))
                {
                    CyPhyMasterInterpreter.Rules.ContextCheckerResult[] contextCheckerResults = null;

                    // check context
                    result = masterInterpreter.TryCheckContext(testObj as MgaModel, out contextCheckerResults);
                }
            }
            finally
            {
                project.Close(true);
            }

            return result;
        }
开发者ID:neemask,项目名称:meta-core,代码行数:29,代码来源:CyPhyMasterInterpreterRunner.cs

示例13: Main

        public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
        {
            // TODO: Add your interpreter code
            gmeConsole.Out.WriteLine("Running Subtree Merge Utility ...");

            string[] FileNames = null;
            DialogResult dr;
            using (OpenFileDialog ofd = new OpenFileDialog()) {
                ofd.CheckFileExists = true;
                ofd.DefaultExt = "mga";
                ofd.Multiselect = false;
                ofd.Filter = "mga files (*.mga)|*.mga|All files (*.*)|*.*";

                dr = ofd.ShowDialog();
                if (dr == DialogResult.OK) {
                    FileNames = ofd.FileNames;
                }
            }
            if (dr == DialogResult.OK) {
                MgaGateway.PerformInTransaction(delegate {
                    SubTreeMerge subTreeMerge = new SubTreeMerge();
                    subTreeMerge.gmeConsole = gmeConsole;
                    subTreeMerge.merge(currentobj, FileNames[0]);
                }, transactiontype_enum.TRANSACTION_NON_NESTED, abort: false);
                return;
            } else {
                gmeConsole.Warning.WriteLine("Subtree Merge Utility cancelled");
                return;
            }
        }
开发者ID:metamorph-inc,项目名称:meta-core,代码行数:30,代码来源:SubTreeMerge.cs

示例14: Initialize

 /// <summary>
 /// This function is called for each interpreter invocation before Main.
 /// Don't perform MGA operations here unless you open a tansaction.
 /// </summary>
 /// <param name="project">The handle of the project opened in GME, for which the interpreter was called.</param>
 public void Initialize(MgaProject project)
 {
     if (Logger == null)
         Logger = new CyPhyGUIs.GMELogger(project, ComponentName);
     MgaGateway = new MgaGateway(project);
     project.CreateTerritoryWithoutSink(out MgaGateway.territory);       
 }
开发者ID:pombredanne,项目名称:metamorphosys-desktop,代码行数:12,代码来源:CyPhy2RF.cs

示例15: Main

 public void Main(MgaProject project, MgaFCO currentobj, MgaFCOs selectedobjs, ComponentStartMode startMode)
 {
     // create a checker instance
     var ch = new Framework.Checker(currentobj, project, null);
     var checkerWindow = new RuleView(ch);
     checkerWindow.ShowDialog();
 }
开发者ID:neemask,项目名称:meta-core,代码行数:7,代码来源:DesignConsistencyChecker.cs


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