private void button1_Click(object sender, EventArgs e) { Dictionary <string, Dictionary <string, string> > folder = Program.getFolder(); if (comboBox1.Text != String.Empty) { string title = textBox1.Text; string foldername = comboBox1.Text.ToString(); if (foldername == "书签栏") { form.addbook(title, url); } else { if (!folder.ContainsKey(foldername))//若文件夹不存在则创建后添加书签 { Dictionary <string, string> temp = new Dictionary <string, string>(); temp.Add(title, url); // folder.Add(foldername, temp); Program.setFolder(foldername, temp); } else//若文件夹存在则将书签加入相应文件夹 { Dictionary <string, string> temp = Program.getfolderbook(foldername); if (!temp.ContainsKey(title)) { temp.Add(title, url); Program.setFolder(foldername, temp); } else { MessageBox.Show("已存在"); } } } } form.addBookMark(); this.Dispose(); }