public override void Evaluate() { var oldType = ObjectType; var oldObject = Object; try { var result = StatementParser.EvaluateStatement(Expression, ThisObject, true, true, false); Object = result.Result; ObjectType = result.ResultType; if (Object != null) { this[1] = Object; } else { this[1] = "null"; } if (ObjectType != null) { this[2] = ObjectType.ToSignatureString(); } else { this[2] = ""; } } catch (Exception ex) { this[1] = "(ERROR: " + ex.GetType().Name + " - " + ex.Message + ")"; } SetChanged(oldObject, oldType); }
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 } }