Пример #1
0
 private void CopyEntry()
 {
     //MessageBox.Show("copy");
     if (SelectedNode.Level == 1)
     {
         foreach (KeyValuePair <string, List <AutisticData> > pair in CurrentData)
         {
             foreach (AutisticData d in pair.Value)
             {
                 if (d.EntryName == SelectedNode.Text)
                 {
                     CurrentCopy           = ObjectCopier.Clone(d);
                     CurrentCopy.EntryName = CurrentCopy.EntryName + " (copy)";
                     break;
                 }
             }
         }
     }
     else
     {
         MessageBox.Show("Cannot copy folders!");
     }
 }
Пример #2
0
        protected void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (SelectedNode == null)
            {
                SelectedNode = e.Node;
            }
            else
            {
                //save text to dictionary entry
                if (SelectedNode.Level == 1 && SelectedNode != e.Node)
                {
                    foreach (KeyValuePair <string, List <AutisticData> > pair in CurrentData)
                    {
                        foreach (AutisticData d in pair.Value)
                        {
                            if (d.EntryName == SelectedNode.Text)
                            {
                                d.EntryName = richTextBox1.Text;
                                d.Source    = richTextBox2.Text;
                                d.Author    = richTextBox5.Text;
                                d.Keywords  = richTextBox4.Text;
                                d.RealName  = richTextBox7.Text;
                                d.DateAdded = richTextBox6.Text;
                                d.Notes     = richTextBox3.Text;
                                Console.WriteLine("Saved textboxes to dictionary");
                            }
                        }
                    }
                }
            }

            SelectedNode = e.Node;

            //load text from dictionary
            if (e.Node.Level == 1)
            {
                button3.Enabled = false;
                button4.Enabled = true;
                //AutisticData data = GetEntryFromName(e.Node.Text);
                AutisticData data = GetEntry(SelectedNode.Parent.Text, e.Node.Index);
                richTextBox1.Text = data.EntryName; //entry name
                richTextBox2.Text = data.Source;    //source
                richTextBox5.Text = data.Author;    //authors
                richTextBox4.Text = data.Keywords;  //keywords
                richTextBox7.Text = data.RealName;  //real name
                richTextBox6.Text = data.DateAdded; //date added
                richTextBox3.Text = data.Notes;     //notes
            }
            else
            {
                button3.Enabled   = true;
                button4.Enabled   = false;
                richTextBox1.Text = ""; //entry name
                richTextBox2.Text = ""; //source
                richTextBox5.Text = ""; //authors
                richTextBox4.Text = ""; //keywords
                richTextBox7.Text = ""; //real name
                richTextBox6.Text = ""; //date added
                richTextBox3.Text = ""; //notes
            }
            treeView1.ExpandAll();
        }