Ejemplo n.º 1
0
        public ComponentInfo(GME.MGA.IMgaFCO gmeObject, string modelType = null, CyPhyCOMInterfaces.IMgaTraceability traceability = null)
        {
            this.Name      = gmeObject.Name;
            this.AbsPath   = gmeObject.AbsPath;
            this.ID        = gmeObject.ID;
            this.Path      = this.GetPath();
            this.Kind      = gmeObject.Meta.Name;
            this.ModelType = modelType;
            if (this.Kind == typeof(CyPhy.Component).Name)
            {
                var component = CyPhyClasses.Component.Cast(gmeObject);
                this.AVMID = component.Attributes.AVMID;
            }

            if (traceability != null)
            {
                string id = string.Empty;
                if (traceability.TryGetMappedObject(gmeObject.ID, out id))
                {
                    GME.MGA.MgaFCO baseComponent = gmeObject.Project.GetFCOByID(id);
                    if (baseComponent != null)
                    {
                        if (baseComponent.Status == 1)
                        {
                            // object is already deleted
                            // try to get it in a different way.
                            var idChain = gmeObject.RegistryValue["Elaborator/ID_Chain"];
                            if (string.IsNullOrWhiteSpace(idChain) == false)
                            {
                                id = idChain.Split(new char[] { ',' }).LastOrDefault();
                                if (id != null)
                                {
                                    baseComponent = gmeObject.Project.GetFCOByID(id);
                                    if (baseComponent != null)
                                    {
                                        this.Reference = new ComponentInfo(baseComponent, modelType);
                                    }
                                }
                            }
                        }
                        else
                        {
                            this.Reference = new ComponentInfo(baseComponent, modelType);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void InitializeEx(GME.MGA.MgaProject p, GME.MGA.Meta.MgaMetaPart meta, GME.MGA.MgaFCO obj, GME.IMgaCommonDecoratorEvents eventSink, ulong parentWnd)
        {
            Project   = p;
            MetaPart  = meta;
            MgaObject = obj;
            unchecked { parentHwnd = (IntPtr)(int)parentWnd; }

            if (MgaObject != null)
            {
                Label = MgaObject.Name;
            }
            else
            {
                Label = MetaPart.DisplayedName;
            }
            using (Graphics g = Graphics.FromHwnd(parentHwnd))
            {
                LabelSize = g.MeasureString(Label, LabelFont);
            }
        }
Ejemplo n.º 3
0
 public void Initialize(GME.MGA.MgaProject p, GME.MGA.Meta.MgaMetaPart meta, GME.MGA.MgaFCO obj)
 {
     InitializeEx(p, meta, obj, null, 0);
 }
Ejemplo n.º 4
0
 public void GetPortLocation(GME.MGA.MgaFCO fco, out int sx, out int sy, out int ex, out int ey)
 {
     throw new NotImplementedException();
 }