/// <summary> /// 重载dataGridTags的Tag定义 /// </summary> /// <param name="groupName"></param> /// <param name="blockName"></param> private void QueryTags(string groupName, string blockName) { //显示block中的tag点明细 List <Tag> tags = TagConfig.QueryTagsByBlockName <Tag>(groupName, blockName); List <GridTag> list = tags.Select(p => new GridTag { TagName = p.TagName, OpcTagName = p.OpcTagName, TimeStamps = p.TimeStamps, Qualities = p.Qualities, Value = p.Value, Message = p.Message }).ToList(); dataGridTags.DataSource = new BindingList <GridTag>(list); }
//新增tag private void toolTagAdd_Click(object sender, EventArgs e) { chkRefresh.Checked = false; //设置当前选中的节点信息 groupName = treeTags.SelectedNode.Parent.Text; blockName = treeTags.SelectedNode.Text; lblGroup.Text = groupName; lblBlock.Text = blockName; AddTags at = new AddTags(client, groupName, blockName); if (at.ShowDialog() == DialogResult.OK) { //显示block中的tag点明细 List <Tag> tags = TagConfig.QueryTagsByBlockName <Tag>(groupName, blockName); List <GridTag> list = tags.Select(p => new GridTag { TagName = p.TagName, OpcTagName = p.OpcTagName, TimeStamps = p.TimeStamps, Qualities = p.Qualities, Value = p.Value, Message = p.Message }).ToList(); dataGridTags.DataSource = new BindingList <GridTag>(list); isdDtaGridTagsChanged = true; } }