private void RowContextMenu_Opening(object sender, CancelEventArgs e) { e.Cancel = objectsGrid.EditTextBox != null; if (objectsGrid.EditTextBox != null) { AddModuleMenuItem.Visible = false; DisplayInViewerMenuItem.Visible = false; if (objectsGrid.SelectedItems.Count == 1) { GridEXRow selectedRow = objectsGrid.SelectedItems[0].GetRow(); NuGenIValueFormatter valueFormatter = NuGenHelperFunctions.TaggedObjects[(int)selectedRow.Cells[2].Value] as NuGenIValueFormatter; if (valueFormatter != null) { if (valueFormatter is NuGenMissingModuleFormatter) { AddModuleMenuItem.Visible = true; } DisplayInViewerMenuItem.Visible = true; } } } }
private void DisplayValueFormatter(NuGenIValueFormatter valueFormatter, TreeNode parentNode) { bool isMissingModuleFormatter = (valueFormatter is NuGenMissingModuleFormatter); if (!isMissingModuleFormatter || !MissingModules.Contains(valueFormatter)) { ListViewItem fieldItem = fieldList.Items.Add(valueFormatter.Name); fieldItem.ToolTipText = valueFormatter.GetFormattedString(NuGenSettings.Instance.DisplayHexaNumbers); fieldItem.SubItems.Add(fieldItem.ToolTipText); fieldItem.Group = GetFieldGroup(valueFormatter.FieldGroup); fieldItem.Tag = valueFormatter; if (valueFormatter.IsComplexType) { if (parentNode == null) { throw new InvalidOperationException(); } TreeNode valueFormatterNode = parentNode.Nodes.Add(valueFormatter.Name); valueFormatterNode.Tag = valueFormatter; valueFormatter.FieldNode = valueFormatterNode; } if (isMissingModuleFormatter) { MissingModules.Add(valueFormatter); } } }
private void InvokeDisplayValueFormatter(NuGenIValueFormatter valueFormatter, TreeNode parentNode) { if (InvokeRequired) { Invoke(DisplayValueFormatterMethod, valueFormatter, parentNode); } else { DisplayValueFormatter(valueFormatter, parentNode); } }
private void DisplayValue(NuGenBaseValueRefresher valueRefresher, TreeNode parentNode) { fieldList.Items.Clear(); evaluationLogListBox.Items.Clear(); try { NuGenDebugExpressionResult debugValue = new NuGenDebugExpressionResult(EvaluationContext, valueRefresher.GetRefreshedValue()); if (NuGenHelperFunctions.HasValueClass(debugValue.ResultValue)) { EnableControlsForEvaluation(false); CancelValueFormattersDisplaying = false; MissingModules = new List <NuGenIValueFormatter>(); IsTypeOfValueFound = false; ValueDisplayer.CreateComplexFormatter(debugValue, valueRefresher, FrameRefresher, parentNode); } else { NuGenIValueFormatter valueFormatter = ValueDisplayer.CreateSimpleFormatter(debugValue); valueFormatter.Name = valueRefresher.Name; valueFormatter.ValueRefresher = valueRefresher; DisplayValueFormatter(valueFormatter); if (valueFormatter is NuGenISimpleTypeValueFormatter) { NuGenStringValueFormatter valueTypeFormatter = new NuGenStringValueFormatter(((NuGenISimpleTypeValueFormatter)valueFormatter).GetNumberTypeName()); valueTypeFormatter.FieldGroup = ValueFieldGroup.ObjectInformation; valueTypeFormatter.Name = "Type of value"; DisplayValueFormatter(valueTypeFormatter); } } } catch (NuGenEvaluationException evaluationException) { DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", evaluationException.Message)); } catch (NuGenEvaluationHandlerException evaluationHandlerException) { DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation running exception", evaluationHandlerException.Message)); } catch (NugenMissingModuleException missingModuleException) { DisplayValueFormatter(new NuGenMissingModuleFormatter(missingModuleException.MissingModule)); } catch (InvalidOperationException invalidOperationException) { DisplayValueFormatter(new NuGenErrorValueFormatter("Evaluation exception", invalidOperationException.Message)); } catch (Exception exception) { DisplayValueFormatter(new NuGenErrorValueFormatter("Unexpected exception", exception.Message)); } }
private void objectsGrid_CellDoubleClick(object sender, RowActionEventArgs e) { if (objectsGrid.CurrentRow != null) { NuGenIValueFormatter valueFormatter = NuGenHelperFunctions.TaggedObjects[(int)objectsGrid.CurrentRow.Cells[2].Value] as NuGenIValueFormatter; if (valueFormatter != null) { NuGenUIHandler.Instance.ShowObjectInObjectViewer(ActiveFrame, valueFormatter.ValueRefresher, (string)objectsGrid.CurrentRow.Cells[0].Value); } } }
private void DisplayInViewerMenuItem_Click(object sender, EventArgs e) { if (objectsGrid.SelectedItems.Count == 1) { GridEXRow selectedRow = objectsGrid.SelectedItems[0].GetRow(); NuGenIValueFormatter valueFormatter = NuGenHelperFunctions.TaggedObjects[(int)selectedRow.Cells[2].Value] as NuGenIValueFormatter; if (valueFormatter != null) { NuGenUIHandler.Instance.ShowObjectInObjectViewer(ActiveFrame, valueFormatter.ValueRefresher, (string)selectedRow.Cells[0].Value); } } }
private void Instance_DisplayHexaNumbersChanged() { for (int i = 0; i < objectsGrid.RowCount; i++) { GridEXRow row = objectsGrid.GetRow(i); NuGenIValueFormatter valueFormatter = NuGenHelperFunctions.TaggedObjects[(int)row.Cells[2].Value] as NuGenIValueFormatter; if (valueFormatter != null) { row.Cells[1].Value = valueFormatter.GetFormattedString(NuGenSettings.Instance.DisplayHexaNumbers); } } }
private void Instance_DisplayHexaNumbersChanged() { displayHexaNumbersButton.Checked = NuGenSettings.Instance.DisplayHexaNumbers; foreach (ListViewItem item in fieldList.Items) { NuGenIValueFormatter valueFormatter = item.Tag as NuGenIValueFormatter; if (valueFormatter != null) { item.ToolTipText = valueFormatter.GetFormattedString(NuGenSettings.Instance.DisplayHexaNumbers); item.SubItems[1].Text = item.ToolTipText; } } }
private void DisplayWatchExpression(GridEXRow watchRow) { NuGenIValueFormatter watchValueFormatter = null; NuGenExpressionValueRefresher expressionRefresher = null; try { NuGenParser parser = new NuGenParser(); string watchExpression = (string)watchRow.Cells[0].Value; List <NuGenBaseExpression> expressions = parser.Parse(watchExpression); expressionRefresher = new NuGenExpressionValueRefresher(expressions, ActiveFrameRefresher, EvaluationContext.EvaluationHandler, watchExpression); watchValueFormatter = ValueDisplayer.CreateSimpleFormatter(expressionRefresher.GetRefreshedValue()); } catch (NuGenParserException parserException) { watchValueFormatter = new NuGenErrorValueFormatter("Parser exception", parserException.Message); } catch (NuGenEvaluationException evaluationException) { watchValueFormatter = new NuGenErrorValueFormatter("Evaluation exception", evaluationException.Message); } catch (NuGenEvaluationHandlerException evaluationHandlerException) { watchValueFormatter = new NuGenErrorValueFormatter("Evaluation running exception", evaluationHandlerException.Message); } catch (NugenMissingModuleException missingModuleException) { watchValueFormatter = new NuGenMissingModuleFormatter(missingModuleException.MissingModule); } catch (InvalidOperationException invalidOperationException) { watchValueFormatter = new NuGenErrorValueFormatter("Evaluation exception", invalidOperationException.Message); } catch (Exception exception) { watchValueFormatter = new NuGenErrorValueFormatter("Unexpected exception", exception.Message); } if (watchValueFormatter != null) { watchValueFormatter.ValueRefresher = expressionRefresher; watchRow.Cells[1].Value = watchValueFormatter.GetFormattedString(NuGenSettings.Instance.DisplayHexaNumbers); NuGenHelperFunctions.TaggedObjects[(int)watchRow.Cells[2].Value] = watchValueFormatter; } }
private void DisplayPropertiesOfSelectedObject() { if (fieldList.SelectedItems != null && fieldList.SelectedItems.Count == 1) { ListViewItem selectedItem = fieldList.SelectedItems[0]; NuGenIValueFormatter valueFormatter = selectedItem.Tag as NuGenIValueFormatter; if (valueFormatter != null && valueFormatter.ValueRefresher != null) { if (objectTree.SelectedNode != valueFormatter.FieldNode) { UpdateDisplayedValue = false; objectTree.SelectedNode = valueFormatter.FieldNode; UpdateDisplayedValue = true; } DisplayValue(valueFormatter.ValueRefresher, valueFormatter.FieldNode); } } }
private void ShowObjects(List <NuGenBaseValueRefresher> objects) { for (int index = 0; index < objects.Count; index++) { NuGenBaseValueRefresher valueRefresher = objects[index]; NuGenIValueFormatter valueFormatter = null; try { NuGenDebugExpressionResult debugValue = new NuGenDebugExpressionResult(evaluationContext, valueRefresher.GetRefreshedValue()); valueFormatter = ValueDisplayer.CreateSimpleFormatter(debugValue); } catch (Exception exception) { valueFormatter = new NuGenStringValueFormatter(exception.ToString()); } valueFormatter.Name = valueRefresher.Name; valueFormatter.ValueRefresher = valueRefresher; AddValueFormatter(valueFormatter); } }
private void objectTree_BeforeSelect(object sender, TreeViewCancelEventArgs e) { if (UpdateDisplayedValue && ValueDisplayer != null) { if (ValueDisplayer.IsEvaluationRunning) { e.Cancel = true; } else { NuGenIValueFormatter nodeValueFormatter = e.Node.Tag as NuGenIValueFormatter; if (nodeValueFormatter != null && nodeValueFormatter.ValueRefresher != null) { UpdateDisplayedValue = false; e.Node.Nodes.Clear(); UpdateDisplayedValue = true; DisplayValue(nodeValueFormatter.ValueRefresher, e.Node); } } } }
private void ItemContextMenu_Opening(object sender, CancelEventArgs e) { AddModuleMenuItem.Visible = false; DisplayPropertiesMenuItem.Visible = false; if (fieldList.SelectedItems != null && fieldList.SelectedItems.Count == 1) { ListViewItem selectedItem = fieldList.SelectedItems[0]; NuGenIValueFormatter valueFormatter = selectedItem.Tag as NuGenIValueFormatter; if (valueFormatter != null) { if (valueFormatter is NuGenMissingModuleFormatter) { AddModuleMenuItem.Visible = true; } if (valueFormatter.IsComplexType) { DisplayPropertiesMenuItem.Visible = true; } } } }
private void ValueDisplayer_ToStringEvaluated(NuGenValueDisplayer sender, NuGenMethodDefinition toStringMethodDef, NuGenIValueFormatter toStringValueFormatter) { InvokeDisplayValueFormatter(toStringValueFormatter, sender.ParentNode); InvokeStepEvaluationProgress(); UpdateCancelEvaluation(sender); }
private void ValueDisplayer_StringValueEvaluated(NuGenValueDisplayer sender, NuGenIValueFormatter stringValueFormatter) { InvokeDisplayValueFormatter(stringValueFormatter, sender.ParentNode); UpdateCancelEvaluation(sender); }
private void ValueDisplayer_PropertyEvaluated(NuGenValueDisplayer sender, NuGenProperty property, NuGenIValueFormatter propertyValueFormatter) { InvokeDisplayValueFormatter(propertyValueFormatter, sender.ParentNode); InvokeStepEvaluationProgress(); UpdateCancelEvaluation(sender); }
private void ValueDisplayer_FieldEvaluated(NuGenValueDisplayer sender, NuGenFieldDefinition fieldDefinition, NuGenIValueFormatter fieldValueFormatter) { InvokeDisplayValueFormatter(fieldValueFormatter, sender.ParentNode); InvokeStepEvaluationProgress(); UpdateCancelEvaluation(sender); }
private void ValueDisplayer_ErrorOccurred(NuGenValueDisplayer sender, NuGenIValueFormatter errorFormatter) { InvokeDisplayValueFormatter(errorFormatter, sender.ParentNode); UpdateCancelEvaluation(sender); }
private void AddValueFormatter(NuGenIValueFormatter valueFormatter) { GridEXRow addedRow = objectsGrid.AddItem(valueFormatter.Name, valueFormatter.GetFormattedString(NuGenSettings.Instance.DisplayHexaNumbers), id++); NuGenHelperFunctions.TaggedObjects.Add(id, valueFormatter); }
private void ValueDisplayer_EvaluatedNull(NuGenValueDisplayer sender, NuGenIValueFormatter nullValueFormatter) { InvokeDisplayValueFormatter(nullValueFormatter, sender.ParentNode); InvokeStepEvaluationProgress(); UpdateCancelEvaluation(sender); }
private void DisplayValueFormatter(NuGenIValueFormatter valueFormatter) { DisplayValueFormatter(valueFormatter, null); }
private void ValueDisplayer_ArrayElementEvaluated(NuGenValueDisplayer sender, uint elementIndex, NuGenIValueFormatter elementValueFormatter) { InvokeDisplayValueFormatter(elementValueFormatter, sender.ParentNode); InvokeStepEvaluationProgress(); UpdateCancelEvaluation(sender); }