Beispiel #1
0
        private void tv_book_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
        {
            //必须清除遗留下的item
            lb_noteList.Items.Clear();
            TreeViewItem selectItem = (TreeViewItem)tv_book.SelectedItem;
            string selectItemName = selectItem.Header.ToString();
            if (selectItemName=="笔记本")
            {
                return;
            }
            gb_note.Header = selectItemName;

            fileOP op = new fileOP();
            List<string> noteNameList=op.traNote(selectItemName);
            for (int i = 0; i < noteNameList.Count;i++ )
            {
                ListBoxItem note = new ListBoxItem();
                note.Content = noteNameList[i];
                lb_noteList.Items.Add(note);
            }

        }
Beispiel #2
0
        private void bt_createNote_Click(object sender, RoutedEventArgs e)
        {
            createNote note = new createNote();
            
            if (tv_book.SelectedItem==null)
            {
                MessageBox.Show("请选择一个笔记本!");
                return;
            }
            TreeViewItem selectItem =(TreeViewItem)tv_book.SelectedItem;
            note.bookName = selectItem.Header.ToString();
            note.ShowDialog();

            lb_noteList.Items.Clear();
            TreeViewItem selectItem2 = (TreeViewItem)tv_book.SelectedItem;
            string selectItemName = selectItem2.Header.ToString();
            gb_note.Header = selectItemName;

            fileOP op = new fileOP();
            List<string> noteNameList = op.traNote(selectItemName);
            for (int i = 0; i < noteNameList.Count; i++)
            {
                ListBoxItem note2 = new ListBoxItem();
                note2.Content = noteNameList[i];
                lb_noteList.Items.Add(note2);
            }

        }