/// <summary> /// Event for double clicking a project node. /// </summary> /// <param name="sender">Sending object.</param> /// <param name="e">Tree node mouse event args.</param> private void ProjectExplorerTreeViewNodeMouseDoubleClick(Object sender, TreeNodeAdvMouseEventArgs e) { if (e == null || e.Node == null) { return; } ProjectItem projectItem = this.GetProjectItemFromNode(e.Node); if (projectItem is AddressItem) { ValueEditorModel valueEditor = new ValueEditorModel(); AddressItem addressItem = projectItem as AddressItem; dynamic result = valueEditor.EditValue(null, null, addressItem); if (CheckSyntax.CanParseValue(addressItem.ElementType, result?.ToString())) { addressItem.Value = result; } } else if (projectItem is ScriptItem) { ScriptEditorModel scriptEditor = new ScriptEditorModel(); ScriptItem scriptItem = projectItem as ScriptItem; scriptItem.Script = scriptEditor.EditValue(null, null, scriptItem.Script) as String; } }
/// <summary> /// Edits a project item based on the project item type. /// </summary> /// <param name="projectItem">The project item to edit.</param> private void EditProjectItem(ProjectItem projectItem) { if (projectItem is AddressItem) { ValueEditorModel valueEditor = new ValueEditorModel(); AddressItem addressItem = projectItem as AddressItem; dynamic result = valueEditor.EditValue(null, null, addressItem); if (SyntaxChecker.CanParseValue(addressItem.DataType, result?.ToString())) { addressItem.AddressValue = result; } } else if (projectItem is ScriptItem) { ScriptEditorModel scriptEditor = new ScriptEditorModel(); ScriptItem scriptItem = projectItem as ScriptItem; scriptItem.Script = scriptEditor.EditValue(null, null, scriptItem.Script) as String; } }