void command_Terminate() { this.Do(frm => { frm.HandleCommandTerminate(); }); _mouse = null; _command = null; _application = null; }
private void ConnectMouse() { _cmd = (SolidEdgeFramework.Command)_application.CreateCommand((int)SolidEdgeConstants.seCmdFlag.seNoDeactivate); _mouse = (SolidEdgeFramework.Mouse)_cmd.Mouse; _cmd.Start(); _mouse.EnabledMove = true; _mouse.LocateMode = (int)SolidEdgeConstants.seLocateModes.seLocateSimple; _mouse.ScaleMode = 1; // Design model coordinates. _mouse.WindowTypes = 1; // Graphic window's only. _mouse.AddToLocateFilter(32); _connectionPointController.AdviseSink <SolidEdgeFramework.ISEMouseEvents>(_mouse); }
private void buttonStartCommand_Click(object sender, EventArgs e) { try { _application = SolidEdgeCommunity.SolidEdgeUtils.Connect(); _command = _application.CreateCommand((int)SolidEdgeConstants.seCmdFlag.seNoDeactivate); _command.Terminate += command_Terminate; _command.Start(); _mouse = _command.Mouse; _mouse.LocateMode = comboBoxLocateModes.SelectedIndex; _mouse.EnabledMove = (bool)comboBoxEnableMouseMoveEvent.SelectedItem; _mouse.ScaleMode = 1; // Design model coordinates. _mouse.WindowTypes = 1; // Graphic window's only. foreach (ListViewItem listViewItem in listViewFilters.CheckedItems) { int filter = (int)listViewItem.Tag; _mouse.AddToLocateFilter(filter); } _mouse.MouseDown += mouse_MouseDown; _mouse.MouseMove += mouse_MouseMove; outputTextBox.Clear(); comboBoxEnableMouseMoveEvent.Enabled = false; buttonStopCommand.Enabled = true; buttonStartCommand.Checked = true; buttonStartCommand.Enabled = false; comboBoxLocateModes.Enabled = false; listViewFilters.Enabled = false; } catch (System.Exception ex) { MessageBox.Show(ex.Message); } }