private void byFileTagToolStripMenuItem_Click(object sender, EventArgs e) { if (tvDirBrowser.SelectedNode != null) { timerExtract.Stop(); _foundItems.Clear(); progressBarLoading.Visible = false; frmSearchByInput searchForm = new frmSearchByInput(ref _appS, frmSearchByInput.Mode.Tag, tvDirBrowser.SelectedNode.Name); if (searchForm.ShowDialog() == DialogResult.OK) { progressBarLoading.Visible = true; Cursor.Current = Cursors.WaitCursor; SearchByFileTag(tvDirBrowser.SelectedNode.Name, searchForm.ToFindText); if (_foundItems.Count > 0) { mLabelItemsFound.Text = $"Items Found : {_foundItems.Count}"; UpdateListViewFilesAfterSearchWithTimer(); } else { MessageBox.Show("Nothing found but we tried", "Such a pity", MessageBoxButtons.OK, MessageBoxIcon.Information); progressBarLoading.Visible = false; } Cursor.Current = Cursors.Default; } } }
private void EditTag(string fPath) { if (_appS.Tags.Exists(t => t.Key == fPath)) { var tag = _appS.Tags.Find(i => i.Key == fPath); frmSearchByInput frm = new frmSearchByInput(ref _appS, frmSearchByInput.Mode.EditTag, fPath, tag.Value); if (frm.ShowDialog() == DialogResult.OK) { _appS.Tags.Add(new KeyValuePair <string, string>(tag.Key, frm.ToFindText)); _appS.Tags.Remove(tag); } } else { MessageBox.Show($"{fPath} doesn't have Tags", "Oops", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void AddTag(params string[] tagedItems) { frmSearchByInput frm = new frmSearchByInput(ref _appS, frmSearchByInput.Mode.AddTag, tagedItems.Aggregate((f, s) => f + " " + s)); if (frm.ShowDialog() == DialogResult.OK) { string newTags = frm.ToFindText; foreach (string item in tagedItems) { if (_appS.Tags.Count > 0 && _appS.Tags.Exists(t => t.Key == item)) { int index = _appS.Tags.FindIndex(k => k.Key == item); string oldTags = _appS.Tags[index].Value; _appS.Tags.RemoveAt(index); _appS.Tags.Add(new KeyValuePair <string, string>(item, oldTags + newTags)); } else { _appS.Tags.Add(new KeyValuePair <string, string>(item, newTags)); } } } }