Esempio n. 1
0
        //pin note len tren dau, note.isPin chuyen tu false sang true
        //nguoc lai, note.isPin chuyen tu true sang false
        //neu co nhieu note duoc pin se sap xep theo thu tu
        private void btnPin_Click(object sender, EventArgs e)
        {
            try
            {
                int  i    = this.lv.SelectedItems[0].Index;
                int  id   = idtemp[i];
                Note note = NoteControllers.getANote(id);
                if (note.isPin == false)
                {
                    note.isPin = true;
                }
                else
                {
                    note.isPin = false;
                }

                NoteControllers.UpdateNote(note);
                displayAllNotes();

                int j = 0;
                while (j < idtemp.Count)
                {
                    if (idtemp[j] == note.Id)
                    {
                        break;
                    }
                    j++;
                }
                this.lv.Items[j].Selected = true;
                this.lv.Select();
            }
            catch
            {
            }
        }
Esempio n. 2
0
        //khoi phuc note tu Trash tro lai All Notes, note.isTrash chuyen tu true sang false
        private void btnRestore_Click(object sender, EventArgs e)
        {
            try
            {
                int  i    = this.lv.SelectedItems[0].Index;
                int  id   = idtemp[i];
                Note note = NoteControllers.getANote(id);
                note.isTrash = false;

                NoteControllers.UpdateNote(note);
                displayTrash();

                this.rtb.Clear();
                this.rtb1.Clear();
                this.lbInfo.Text = "";
            }
            catch
            {
            }
        }
Esempio n. 3
0
        //viet hoac thay doi note.content khi o che do All Notes
        //khong the lam dieu tuong tu khi o che do Trash
        private void rtb_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (mode == true)
                {
                    int  i    = this.lv.SelectedItems[0].Index;
                    int  id   = idtemp[i];
                    Note note = NoteControllers.getANote(id);

                    string old_Content = note.Content;

                    note.Content = this.rtb.Text.ToString();

                    note.Tittle = note.Content.Substring(0, getfirstline(note.Content));
                    if (note.Content != old_Content)
                    {
                        this.lbInfo.Text = "";
                        note.Info        = DateTime.Now;
                    }
                    if (note.Content == "")
                    {
                        note.Tittle = "New note";
                    }

                    NoteControllers.UpdateNote(note);

                    this.lv.SelectedItems[0].Text = note.Tittle.ToString();
                }
                else
                {
                    return;
                }
            }
            catch
            {
            }
        }