private void IniData() { DataView dClass = new DataView(); int i = 0; cDict d = new cDict(); TreeNode newNode; dClass = d.GetDictClass(); for (i = 0; i < dClass.Count; i++) { newNode = new TreeNode(); newNode.Name = "C" + i.ToString(); newNode.Text = dClass[i].Row["Name"].ToString(); newNode.ImageIndex = 1; newNode.SelectedImageIndex = 1; this.treeDict.Nodes["nodDict"].Nodes.Add(newNode); newNode = null; } dClass = null; this.treeDict.Nodes["nodDict"].Expand(); //设置默认选择的树形结构节点为“正在运行” TreeNode SelectNode = new TreeNode(); SelectNode = this.treeDict.Nodes["nodDict"]; this.treeDict.SelectedNode = SelectNode; SelectNode = null; d = null; }
//修改字典内容 private void listDict_AfterLabelEdit(object sender, LabelEditEventArgs e) { if (e.Label == null) { //表示没有进行修改 this.listDict.Items.Remove(this.listDict.Items[e.Item]); this.listDict.LabelEdit = false; return; } if (e.Label.ToString().Trim() == "") { e.CancelEdit = true; this.listDict.Items.Remove(this.listDict.Items[e.Item]); this.listDict.LabelEdit = false; return; } try { cDict d = new cDict(); d.AddDict(this.treeDict.SelectedNode.Text, e.Label.ToString()); d = null; this.listDict.LabelEdit = false; } catch (System.Exception ex) { MessageBox.Show(rm.GetString("Info78") + ex.Message, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Error); e.CancelEdit = true; } }
private void treeDict_AfterSelect(object sender, TreeViewEventArgs e) { DataView dName; ListViewItem item; int i = 0; this.listDict.Items.Clear(); if (this.treeDict.SelectedNode.Name == "nodDict") { return; } cDict d = new cDict(); dName = d.GetDict(this.treeDict.SelectedNode.Text); d = null; if (dName == null) { return; } for (i = 0; i < dName.Count; i++) { item = new ListViewItem(); item.Text = dName[i].Row["Name"].ToString(); this.listDict.Items.Add(item); } dName = null; }
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) { this.contextMenuStrip1.Items.Clear(); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu1") + "{Num:1,100,1}", null, null, "rmenuAddNum")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu2") + "{Num:100,1,-1}", null, null, "rmenuDegreNum")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu3") + "{Letter:a,z}", null, null, "rmenuAddLetter")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu4") + "{Letter:z,a}", null, null, "rmenuDegreLetter")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu5") + "<POST>", null, null, "rmenuPostPrefix")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu6") + "</POST>", null, null, "rmenuPostSuffix")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString("rmenu7"), null, null, "rmenuGetPostData")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); //初始化字典菜单的项目 cDict d = new cDict(); int count = d.GetDictClassCount(); for (int i = 0; i < count; i++) { this.contextMenuStrip1.Items.Add(rm.GetString("rmenu8") + ":{Dict:" + d.GetDictClassName(i).ToString() + "}"); } }
private void DelDictContent() { if (this.listDict.Items.Count == 0 || this.listDict.SelectedItems.Count == 0) { MessageBox.Show(rm.GetString("Info80"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show(rm.GetString("Delete") + "“" + this.listDict.SelectedItems[0].Text + "”?" + rm.GetString("Quaere22"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cDict d = new cDict(); d.DelDict(this.treeDict.SelectedNode.Text, this.listDict.SelectedItems[0].Text.ToString()); d = null; this.listDict.Items.Remove(this.listDict.SelectedItems[0]); } }
private void DelDictClass() { if (this.treeDict.SelectedNode.Name == "nodDict") { MessageBox.Show(rm.GetString("Info79"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show(rm.GetString("Delete") + "“" + this.treeDict.SelectedNode.Text + "”?" + rm.GetString("Quaere21"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cDict d = new cDict(); d.DelDictClass(this.treeDict.SelectedNode.Text); d = null; this.treeDict.Nodes.Remove(this.treeDict.SelectedNode); } }
private void DelDictClass() { if (this.treeDict.SelectedNode.Name == "nodDict") { MessageBox.Show(rm.GetString("Info79"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show(rm.GetString("Delete") + "��" + this.treeDict.SelectedNode.Text + "����" + rm.GetString ("Quaere21"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cDict d = new cDict(); d.DelDictClass(this.treeDict.SelectedNode.Text); d = null; this.treeDict.Nodes.Remove(this.treeDict.SelectedNode); } }
private void treeDict_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Node.Text == "nodDict" || e.Label == null) { this.treeDict.Nodes.Remove(e.Node); this.treeDict.LabelEdit = false; return; } if (e.Label.ToString().Trim() == "") { this.treeDict.Nodes.Remove(e.Node); return; } cDict d = new cDict(); d.AddDictClass(e.Label.ToString()); d = null; this.treeDict.LabelEdit = false; }
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) { this.contextMenuStrip1.Items.Clear(); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu1") + "{Num:1,100,1}", null, null, "rmenuAddNum")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu2") + "{Num:100,1,-1}",null,null,"rmenuDegreNum")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu3") + "{Letter:a,z}",null,null ,"rmenuAddLetter")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu4") + "{Letter:z,a}",null ,null ,"rmenuDegreLetter")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu5") + "<POST>",null,null,"rmenuPostPrefix")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu6") + "</POST>", null, null, "rmenuPostSuffix")); this.contextMenuStrip1.Items.Add(new ToolStripMenuItem(rm.GetString ("rmenu7"), null, null, "rmenuGetPostData")); this.contextMenuStrip1.Items.Add(new ToolStripSeparator()); //��ʼ���ֵ�˵�����Ŀ cDict d = new cDict(); int count = d.GetDictClassCount(); for (int i = 0; i < count; i++) { this.contextMenuStrip1.Items.Add(rm.GetString ("rmenu8") + ":{Dict:" + d.GetDictClassName(i).ToString() + "}"); } }
private void DelDictContent() { if (this.listDict.Items.Count == 0 || this.listDict.SelectedItems.Count ==0) { MessageBox.Show(rm.GetString ("Info80"), rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (MessageBox.Show(rm.GetString("Delete") + "��" + this.listDict.SelectedItems[0].Text + "����" + rm.GetString("Quaere22"), rm.GetString("MessageboxQuaere"), MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { cDict d = new cDict(); d.DelDict(this.treeDict.SelectedNode.Text, this.listDict.SelectedItems[0].Text.ToString()); d = null; this.listDict.Items.Remove(this.listDict.SelectedItems[0]); } }
private void treeDict_AfterSelect(object sender, TreeViewEventArgs e) { DataView dName; ListViewItem item; int i = 0; this.listDict.Items.Clear(); if (this.treeDict.SelectedNode.Name =="nodDict") { return ; } cDict d = new cDict(); dName = d.GetDict(this.treeDict.SelectedNode.Text ); d = null; if (dName == null) { return; } for (i = 0; i < dName.Count; i++) { item = new ListViewItem(); item.Text = dName[i].Row["Name"].ToString(); this.listDict.Items.Add(item); } dName = null; }
private void treeDict_AfterLabelEdit(object sender, NodeLabelEditEventArgs e) { if (e.Node.Text == "nodDict" || e.Label == null) { this.treeDict.Nodes.Remove(e.Node); this.treeDict.LabelEdit = false; return; } if (e.Label.ToString().Trim() == "") { this.treeDict.Nodes.Remove(e.Node); return; } cDict d = new cDict(); d.AddDictClass(e.Label .ToString ()); d = null; this.treeDict.LabelEdit = false; }
//���ֵ����� private void listDict_AfterLabelEdit(object sender, LabelEditEventArgs e) { if (e.Label == null) { //��ʾû�н����� this.listDict.Items.Remove(this.listDict.Items[e.Item]); this.listDict.LabelEdit = false; return; } if (e.Label.ToString().Trim() == "") { e.CancelEdit = true; this.listDict.Items.Remove(this.listDict.Items[e.Item]); this.listDict.LabelEdit = false; return; } try { cDict d = new cDict(); d.AddDict(this.treeDict.SelectedNode.Text,e.Label.ToString ()); d = null; this.listDict.LabelEdit = false; } catch (System.Exception ex) { MessageBox.Show(rm.GetString("Info78") + ex.Message, rm.GetString("MessageboxInfo"), MessageBoxButtons.OK, MessageBoxIcon.Error); e.CancelEdit = true; } }
private void IniData() { DataView dClass = new DataView(); int i = 0; cDict d = new cDict(); TreeNode newNode; dClass = d.GetDictClass(); for (i = 0; i < dClass.Count; i++) { newNode = new TreeNode(); newNode.Name = "C" + i.ToString(); newNode.Text = dClass[i].Row["Name"].ToString(); newNode.ImageIndex = 1; newNode.SelectedImageIndex = 1; this.treeDict.Nodes["nodDict"].Nodes.Add(newNode); newNode = null; } dClass = null; this.treeDict.Nodes["nodDict"].Expand(); //����Ĭ��ѡ������νṹ�ڵ�Ϊ���������С� TreeNode SelectNode = new TreeNode(); SelectNode = this.treeDict.Nodes["nodDict"]; this.treeDict.SelectedNode = SelectNode; SelectNode = null; d = null; }