private void BtnClearSelectedKeys_Click(object sender, EventArgs e) { if (this.InvokeRequired) { DelegateDisplayNodeSelectionResult inv = new DelegateDisplayNodeSelectionResult(this.DisplayNodeSelectionResult); this.Invoke(inv, new object[] { sender, e }); } else { Cursor.Current = Cursors.WaitCursor; string msg = "Please select single or multible key's you wish to delete" + Environment.NewLine; ListBox.SelectedObjectCollection coll = this.LbxNodeKey.SelectedItems; if (coll.Count > 0) { List <string> keysToDelete = new List <string>(); foreach (Common.ComboBoxItem node in coll) { if (!string.IsNullOrEmpty(node.Name)) { keysToDelete.Add(node.Name); } } CACHE.SharedCache.MultiDelete(keysToDelete); List <string> a = CACHE.SharedCache.GetAllKeys(); if (a != null && a.Count > 0) { foreach (string key in keysToDelete) { CACHE.SharedCache.Remove(key); } } this.FullResetForm(); this.UpdateLblAmount(); this.BindStats(); MessageBox.Show("All requested key(s) have been successfully deleted.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show(msg, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } Cursor.Current = Cursors.Default; } }
private void DisplayNodeSelectionResult(object sender, EventArgs e) { if (this.InvokeRequired) { DelegateDisplayNodeSelectionResult inv = new DelegateDisplayNodeSelectionResult(this.DisplayNodeSelectionResult); this.Invoke(inv, new object[] { sender, e }); } else { Cursor.Current = Cursors.WaitCursor; string msg = "Selected node(s) does not contain any key's." + Environment.NewLine; int nodeCounter = 1; if (this.LbxNodeKey.Items.Count > 0) { this.LbxNodeKey.Items.Clear(); } ListBox.SelectedObjectCollection coll = this.LbxServerNodes.SelectedItems; foreach (Common.ComboBoxItem node in coll) { List <string> items = CACHE.SharedCache.GetAllKeys(node.Name); if (items.Count == 0) { msg += Environment.NewLine + nodeCounter.ToString() + " - [ " + node + " ]"; nodeCounter++; } foreach (string key in items) { this.LbxNodeKey.Items.Add(new Common.ComboBoxItem(key, -1)); } } this.LbxNodeKey.Sorted = true; if (this.LbxNodeKey.Items.Count == 0) { MessageBox.Show(msg, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Cursor.Current = Cursors.Default; this.UpdateLblAmount(); this.UpdateLblAmount(); this.BindStats(); } }
private void BtnClearSelectedKeys_Click(object sender, EventArgs e) { if (this.InvokeRequired) { DelegateDisplayNodeSelectionResult inv = new DelegateDisplayNodeSelectionResult(this.DisplayNodeSelectionResult); this.Invoke(inv, new object[] { sender, e }); } else { Cursor.Current = Cursors.WaitCursor; string msg = "Please select single or multible key's you wish to delete" + Environment.NewLine; ListBox.SelectedObjectCollection coll = this.LbxNodeKey.SelectedItems; if (coll.Count > 0) { List<string> keysToDelete = new List<string>(); foreach (Common.ComboBoxItem node in coll) { if (!string.IsNullOrEmpty(node.Name)) { keysToDelete.Add(node.Name); } } CACHE.SharedCache.MultiDelete(keysToDelete); List<string> a = CACHE.SharedCache.GetAllKeys(); if (a != null && a.Count > 0) { foreach (string key in keysToDelete) { CACHE.SharedCache.Remove(key); } } this.FullResetForm(); this.UpdateLblAmount(); this.BindStats(); MessageBox.Show("All requested key(s) have been successfully deleted.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } else { MessageBox.Show(msg, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); } Cursor.Current = Cursors.Default; } }
private void DisplayNodeSelectionResult(object sender, EventArgs e) { if (this.InvokeRequired) { DelegateDisplayNodeSelectionResult inv = new DelegateDisplayNodeSelectionResult(this.DisplayNodeSelectionResult); this.Invoke(inv, new object[] { sender, e }); } else { Cursor.Current = Cursors.WaitCursor; string msg = "Selected node(s) does not contain any key's." + Environment.NewLine; int nodeCounter = 1; if(this.LbxNodeKey.Items.Count > 0) this.LbxNodeKey.Items.Clear(); ListBox.SelectedObjectCollection coll = this.LbxServerNodes.SelectedItems; foreach (Common.ComboBoxItem node in coll) { List<string> items = CACHE.SharedCache.GetAllKeys(node.Name); if (items.Count == 0) { msg += Environment.NewLine +nodeCounter.ToString()+ " - [ " + node + " ]"; nodeCounter++; } foreach (string key in items) { this.LbxNodeKey.Items.Add(new Common.ComboBoxItem(key, -1)); } } this.LbxNodeKey.Sorted = true; if (this.LbxNodeKey.Items.Count == 0) { MessageBox.Show(msg, "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } Cursor.Current = Cursors.Default; this.UpdateLblAmount(); this.UpdateLblAmount(); this.BindStats(); } }