コード例 #1
0
        private void DisplayNote()
        {
            flowNoteList.Controls.Clear();
            List <Note> displayList;

            switch (currentTag)
            {
            case "All Notes":
                displayList = NoteSorting.getAllNotes(NoteList, sort)
                              .Where(x => x.ContentText.Contains(txtSearch.Text)).ToList();
                break;

            case "Delete":
                displayList = NoteSorting.getDeletedNotes(NoteList, sort)
                              .Where(x => x.ContentText.Contains(txtSearch.Text)).ToList();
                break;

            default:
                displayList = NoteSorting.getNotesWithTag(NoteList, sort, currentTag)
                              .Where(x => x.ContentText.Contains(txtSearch.Text)).ToList();
                break;
            }
            foreach (var note in displayList)
            {
                flowNoteList.Controls.Add(note);
            }
            if (displayList.Count == 0)
            {
                txtMain.Visible = false;
                if (!flowNoteList.Controls.Contains(lblNoNote))
                {
                    flowNoteList.Controls.Add(lblNoNote);
                }
            }
            if (displayList.Count > 0)
            {
                if (!txtMain.Visible)
                {
                    txtMain.Visible = true;
                    flowTag.Visible = true;
                    if (currentTag != "Delete")
                    {
                        foreach (Control control in pnlSubmenu2.Controls)
                        {
                            control.Visible = true;
                        }
                        pnlDelete.Visible = false;
                    }
                    else
                    {
                        foreach (Control control in pnlSubmenu2.Controls)
                        {
                            control.Visible = false;
                        }
                        pnlDelete.Visible = true;
                    }
                }
                NoteClick(flowNoteList.Controls[0] as Note);
            }
        }
コード例 #2
0
 private void move()
 {
     if (sort != "created")
     {
         int index = NoteSorting.getNoteIndex(NoteList, currentNote, sort);
         flowNoteList.Controls.SetChildIndex(currentNote, index);
     }
 }
コード例 #3
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            if (txtSearch.Text != "")
            {
                txtSearch.Text = "";
            }
            Note note = new Note();

            NoteList.Insert(0, note);
            note.Click += Note_Click;
            note.check.CheckedChanged += Check_CheckedChanged;
            if (txtSearch.watermark != "All Notes" && txtSearch.watermark != "Delete")
            {
                note.tags.Add(currentTag);
            }
            if (flowNoteList.Controls.Contains(lblNoNote))
            {
                flowNoteList.Controls.Remove(lblNoNote);
            }
            flowNoteList.Controls.Add(note);
            note.BringToFront();
            if (currentTag == "All Notes")
            {
                flowNoteList.Controls.SetChildIndex(note,
                                                    NoteSorting.getNoteIndex(NoteList, note, sort));
            }
            else
            {
                flowNoteList.Controls.SetChildIndex(note,
                                                    NoteSorting.getNoteIndex(NoteList, note, sort, currentTag));
            }
            NoteClick(note);
            txtMain.Visible = true;
            flowTag.Visible = true;
            foreach (Control control in pnlSubmenu2.Controls)
            {
                control.Visible = true;
            }
            pnlDelete.Visible = false;
        }