Exemplo n.º 1
0
        private void newNoteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (StateofMenu == false)
            {
                return;
            }

            this.listViewNoiDung.SelectedIndices.Clear();

            this.lbInfo.Text = "";

            this.rtbTypeNoiDung.Clear();
            this.rtbShowTag.Clear();
            this.rtbred.Clear();
            this.txbSearch.Text = "";

            Note getnote = new Note();

            getnote.SoThuTu  = NoteControllers.getIdFromDb();
            getnote.TieuDe   = "New note";
            getnote.NoiDung  = "";
            getnote.ThongTin = DateTime.Now;
            getnote.Rac      = false;
            getnote.PintoTop = false;

            NoteControllers.addNote(getnote);
            showNotes();

            int stt = 0;

            while (stt < idList.Count)
            {
                if (idList[stt] == getnote.SoThuTu)
                {
                    break;
                }
                stt++;
            }

            this.listViewNoiDung.Items[stt].Selected = true;
            this.listViewNoiDung.Select();
            this.rtbTypeNoiDung.Text = NoteControllers.getNote(getnote.SoThuTu).NoiDung;
            this.rtbTypeNoiDung.Focus();
        }
Exemplo n.º 2
0
        //tao note moi
        private void btnNewNote_Click(object sender, EventArgs e)
        {
            //neu o che do Trash, khong the tao note moi
            if (mode == false)
            {
                return;
            }

            this.lv.SelectedIndices.Clear();
            this.lbInfo.Text = "";
            this.rtb.Clear();
            this.rtb1.Clear();
            this.txbFind.Text = "";

            //tao note moi voi note.content trong truoc
            //nguoi dung se thay doi noi dung bang cach viet vao richtextbox rtb
            Note note = new Note();

            note.Id      = NoteControllers.getIdFromDb();
            note.Tittle  = "New note";
            note.Content = "";
            note.Info    = DateTime.Now;
            note.isTrash = false;
            note.isPin   = false;

            NoteControllers.AddNote(note);
            displayAllNotes();

            int i = 0;

            while (i < idtemp.Count)
            {
                if (idtemp[i] == note.Id)
                {
                    break;
                }
                i++;
            }
            this.lv.Items[i].Selected = true;
            this.lv.Select();
            this.rtb.Text = NoteControllers.getANote(note.Id).Content;
            this.rtb.Focus();
        }