コード例 #1
0
        public void RefreshGlobalParameters()
        {
            ComPtr pApplication = IntPtr.Zero;

            if (MarshalEx.Succeeded(MarshalEx.GetActiveObject("SolidEdge.Application", out pApplication)))
            {
                SelectedObject = new GlobalParameterInfo(pApplication, this.textBoxSearch.Text);
            }
        }
コード例 #2
0
        public void Connect()
        {
            Disconnect();

            ComPtr pApplication = IntPtr.Zero;

            try
            {
                if (MarshalEx.Succeeded(MarshalEx.GetActiveObject("SolidEdge.Application", out pApplication)))
                {
                    comTreeView.AddRootNode(pApplication, "Application");
                }
            }
            catch
            {
                GlobalExceptionHandler.HandleException();
            }
            finally
            {
            }
        }
コード例 #3
0
        private bool ConnectToSolidEdge()
        {
            ComPtr pApplication = IntPtr.Zero;

            try
            {
                if (MarshalEx.Succeeded(MarshalEx.GetActiveObject("SolidEdge.Application", out pApplication)))
                {
                    _application = pApplication.TryGetUniqueRCW <SolidEdgeFramework.Application>();
                    _connectionPointController.AdviseSink <SolidEdgeFramework.ISEApplicationEvents>(_application);

                    commandBrowser.ActiveEnvironment = _application.GetActiveEnvironment();
                    globalParameterBrowser.RefreshGlobalParameters();

                    objectBrowser.Connect();

                    // Older versions of Solid Edge don't have the ProcessID property.
                    try
                    {
                        processBrowser.ProcessId = _application.ProcessID;
                    }
                    catch
                    {
                    }

                    return(true);
                }
            }
            catch
            {
                GlobalExceptionHandler.HandleException();
            }
            finally
            {
                pApplication.Dispose();
            }

            return(false);
        }