public ExpressionBox(object thisObject) { this.thisObject = thisObject; InitializeComponent(); intellisense = new IntellisensePopup(); intellisense.Show(); intellisense.Hide(); intellisense.Deactivate += new EventHandler(intellisense_Deactivate); intellisense.MemberChosen += new EventHandler(intellisense_MemberChosen); }
private void txtEvaluate_KeyDown(object sender, KeyEventArgs e) { try { if (e.KeyCode == Keys.Enter) { if (intellisense.Visible) { ChooseMemberFromIntellisense(true); } else { try { this.Enabled = false; string statement = txtEvaluate.Text; var value = StatementParser.EvaluateStatement(statement, thisObject, true, true, useDebugger: ModifierKeys == Keys.Control); OnExpressionEvaluated(new EvaluateArgs() { Result = value, Statement = statement }); SetInput(""); } catch (Exception ex) { ILDebugManager.Instance.Debugger = null; MessageBox.Show("Unable to evaluate: " + ex.ToExceptionString()); } finally { this.Enabled = true; } } e.Handled = true; } else if (e.KeyCode == Keys.OemPeriod) { if (intellisense.Visible) { ChooseMemberFromIntellisense(false); } } else if (e.KeyCode == Keys.Up || e.KeyCode == Keys.Down) { if (intellisense.Visible) { if (e.KeyCode == Keys.Up) { intellisense.Up(); } else { intellisense.Down(); } e.Handled = true; } else { if (e.KeyCode == Keys.Up) { GoBack(); } else { GoForward(); } e.Handled = true; } } else if (e.KeyCode == Keys.PageUp || e.KeyCode == Keys.PageDown) { if (intellisense.Visible) { if (e.KeyCode == Keys.PageUp) { intellisense.PageUp(); } else { intellisense.PageDown(); } e.Handled = true; } } else if (e.KeyCode == Keys.Escape) { if (intellisense.Visible) { intellisense.Hide(); } } } catch (Exception) { // don't go crashing the app } }