示例#1
0
        public override T GetContextObject <T>()
        {
            dynamic obj   = Native.GetContextObject();
            Type    typeT = typeof(T);

            if (typeT == typeof(IEAElement))
            {
                var nativeElement = obj as Element;
                if (nativeElement != null)
                {
                    dynamic element = EAElement.Wrap(nativeElement);
                    return(element);
                }
                return(default(T));
            }
            if (typeT == typeof(IEAPackage))
            {
                var nativePackage = obj as Package;
                if (nativePackage != null)
                {
                    dynamic element = EAPackage.Wrap(nativePackage);
                    return(element);
                }
                return(default(T));
            }
            if (typeT == typeof(IEADiagram))
            {
                var nativeDiagram = obj as Diagram;
                if (nativeDiagram != null)
                {
                    dynamic element = EADiagram.Wrap(nativeDiagram);
                    return(element);
                }
                return(default(T));
            }

            throw new NotSupportedException("Type (" + typeT.Name + ") not supported by GetContextObject()");
        }
示例#2
0
 public override IEAPackage GetPackageByGUID(string guid)
 {
     return(EAPackage.Wrap(Native.GetPackageByGuid(guid)));
 }
示例#3
0
 public override IEAPackage GetPackageByID(int id)
 {
     return(EAPackage.Wrap(Native.GetPackageByID(id)));
 }
示例#4
0
 public override IEAPackage GetPackageFromRootByName(string name)
 {
     return(EAPackage.Wrap(Root.Packages.GetByName(name)));
 }