Ejemplo n.º 1
0
        private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;

            if (node != null)
            {
                string clipTags = Clipboard.GetData(DataFormats.UnicodeText).ToString();
                System.IO.StringReader strReader = new System.IO.StringReader(clipTags);
                string tagName = null;
                while ((tagName = strReader.ReadLine()) != null)
                {
                    if (node.Tag.GetType() == typeof(CalModel))
                    {
                        CalModel model = node.Tag as CalModel;
                        if (model != null)
                        {
                            CalTag nTag = model.AddTag(tagName);
                        }
                    }
                    else if (node.Tag.GetType() == typeof(CalOrg))
                    {
                        CalOrg org = node.Tag as CalOrg;
                        if (org != null)
                        {
                            CalTag nTag = org.AddTag(tagName);
                        }
                    }
                }
                strReader.Close();
                bindingSource1.ResetBindings(false);
            }
        }
Ejemplo n.º 2
0
        private void 添加标签_Click(object sender, EventArgs e)
        {
            TreeNode node = this.treeView1.SelectedNode;

            if (node != null)
            {
                NameDialog dialog = new NameDialog();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (node.Tag.GetType() == typeof(CalModel))
                    {
                        CalModel model = node.Tag as CalModel;
                        if (model != null)
                        {
                            model.AddTag(dialog.Result);
                        }
                    }
                    else if (node.Tag.GetType() == typeof(CalOrg))
                    {
                        CalOrg org = node.Tag as CalOrg;
                        if (org != null)
                        {
                            org.AddTag(dialog.Result);
                        }
                    }
                    bindingSource1.ResetBindings(false);
                }
            }
        }