private void gridEdit_Click(object sender, EventArgs e) { EditValue addValue = new EditValue(treeViewRegistery.SelectedNode.FullPath, gridValues.SelectedRows[0].Cells[0].Value.ToString()); DialogResult result = addValue.ShowDialog(); if (result == DialogResult.OK) { BindValues(treeViewRegistery.SelectedNode); } else { MessageBox.Show("عملیات توسط کاربر لغو شد.", "ویرایش", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
void OnWriteDataClick(object sender, EventArgs e) { NodeData data = (NodeData)(sender as ToolStripItem).Tag; EditValue ev = new EditValue(data); DialogResult r = ev.ShowDialog(); if (r == DialogResult.OK) { if (data != null && data.GetIedNode() != null && data.GetIedNode().SCLServerRunning != null) { data.GetIedNode().SCLServerRunning.UpdateServerData(data, null, false, ev.TimeNode, ev.UpdateTimestamp); } } }
void OnWriteDataClick(object sender, EventArgs e) { NodeData data = (NodeData)(sender as ToolStripItem).Tag; NodeData newdata = Iec61850Controller.PrepareWriteData(data); EditValue ev = new EditValue(newdata); ev.HideUpdateTimestamp(); DialogResult r = ev.ShowDialog(); if (r == DialogResult.OK) { data.DataValue = newdata.DataValue; ctrl.WriteData(data, true); } }
internal static void AddTagToNode(TreeNode node, int descriptionIndex, TagType type) { TagNode tag = GetTagNode(node); if (tag == null) return; if (tag.GetTagType() != TagType.TAG_COMPOUND && tag.GetTagType() != TagType.TAG_LIST) return; if (tag.GetTagType() == TagType.TAG_LIST && tag.ToTagList().ValueType != type && tag.ToTagList().Count > 0) return; TagNode newNode = null; switch (type) { case TagType.TAG_BYTE: newNode = new TagNodeByte(); break; case TagType.TAG_SHORT: newNode = new TagNodeShort(); break; case TagType.TAG_INT: newNode = new TagNodeInt(); break; case TagType.TAG_LONG: newNode = new TagNodeLong(); break; case TagType.TAG_FLOAT: newNode = new TagNodeFloat(); break; case TagType.TAG_DOUBLE: newNode = new TagNodeDouble(); break; case TagType.TAG_BYTE_ARRAY: newNode = new TagNodeByteArray(); break; case TagType.TAG_STRING: newNode = new TagNodeString(); break; case TagType.TAG_LIST: newNode = new TagNodeList(TagType.TAG_BYTE); break; case TagType.TAG_COMPOUND: newNode = new TagNodeCompound(); break; case TagType.TAG_INT_ARRAY: newNode = new TagNodeIntArray(); break; } if (tag is TagNodeCompound) { TagNodeCompound ctag = tag as TagNodeCompound; EditValue form = new EditValue(""); foreach (string key in ctag.Keys) { form.InvalidNames.Add(key); } if (form.ShowDialog() != DialogResult.OK) return; ctag.Add(form.NodeName, newNode); TreeNode tnode = NodeFromTag(newNode, descriptionIndex, form.NodeName); node.Nodes.Add(tnode); tnode.TreeView.SelectedNode = tnode; tnode.Expand(); } else if (tag is TagNodeList) { var ltag = tag as TagNodeList; if (ltag.ValueType != type) ltag.ChangeValueType(type); ltag.Add(newNode); TreeNode tnode = NodeFromTag(newNode, descriptionIndex); node.Nodes.Add(tnode); tnode.TreeView.SelectedNode = tnode; tnode.Expand(); } node.Text = GetNodeText(node); TreeNode baseNode = BaseNode(node); if (baseNode != null) { (baseNode.Tag as DataNode).Modified = true; } }
internal static void EditNodeValue(TreeNode node) { if (node == null) return; TagNode tag = GetTagNode(node); if (tag == null) return; if (tag.GetTagType() == TagType.TAG_BYTE_ARRAY || tag.GetTagType() == TagType.TAG_LIST || tag.GetTagType() == TagType.TAG_COMPOUND) return; EditValue form = new EditValue(tag); if (form.ShowDialog() == DialogResult.OK) { TreeNode baseNode = BaseNode(node); if (baseNode != null) { (baseNode.Tag as DataNode).Modified = true; } node.Text = GetNodeText(node); } }
internal static void EditNodeName(TreeNode node) { if (node == null) return; TagNode tag = GetTagNode(node); if (tag == null) return; string name = GetTagNodeName(node); if (name == null) return; var form = new EditValue(name); var parentTag = GetParentTagNode(node); foreach (string key in parentTag.ToTagCompound().Keys) { form.InvalidNames.Add(key); } if (form.ShowDialog() == DialogResult.OK) { TreeNode baseNode = BaseNode(node); if (baseNode != null) { (baseNode.Tag as DataNode).Modified = true; } SetTagNodeName(node, form.NodeName); node.Text = GetNodeText(node); } }