public void Deactivate()
 {
     _instance = null;
     Marshal.ReleaseComObject(_application);
     _application = null;
     AssemblyResolver.Stop();
 }
        public void Activate(global::Inventor.ApplicationAddInSite site, bool firstTime)
        {
            log.Info("Attempting to load linkParameters..");
            _instance    = this;
            _application = site.Application;

            Type addinType = this.GetType();

            AdnInventorUtilities.Initialize(_application, addinType);

            AdnCommand.AddCommand(new LinkParametersCommand(_application));
            AdnCommand.AddCommand(new AboutCommand(_application));
            AdnCommand.AddCommand(new HelpControlCommand(_application));

            AdnRibbonBuilder.CreateRibbon(_application, addinType, "LinkParameters.Resources.AddInUI.xml");

            //Prevent user from unloading the add-in (except at Inventor shutdown).
            //This workarounds an issue concerning unloading/reloading an addin that
            //creates controls in a native Inventor Panel.
            site.Parent.UserUnloadable = false;

            AssemblyResolver.Paths.Add(AdnInventorUtilities.iLogicPath);
            AssemblyResolver.Start();
            log.Info("linkParameters loaded successfully.");
        }
Example #3
0
        public static ApplicationWrapper Create()
        {
            global::Inventor.Application app = (global::Inventor.Application)Activator.CreateInstance(Type.GetTypeFromProgID("Inventor.Application"));

            while (app.Ready == false)
            {
                System.Threading.Thread.Sleep(100);
            }
            ApplicationWrapper result = new ApplicationWrapper();

            int processId = 0;

            GetWindowThreadProcessId((IntPtr)app.MainFrameHWND, out processId);
            result.ProcessId    = processId;
            result.Server       = app;
            app.SilentOperation = true;
            app.Visible         = false;
            return(result);
        }