Beispiel #1
0
        private void btnClassification_Click(object sender, EventArgs e)
        {
            if (this.lvDatFiles.SelectedIndices.Count == 0)
            {
                MessageBox.Show(this, "Select dat files first!");
            }

            string oldClassification = this.lvDatFiles.SelectedItems[0].SubItems.Count >= 3
                                   ? this.lvDatFiles.SelectedItems[0].SubItems[2].Text
                                   : "";
            var form = new InputTextForm(null, "Classification", "Input classification", "Classification", oldClassification,
                                         false);

            if (form.ShowDialog() == DialogResult.OK)
            {
                foreach (ListViewItem item in this.lvDatFiles.SelectedItems)
                {
                    while (item.SubItems.Count < 3)
                    {
                        item.SubItems.Add("");
                    }
                    item.SubItems[2].Text = form.Value.Trim();
                }
            }
        }
        private void btnMerge_Click(object sender, EventArgs e)
        {
            if (tvClassifications.SelectedNodes.Count <= 1)
            {
                return;
            }

            List <TreeNode> selectedNodes = new List <TreeNode>();

            foreach (TreeNode node in tvClassifications.SelectedNodes)
            {
                selectedNodes.Add(node);
            }

            using (InputTextForm form = new InputTextForm(null, null, "Input classification name", "Classification name", selectedNodes[0].Text, false))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    List <string> experimentals = new List <string>();
                    selectedNodes.ForEach(node =>
                    {
                        for (int i = 0; i < node.Nodes.Count; i++)
                        {
                            experimentals.Add(node.Nodes[i].Text);
                        }
                    });
                    experimentals.Sort();

                    for (int i = 1; i < selectedNodes.Count; i++)
                    {
                        tvClassifications.Nodes.Remove(selectedNodes[i]);
                    }

                    selectedNodes[0].Text = form.Value;
                    selectedNodes[0].Nodes.Clear();

                    experimentals.ForEach(m => selectedNodes[0].Nodes.Add(m));
                }
            }
        }
        private void btnRename_Click(object sender, EventArgs e)
        {
            if (tvClassifications.SelectedNode == null)
            {
                return;
            }

            using (InputTextForm form = new InputTextForm(null, null, "Input classification name", "Classification name", tvClassifications.SelectedNode.Text, false))
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    tvClassifications.BeginUpdate();
                    try
                    {
                        tvClassifications.SelectedNode.Text = form.Value;
                    }
                    finally
                    {
                        tvClassifications.EndUpdate();
                    }
                }
            }
        }
Beispiel #4
0
        private void btnAddTag_Click(object sender, EventArgs e)
        {
            if (lvDirectories.SelectedItems.Count == 0)
            {
                return;
            }

            var form = new InputTextForm(null, null, "Input group name", "Input group name", "", false);

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                foreach (ListViewItem item in lvDirectories.SelectedItems)
                {
                    if (item.SubItems.Count == 1)
                    {
                        item.SubItems.Add(form.Value);
                    }
                    else
                    {
                        item.SubItems[1].Text = form.Value;
                    }
                }
            }
        }