private void btnDel_Click(object sender, EventArgs e) { if (getKindLocal != null) { List <Link> listLink = LinkController.getListLink(kindText); for (int i = 0; i < listLink.Count; i++) { LinkController.deleteLink(listLink[i]); } KindController.deleteKind(getKindLocal); } //show BindingSource source = new BindingSource(); source.DataSource = KindController.getListKind(); this.dataKinds.DataSource = source; }
private void listBoxKind_DoubleClick(object sender, EventArgs e) { if (listBoxKind.SelectedIndex >= 0) { if (listBoxKind.SelectedIndex == 0) { this.listBoxNearOpen.Items.Clear(); List <Note> listNearOpen = NoteController.getListNote(); //sort by time for (int i = 0; i < listNearOpen.Count; i++) { for (int j = listNearOpen.Count - 1; j > i; j--) { if (DateTime.Compare(listNearOpen[j].publishAt.Value, listNearOpen[j - 1].publishAt.Value) < 0) { Note noteTemp = listNearOpen[j]; listNearOpen[j] = listNearOpen[j - 1]; listNearOpen[j - 1] = noteTemp; } } } for (int i = listNearOpen.Count - 1; i >= 0; i--) { listBoxNearOpen.Items.Add(listNearOpen[i].filePath.ToString()); } } else { List <Link> listLink = LinkController.getListLink(listBoxKind.SelectedItem.ToString()); listBoxNearOpen.Items.Clear(); for (int i = 0; i < listLink.Count; i++) { listBoxNearOpen.Items.Add(listLink[i].note); } } } }