//! Event Handler for click events for ListBox of folders private void ListBox_Folders_Click_Events(object sender, MouseEventArgs e) { var tagIndexFromPoint = listBox_Folders.IndexFromPoint(e.Location); if (e.Button != MouseButtons.Right) { if (tagIndexFromPoint == ListBox.NoMatches) { listView_folder.SelectedItems.Clear(); return; } return; } if (tagIndexFromPoint != ListBox.NoMatches) { var selectedItem = listBox_Folders.Items[tagIndexFromPoint].ToString(); if (_listViewItemSelectionList.Count > 0) { PopupWindows.ShowContextMenu(listBox_Folders, e.Location, _session.Tags.Find(x => x.TagName == selectedItem), _session.OpenedTag, _session, _listViewItemSelectionList); } else { PopupWindows.ShowContextMenu(listBox_Tags, e.Location, _session.Tags.Find(x => x.TagName == selectedItem), _session, _listViewItemSelectionList); } } }
//! Event Handler for a button to add a new tag private void Button_new_tag_click(object sender, EventArgs e) { var promptValue = PopupWindows.ShowTextInputDialog("Enter Tag Name", "Add New Tag"); if (_session.Tags.Find(x => x.TagName == promptValue) == null) { listBox_Tags.Items.Add(promptValue); _session.NewTag(promptValue); } else { PopupWindows.ShowDuplicateWarning(promptValue); } }