Exemple #1
0
        private void eventButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (eventButton.Checked)
                {
                    if (_application == null)
                    {
                        // On a system where Solid Edge is installed, the COM ProgID will be
                        // defined in registry: HKEY_CLASSES_ROOT\SolidEdge.Application
                        Type t = Type.GetTypeFromProgID(SolidEdge.PROGID.Application, throwOnError: true);

                        // Using the discovered Type, create and return a new instance of Solid Edge.
                        _application = (SolidEdgeFramework.Application)Activator.CreateInstance(type: t);

                        // Show Solid Edge.
                        _application.Visible = true;
                    }

                    _applicationEventWatcher = new ApplicationEventWatcher(this, _application);
                }
                else
                {
                    _applicationEventWatcher.Dispose();
                    _applicationEventWatcher = null;
                    _application = null;
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(this, ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #2
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (_applicationEventWatcher != null)
     {
         _applicationEventWatcher.Dispose();
         _applicationEventWatcher = null;
     }
     _application = null;
 }
Exemple #3
0
        public void OnBeforeQuit()
        {
            eventLogTextBox.AppendText("OnBeforeQuit");
            eventLogTextBox.AppendText(Environment.NewLine);

            _applicationEventWatcher.Dispose();
            _applicationEventWatcher = null;
            _application = null;
        }