Beispiel #1
0
        public MainWindow()
        {
            InitializeComponent();

            MouseLeftButtonDown += (o, args) =>
            {
                var hwnd = new WindowInteropHelper(this).Handle;
                ReleaseCapture();
                SendMessage(hwnd, WM_NCLBUTTONDOWN, HT_CAPTION, 0);
            };

            fileOP createDir = new fileOP();
            createDir.createFileRootDir("CarpNote");

            List<string> bookNameList = createDir.traBook();

            for (int i = 0; i < bookNameList.Count;i++ )
            {
                TreeViewItem tvi = new TreeViewItem();
                tvi.Header=bookNameList[i].ToString();
                tv_book_book.Items.Add(tvi);
            }

            ConfigXML userInfo = new ConfigXML();
            UserName = userInfo.getUserID();
            UserPW = userInfo.getUserPW();

        }
Beispiel #2
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            fileOP userDir = new fileOP();
            userDir.createFileDir(textBox1.Text.ToString());

            bookName = textBox1.Text.ToString();

            this.Close();
        }
Beispiel #3
0
        private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text.ToString()==null)
            {
                MessageBox.Show("请输入笔记本名称!");
                return;
            }
            fileOP noteCreate = new fileOP();
            noteCreate.createNoteFile(bookName, textBox1.Text.ToString());

            this.Close();
        }
Beispiel #4
0
        /// <summary>
        /// 笔记本的逻辑存在一定问题
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        private void lb_noteList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            TreeViewItem selectItem = (TreeViewItem)tv_book.SelectedItem;
            string selectItemName = selectItem.Header.ToString();//笔记本名称

            fileOP op = new fileOP();

            if (firstEnterBook != true && noteUse.Content.ToString() != null)
            {
                string lastUseNote = noteUse.Content.ToString();
                op.writeToNote(selectItemName, lastUseNote,htmlEditor.ContentHtml.ToString());
            }
            
            if (focusLost==false)
            {
                firstEnterBook = true;
                focusLost = true;

               // return;
            }

            if (lb_noteList.SelectedIndex==-1)
            {
                return;

            }

            noteUse = (ListBoxItem)lb_noteList.SelectedItems[0];
            string noteUseFileName = noteUse.Content.ToString();//笔记名称

            string fileContent = op.readToNote(selectItemName, noteUseFileName);
            htmlEditor.ContentHtml = fileContent;//为编辑框添加内容

            firstEnterBook = false;

        }
Beispiel #5
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 #6
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);
            }

        }