private void deleteRule_Click(object sender, RoutedEventArgs e) { var rule = (Rule)listRules.SelectedItem; ruleManager = new RuleManager(); ruleManager.DeleteRule(rule); UpdateRule?.Invoke(); }
void bwDelete_DoWork(object sender, DoWorkEventArgs e) { var deletedItems = new List <ListViewItem>(); var rm = new RuleManager(entityName, service); foreach (ListViewItem item in (ListView.SelectedListViewItemCollection)e.Argument) { var rule = (Entity)item.Tag; rm.DeleteRule(rule.Id); deletedItems.Add(item); } e.Result = deletedItems; }
private void bwDelete_DoWork(object sender, DoWorkEventArgs e) { var deletedItems = new List <ListViewItem>(); var rm = new RuleManager(entityName, service, connectionDetail); Invoke(new Action(() => { foreach (ListViewItem item in (ListView.SelectedListViewItemCollection)e.Argument) { var rule = (Entity)item.Tag; rm.DeleteRule(rule.Id); deletedItems.Add(item); } })); e.Result = deletedItems; }