/// <summary> /// Disallows collapsing of the compartment with a left key /// </summary> public override void OnKeyDown(DiagramKeyEventArgs e) { if (e.KeyData == Keys.Left && !e.Handled) { e.Handled = true; } base.OnKeyDown(e); }
// Handling the delete press here instead of an accelerator key because this is specific to the socket shape where // an accelerator key is global to the design window and we would have to handle every senario (text box editing, module deleting) public override void OnKeyUp(DiagramKeyEventArgs e) { base.OnKeyUp(e); if (e.KeyCode == System.Windows.Forms.Keys.Delete) { var dte = this.Diagram.GetService(typeof(DTE)) as DTE; if (dte != null) { try { dte.ExecuteCommand("OtherContextMenus.GadgeteerDSLContext.Disconnect"); } catch (COMException) { //This can happen for sockets when they are not connected } } } }