Beispiel #1
0
        static string GetApplicationGuid()
        {
            Assembly      assembly  = Assembly.GetExecutingAssembly();
            GuidAttribute attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];

            return(attribute.Value);
        }
Beispiel #2
0
        private void AnalyzeAssembly()
        {
            bool comVisible = false;
            bool hasGuid    = false;
            bool isSigned   = false;

            foreach (object item in Attributes)
            {
                ComVisibleAttribute comAttribute = item as ComVisibleAttribute;
                if (null != comAttribute && comAttribute.Value)
                {
                    comVisible = true;
                }

                GuidAttribute guidAttribute = item as GuidAttribute;
                if (null != guidAttribute)
                {
                    hasGuid = true;
                }
            }

            isSigned = (Name.GetPublicKeyToken().Length != 0);

            Result.Add("Assembly-ComVisible", comVisible);
            Result.Add("Assembly-HasGuid", hasGuid);
            Result.Add("Assembly-IsSigned", isSigned);
        }
Beispiel #3
0
        public void Populate()
        {
            String        mutexName = "Global\\XCRMDBUpdater";
            GuidAttribute attribute = GetType().Assembly.GetCustomAttributes(typeof(GuidAttribute), false).FirstOrDefault() as GuidAttribute;

            if (attribute != null)
            {
                mutexName = "Global\\" + attribute.Value.ToString();
            }
            using (Mutex mutex = new Mutex(false, mutexName)) {
                Boolean isMutexAcquired = false;
                try {
                    isMutexAcquired = mutex.WaitOne(new TimeSpan(0, 0, 15), false);
                }
                catch (AbandonedMutexException) {
                    isMutexAcquired = true;
                }
                if (isMutexAcquired)
                {
                    try {
                        PopulateCore();
                    }
                    finally {
                        mutex.ReleaseMutex();
                    }
                }
            }
        }
 private static void UnregisterHandleDocumentInspector(Type type)
 {
     try
     {
         DocumentInspectorAttribute[] attributes = DocumentInspectorAttribute.GetAttributes(type);
         if (attributes.Length > 0)
         {
             RegistryLocationAttribute location = AttributeReflector.GetRegistryLocationAttribute(type);
             GuidAttribute             typeid   = AttributeReflector.GetGuidAttribute(type);
             foreach (var attribute in attributes)
             {
                 foreach (var version in attribute.ProcessedApplicationVersion)
                 {
                     DocumentInspectorAttribute.TryDeleteKey("Word", attribute.Name, version);
                 }
             }
         }
     }
     catch (Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.UnRegister, exception))
         {
             throw;
         }
     }
 }
Beispiel #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
            bool          createdNew;
            Assembly      assembly  = Assembly.GetExecutingAssembly();
            GuidAttribute attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
            string        appGuid   = attribute.Value;

            _instance = new Mutex(true, @"Global\" + appGuid, out createdNew);
            if (!createdNew)
            {
                _instance = null;
                Current.Shutdown();
                return;
            }

            base.OnStartup(e);
            try
            {
                NotifyIcon = (TaskbarIcon)FindResource("NotifyIcon");
                if (NotifyIcon != null && NotifyIcon.DataContext == null)
                {
                    NotifyIcon.DataContext = new NotifyIconViewModel();
                }
            }
            catch (Exception ex)
            {
                Logger.Instance.Log(ex);
                MessageBox.Show("Unable to start the BOT.", "Error");
            }
        }
        // ******************************************************************

        /// <summary>
        /// Reads the value of the <see cref="GuidAttribute"/> attribute
        /// attribute for the given assembly.
        /// </summary>
        /// <param name="assembly">The assembly to read from.</param>
        /// <returns>The value of the given assembly's guid attribute.</returns>
        public static string ReadGuid(this Assembly assembly)
        {
            // Attempt to read the assembly's guid attribute.
            object[] attributes = assembly.GetCustomAttributes(
                typeof(GuidAttribute),
                true
                );

            // Did we fail?
            if (attributes.Length == 0)
            {
                return(string.Empty);
            }

            // Attempt to recover a reference to the attribute.
            GuidAttribute attr =
                attributes[0] as GuidAttribute;

            // Did we fail?
            if (attr == null || attr.Value.Length == 0)
            {
                return(string.Empty);
            }

            // Return the text for the attribute.
            return(attr.Value);
        }
Beispiel #7
0
        public void Unregister(Type gameType)
        {
            if (gameType == null)
            {
                return;
            }
            if (!m_typeMap.ContainsKey(gameType))
            {
                return;
            }

            GuidAttribute guid      = (GuidAttribute)Assembly.GetCallingAssembly( ).GetCustomAttributes(typeof(GuidAttribute), true)[0];
            Guid          guidValue = new Guid(guid.Value);

            HashSet <GameObjectTypeEntry> hashSet = m_registry[guidValue];

            foreach (GameObjectTypeEntry entry in hashSet)
            {
                if (entry.gameType == gameType)
                {
                    hashSet.Remove(entry);
                    break;
                }
            }

            m_typeMap.Remove(gameType);
        }
Beispiel #8
0
        public static void Main(string[] args)
        {
            GuidAttribute imAttribute =
                (GuidAttribute)Attribute.GetCustomAttribute(typeof(IMyInterface), typeof(GuidAttribute));

            System.Console.WriteLine("IMYintergface atribiute :: " + imAttribute.Value);
            Guid guid1 = new Guid(imAttribute.Value);
            Guid guid2 = new Guid(guid1.ToByteArray());

            if (guid1.Equals(guid2))
            {
                System.Console.WriteLine("myGuid1 equals myGuid2");
            }
            else
            {
                System.Console.WriteLine("myGuid1 does not equal myGuid2");
            }

            // Equality operator can also be used to determine if two guids have same value.
            if (guid1 == guid2)
            {
                System.Console.WriteLine("myGuid1 == myGuid2");
            }
            else
            {
                System.Console.WriteLine("myGuid1 != myGuid2");
            }
        }
Beispiel #9
0
        /// <summary>
        /// Extracts the <see cref="Guid"/> from an interface using
        /// the <see cref="GuidAttribute"/> attribute.
        /// </summary>
        /// <param name="interfaceType">
        /// The interface type.
        /// </param>
        /// <returns>
        /// The <see cref="Guid"/> attached to the interface.
        /// </returns>
        private static Guid GetGuid(Type interfaceType)
        {
            if (null == interfaceType || !interfaceType.IsInterface)
            {
                return(Guid.Empty);
            }

            object[] attributes = interfaceType.GetCustomAttributes(typeof(GuidAttribute), false);
            if (null == attributes || 0 == attributes.Length)
            {
                return(Guid.Empty);
            }

            GuidAttribute guid = (GuidAttribute)attributes[0];

            if (null == guid || null == guid.Value || 0 == guid.Value.Length)
            {
                return(Guid.Empty);
            }

            try
            {
                return(new Guid(guid.Value));
            }
            catch (FormatException)
            {
            }

            return(Guid.Empty);
        }
        public void DoIt()
        {
            // Get the tool GUID;
            Type          t        = typeof(SimpleTool);
            GuidAttribute guidAttr = (GuidAttribute)t.GetCustomAttributes(typeof(GuidAttribute), false)[0];
            Guid          guid     = new Guid(guidAttr.Value);

            // don't redefine the stock tool if it's already in the catalog
            ToolPaletteManager mgr = ToolPaletteManager.Manager;

            if (mgr.StockToolCatalogs.Find(guid) != null)
            {
                return;
            }

            SimpleTool tool = new SimpleTool();

            tool.New();

            Catalog catalog = tool.CreateStockTool("SimpleCatalog");
            Palette palette = tool.CreatePalette(catalog, "SimplePalette");
            Package package = tool.CreateShapeCatalog("*AutoCADShapes");

            tool.CreateFlyoutTool(palette, package, null);
            ImageInfo imageInfo = new ImageInfo();

            imageInfo.ResourceFile = "TOOL1.bmp";
            imageInfo.Size         = new System.Drawing.Size(65, 65);

            tool.CreateCommandTool(palette, "Line", imageInfo, tool.CmdName);
            tool.CreateTool(palette, "Custom Line", imageInfo);
            mgr.LoadCatalogs();
        }
Beispiel #11
0
 private static void RegisterHandleDocumentInspector(Type type)
 {
     try
     {
         DocumentInspectorAttribute[] attributes = DocumentInspectorAttribute.GetAttributes(type);
         if (attributes.Length > 0)
         {
             GuidAttribute typeid = AttributeReflector.GetGuidAttribute(type);
             foreach (var attribute in attributes)
             {
                 foreach (var version in attribute.ProcessedApplicationVersion)
                 {
                     DocumentInspectorAttribute.CreateKey("Word", attribute.Name, version, attribute.Selected, typeid.Value);
                 }
             }
         }
     }
     catch (NetRuntimeSystem.Exception exception)
     {
         NetOffice.DebugConsole.Default.WriteException(exception);
         if (!RegisterErrorHandler.RaiseStaticErrorHandlerMethod(type, RegisterErrorMethodKind.Register, exception))
         {
             throw;
         }
     }
 }
Beispiel #12
0
    private static string GetAppid()
    {
        Assembly      assembly  = typeof(Program).Assembly;
        GuidAttribute attribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];

        return(attribute.Value);
    }
        public static Guid Guid(this Enum e)
        {
            FieldInfo     fi        = e.GetType().GetField(e.ToString());
            GuidAttribute attribute = fi.GetCustomAttribute <GuidAttribute>();

            return(attribute.Guid);
        }
Beispiel #14
0
        public AboutBox()
        {
            InitializeComponent();

            foreach (Assembly s in AppDomain.CurrentDomain.GetAssemblies())
            {
                string[] lvsi = new string[3];
                lvsi[0] = s.GetName().Name;
                lvsi[1] = s.GetName().FullName;
                lvsi[2] = s.GetName().Version.ToString();
                ListViewItem lvi = new ListViewItem(lvsi, 0);
                this.ListOfAssemblies.Items.Add(lvi);
            }

            AssemblyCopyrightAttribute   objCopyright   = AssemblyCopyrightAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute)) as AssemblyCopyrightAttribute;
            AssemblyDescriptionAttribute objDescription = AssemblyDescriptionAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyDescriptionAttribute)) as AssemblyDescriptionAttribute;
            AssemblyCompanyAttribute     objCompany     = AssemblyCompanyAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute)) as AssemblyCompanyAttribute;
            AssemblyTrademarkAttribute   objTrademark   = AssemblyTrademarkAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTrademarkAttribute)) as AssemblyTrademarkAttribute;
            AssemblyProductAttribute     objProduct     = AssemblyProductAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyProductAttribute)) as AssemblyProductAttribute;
            AssemblyTitleAttribute       objTitle       = AssemblyTitleAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(AssemblyTitleAttribute)) as AssemblyTitleAttribute;
            GuidAttribute         objGuid         = GuidAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(GuidAttribute)) as GuidAttribute;
            DebuggableAttribute   objDebuggable   = DebuggableAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(DebuggableAttribute)) as DebuggableAttribute;
            CLSCompliantAttribute objCLSCompliant = CLSCompliantAttribute.GetCustomAttribute(System.Reflection.Assembly.GetExecutingAssembly(), typeof(CLSCompliantAttribute)) as CLSCompliantAttribute;

            AppName.Text        = objProduct.Product;
            BigTitle.Text       = objTitle.Title;
            ProdVer.Text        = QuestDesignerMain.Version;
            AppDesc.Text        = objDescription.Description;
            CopyrightLabel.Text = objCopyright.Copyright;
            SerialNo.Text       = objGuid.Value;
            Company.Text        = objCompany.Company;
        }
Beispiel #15
0
        public static void RegisterFunction(Type t)
        {
            AttributeCollection attributes      = TypeDescriptor.GetAttributes(t);
            ProgIdAttribute     progIdAttribute = attributes[typeof(ProgIdAttribute)] as ProgIdAttribute;
            GuidAttribute       guidAttribute   = attributes[typeof(GuidAttribute)] as GuidAttribute;
            string      value       = (progIdAttribute != null) ? progIdAttribute.Value : t.FullName;
            string      value2      = t.Module.FullyQualifiedName.Replace("\\", "/");
            string      text        = "{" + guidAttribute.Value + "}";
            string      subkey      = string.Format("CLSID\\{0}\\LocalServer32", text);
            string      subkey2     = "AppID\\" + ComObject.AppIDGUID;
            RegistryKey registryKey = Registry.ClassesRoot.CreateSubKey(subkey2);

            registryKey.SetValue(null, t.Module.Name);
            registryKey.SetValue("LocalService", BaseConfiguration.ClientServiceName);
            registryKey.SetValue("AuthenticationLevel", 1, RegistryValueKind.DWord);
            string      subkey3      = "AppID\\" + t.Module;
            RegistryKey registryKey2 = Registry.ClassesRoot.CreateSubKey(subkey3);

            registryKey2.SetValue("AppID", ComObject.AppIDGUID);
            string      subkey4      = "CLSID\\" + text;
            RegistryKey registryKey3 = Registry.ClassesRoot.CreateSubKey(subkey4);

            registryKey3.SetValue("AppID", ComObject.AppIDGUID);
            RegistryKey registryKey4 = Registry.ClassesRoot.CreateSubKey(subkey);

            registryKey4.SetValue(null, value2);
            registryKey4.SetValue("Class", value);
            registryKey4.SetValue("ThreadingModel", "Both");
            Registry.ClassesRoot.DeleteSubKeyTree(string.Format("CLSID\\{0}\\InprocServer32", text));
        }
Beispiel #16
0
        public bool RegisterNewInstance()
        {
            // Get guid of the executing assembly
            Assembly      assembly      = Assembly.GetExecutingAssembly();
            GuidAttribute guidAttribute = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];
            string        guid          = guidAttribute.Value;

            // Create mutext
            this.mutex = new Mutex(false, guid);

            // Register notify message
            if (notifyInstanceMessage == 0)
            {
                notifyInstanceMessage = User32Interop.RegisterWindowMessage(notifyMessageName);
            }

            // Wait on the mutext, false return value means that another instance is running
            if (!this.mutex.WaitOne(0, false))
            {
                if (notifyInstanceMessage != 0)
                {
                    User32Interop.PostMessage((IntPtr)User32Interop.HWND_BROADCAST, notifyInstanceMessage, 0, 0);
                }
                return(false);
            }

            // Create a window to receive notifications
            if (this.siWindow == null)
            {
                this.siWindow = new SIWindow(this);
            }
            return(true);
        }
Beispiel #17
0
        static void Main(string[] args)
        {
            // Get the class type to access its metadata.
            Type clsType = typeof(TestClass);
            // See if the Guid attribute is defined for the class.
            bool isDef = Attribute.IsDefined(clsType, typeof(GuidAttribute));

            // Display the result.
            Console.WriteLine("The Guid attribute {0} defined for class {1}.",
                              isDef ? "is" : "is not", clsType.Name);
            // If it's defined, display the GUID.
            if (isDef)
            {
                GuidAttribute guidAttr =
                    (GuidAttribute)Attribute.GetCustomAttribute(clsType,
                                                                typeof(GuidAttribute));
                if (guidAttr != null)
                {
                    Console.WriteLine("GUID: {" + guidAttr.Value + "}.");
                }
                else
                {
                    Console.WriteLine("The Guid attribute could " +
                                      "not be retrieved.");
                }
            }
        }
Beispiel #18
0
        /// <summary>
        ///  This method is called by Inventor when it loads the addin.
        ///  The AddInSiteObject provides access to the Inventor Application object.
        ///  The FirstTime flag indicates if the addin is loaded for the first time.
        /// </summary>
        /// <param name="addInSiteObject"></param>
        /// <param name="firstTime"></param>
        public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
        {
            try
            {
                InventorApplication = addInSiteObject.Application;

                //retrieve the GUID for this class and assign it to the string member variable
                //intended to hold it
                GuidAttribute addInClsid = (GuidAttribute)Attribute.GetCustomAttribute
                                               (typeof(StandardAddInServer), typeof(GuidAttribute));
                string addInClsidString = "{" + addInClsid.Value + "}";
                AddInServerId = addInClsidString;

                //Set a reference to the user interface manager to determine the interface style
                UserInterfaceManager userInterfaceManager = InventorApplication.UserInterfaceManager;
                InterfaceStyleEnum   interfaceStyle       = userInterfaceManager.InterfaceStyle;

                RectangleDependencyManager = new RectangleToolsDependencyMapper();

                if (interfaceStyle == InterfaceStyleEnum.kRibbonInterface)
                {
                    if (firstTime == true)
                    {
                        RectangleDependencyManager.InitializeUserInterface();
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
        }
Beispiel #19
0
    public static void RegisterFunction(Type t)
    {
        AttributeCollection attributes = TypeDescriptor.GetAttributes(t);
        ProgIdAttribute     ProgIdAttr = attributes[typeof(ProgIdAttribute)] as ProgIdAttribute;

        string ProgId = ProgIdAttr != null ? ProgIdAttr.Value : t.FullName;

        GuidAttribute GUIDAttr = attributes[typeof(GuidAttribute)] as GuidAttribute;
        string        GUID     = "{" + GUIDAttr.Value + "}";

        RegistryKey localServer32 = Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}\\LocalServer32", GUID));

        localServer32.SetValue(null, t.Module.FullyQualifiedName);

        RegistryKey CLSIDProgID = Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}\\ProgId", GUID));

        CLSIDProgID.SetValue(null, ProgId);

        RegistryKey ProgIDCLSID = Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}", ProgId));

        ProgIDCLSID.SetValue(null, GUID);

        //Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}\\Implemented Categories\\{{63D5F432-CFE4-11D1-B2C8-0060083BA1FB}}", GUID));
        //Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}\\Implemented Categories\\{{63D5F430-CFE4-11d1-B2C8-0060083BA1FB}}", GUID));
        //Registry.ClassesRoot.CreateSubKey(String.Format("CLSID\\{0}\\Implemented Categories\\{{62C8FE65-4EBB-45e7-B440-6E39B2CDBF29}}", GUID));
    }
Beispiel #20
0
    public static void Main(string [] args)
    {
        GuidAttribute IMyInterfaceAttribute = (GuidAttribute)Attribute.GetCustomAttribute(typeof(IMyInterface), typeof(GuidAttribute));

        System.Console.WriteLine("IMyInterface Attribute: " + IMyInterfaceAttribute.Value);

        // Use the string to create a guid.
        Guid myGuid1 = new Guid(IMyInterfaceAttribute.Value);
        // Use a byte array to create a guid.
        Guid myGuid2 = new Guid(myGuid1.ToByteArray());

        if (myGuid1.Equals(myGuid2))
        {
            System.Console.WriteLine("myGuid1 equals myGuid2");
        }
        else
        {
            System.Console.WriteLine("myGuid1 does not equal myGuid2");
        }

        // Equality operator can also be used to determine if two guids have same value.
        if (myGuid1 == myGuid2)
        {
            System.Console.WriteLine("myGuid1 == myGuid2");
        }
        else
        {
            System.Console.WriteLine("myGuid1 != myGuid2");
        }
    }
        private void CreateRibbon()
        {
            try
            {
                Inventor.UserInterfaceManager userInterFaceMgr = mInventorApp.UserInterfaceManager;
                userInterFaceMgr.UserInterfaceEvents.OnEnvironmentChange += new UserInterfaceEventsSink_OnEnvironmentChangeEventHandler(OnEnvironmentChange);

                //retrieve the GUID for this class
                GuidAttribute addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(RubiksCube.RubiksAddInServer), typeof(GuidAttribute));
                string        clientId   = "{" + addInCLSID.Value + "}";

                Icon         appLarge     = Resources.Rubiks_Cube_32;
                object       applargeIcon = AxHostConverter.ImageToPictureDisp(appLarge.ToBitmap());
                Icon         appStand     = Resources.Rubiks_Cube_16;
                object       appStandIcon = AxHostConverter.ImageToPictureDisp(appStand.ToBitmap());
                Environments envs         = userInterFaceMgr.Environments;
                mEnvironment = envs.Add(Resources.IDC_ENV_DISPLAY_NAME, Resources.IDC_ENV_INTERNAL_NAME, null, appStandIcon, applargeIcon);
                mEnvironment.AdditionalVisibleRibbonTabs = new string[] { Resources.IDC_ENV_INTERNAL_NAME };

                mObjCollection = mInventorApp.TransientObjects.CreateObjectCollection();

                //get the ribbon associated with part document
                Inventor.Ribbons ribbons = userInterFaceMgr.Ribbons;
                mPartRibbon = ribbons[Resources.IDC_ENV_PART];

                //get the tabs associated with part ribbon
                Inventor.RibbonTabs rubikRibbonTabs = mPartRibbon.RibbonTabs;
                mRubiksPartTab = rubikRibbonTabs.Add(Resources.IDC_TAB_DISPLAY_NAME, Resources.IDC_TAB_INTERNAL_NAME, "F0911DF2-478B-49EC-808D-D7C1F5271B6D", Resources.IDC_TARGET_TAB_NAME, true, true);

                //Adding solve Panel.
                RibbonPanel             solvePanel   = mRubiksPartTab.RibbonPanels.Add(Resources.IDC_SOLVE_DISPLAY_NAME, Resources.IDC_SOLVE_INTERNAL_NAME, "60A50C33-F7EE-4B74-BCB0-C5CE03C1B3E6");
                Inventor.CommandControl solveControl = solvePanel.CommandControls.AddButton(mSolve, true, true);

                //Adding randomize Panel.
                RibbonPanel             scramblePanel   = mRubiksPartTab.RibbonPanels.Add(Resources.IDC_SCRAMBLE_DISPLAY_NAME, Resources.IDC_SCRAMBLE_INTERNAL_NAME, "D20674CE-A855-4403-850B-FDE59C4A167B");
                Inventor.CommandControl scrambleControl = scramblePanel.CommandControls.AddButton(mScramble, true, true);

                //Adding randomize Panel.
                RibbonPanel playPanel = mRubiksPartTab.RibbonPanels.Add(Resources.IDC_PLAY_DISPLAY_NAME, Resources.IDC_PLAY_INTERNAL_NAME, "343D703C-1194-4715-BF54-3BE4E3B9FF64");
                //Inventor.CommandControl playControl = playPanel.CommandControls.AddButton(mPlay, true, true, "", false);

                mObjCollection.Add(mPlay);
                mObjCollection.Add(mNext);
                CommandControl partCmdCtrl = playPanel.CommandControls.AddSplitButtonMRU(mObjCollection, true);

                mEnvironment.DefaultRibbonTab = Resources.IDC_TAB_INTERNAL_NAME;
                userInterFaceMgr.ParallelEnvironments.Add(mEnvironment);
                mEnvCtrlDef = mInventorApp.CommandManager.ControlDefinitions[Resources.IDC_ENV_INTERNAL_NAME];
                mEnvCtrlDef.ProgressiveToolTip.ExpandedDescription = Resources.IDC_APPLICATION_BTN_TOOLTIP_EXPANDED;
                mEnvCtrlDef.ProgressiveToolTip.Description         = Resources.IDC_APPLICATION_BTN_TOOLTIP_DESCRIPTION;
                mEnvCtrlDef.ProgressiveToolTip.Title = Resources.IDC_APPLICATION_BTN_TITLE;

                AddToDisabledList();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.InnerException.Message);
            }
        }
Beispiel #22
0
        private string getGUID()
        {
            GuidAttribute addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(
                typeof(StandardAddInServer),
                typeof(GuidAttribute));

            return("{" + addInCLSID.Value + "}");
        }
        public COMRegistryInfoWriter(Assembly targetAssembly, Type targetUnitType)
        {
            mTargetAssembly = targetAssembly;
            mTargetUnitType = targetUnitType;
            GuidAttribute zUnitGuidAttribute = ((GuidAttribute[])mTargetUnitType.GetCustomAttributes(typeof(GuidAttribute), false))[0];

            mUnitGuid = new Guid(zUnitGuidAttribute.Value);
        }
Beispiel #24
0
        public string GetGUIDForThisClass()
        {
            //retrieve the GUID for this class
            GuidAttribute addInCLSID;

            addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(StandardAddInServer), typeof(GuidAttribute));
            return("{" + addInCLSID.Value + "}");
        }
        public COMRegistryInfoWriter(string targetAssemblyFileName, string targetUnitTypeName)
        {
            mTargetAssembly = Assembly.LoadFile(targetAssemblyFileName);
            mTargetUnitType = mTargetAssembly.GetType(targetUnitTypeName);
            GuidAttribute zUnitGuidAttribute = ((GuidAttribute[])mTargetUnitType.GetCustomAttributes(typeof(GuidAttribute), false))[0];

            mUnitGuid = new Guid(zUnitGuidAttribute.Value);
            mUnitGuid = new Guid(zUnitGuidAttribute.Value);
        }
Beispiel #26
0
        public void InitUI(AddInServer addIn, bool firstTime, Inventor.Application inventorApplication)
        {
            m_inventorApplication      = inventorApplication;
            Button.InventorApplication = m_inventorApplication;

            //load image icons for UI items
            Icon turnBlueIcon = new Icon(this.GetType(), "TurnBlue.ico");

            //retrieve the GUID for this class
            GuidAttribute addInCLSID;

            addInCLSID = (GuidAttribute)GuidAttribute.GetCustomAttribute(typeof(AddInServer), typeof(GuidAttribute));
            string addInCLSIDString;

            addInCLSIDString = "{" + addInCLSID.Value + "}";

            m_TurnBlueButton = new TurnBlueButton(addIn,
                                                  "TurnBlue", "Autodesk:TurnBlueAddIn:TurnBlueCmdBtn", CommandTypesEnum.kShapeEditCmdType,
                                                  addInCLSIDString, "Turns the part blue",
                                                  "TurnBlue", turnBlueIcon, turnBlueIcon, ButtonDisplayEnum.kDisplayTextInLearningMode);

            if (firstTime == true)
            {
                //access user interface manager
                UserInterfaceManager userInterfaceManager;
                userInterfaceManager = m_inventorApplication.UserInterfaceManager;

                InterfaceStyleEnum interfaceStyle;
                interfaceStyle = userInterfaceManager.InterfaceStyle;


                //get the ribbon associated with part document
                Inventor.Ribbons ribbons;
                ribbons = userInterfaceManager.Ribbons;

                Inventor.Ribbon partRibbon;
                partRibbon = ribbons["Part"];

                //get the tabs associated with part ribbon
                RibbonTabs ribbonTabs;
                ribbonTabs = partRibbon.RibbonTabs;

                RibbonTab partViewRibbonTab;
                partViewRibbonTab = ribbonTabs["id_TabView"];

                //create a new panel with the tab
                RibbonPanels ribbonPanels;
                ribbonPanels = partViewRibbonTab.RibbonPanels;

                RibbonPanel appearancePanel = ribbonPanels["id_PanelA_ViewAppearance"];

                CommandControls panelCtrls = appearancePanel.CommandControls;
                CommandControl  TurnBlueCmdBtnCmdCtrl;
                TurnBlueCmdBtnCmdCtrl = panelCtrls.AddButton(m_TurnBlueButton.ButtonDefinition, false, true, "", false);
            }
        }
Beispiel #27
0
        protected Guid GetClassUid()
        {
            GuidAttribute att = this.GetType().GetCustomAttribute <GuidAttribute>(false);

            if (att == null)
            {
                return(Guid.NewGuid());
            }
            return(new Guid(att.Value));
        }
Beispiel #28
0
        /// <summary>
        /// Gets the Guid from the given type.
        /// </summary>
        /// <typeparam name="T">The type to get the guid from.</typeparam>
        internal static Guid GetGuidOf <T>()
        {
            GuidAttribute guidAttribute = typeof(T).GetTypeInfo().GetCustomAttribute <GuidAttribute>();

            if (guidAttribute == null)
            {
                throw new SeeingSharpGraphicsException(string.Format("No Guid found on type {0}!", typeof(T).FullName));
            }

            return(new Guid(guidAttribute.Value));
        }
Beispiel #29
0
        internal static string GetGuidId <TConfiguration>()
        {
            Guid          guid;
            GuidAttribute attribute = typeof(TConfiguration).GetAttribute <GuidAttribute>(false);

            if (attribute == null || !Guid.TryParse(attribute.Value, out guid))
            {
                return(null);
            }
            return(guid.ToString("D"));
        }
        public PluginBase()
        {
            Assembly      assembly = Assembly.GetCallingAssembly();
            GuidAttribute guidAttr = (GuidAttribute)assembly.GetCustomAttributes(typeof(GuidAttribute), true)[0];

            m_pluginId = new Guid(guidAttr.Value);
            AssemblyName asmName = assembly.GetName();

            m_name    = asmName.Name;
            m_version = asmName.Version.ToString();
        }