/// <summary> /// Respond to button click to delete node from subscription list /// -- refresh content display accordingly /// </summary> private void ContextMenu_OnDelete(object sender, RoutedEventArgs e) { Button CommandBTN = sender as Button; try { var monitoredItem = CommandBTN.Tag as MonitoredItem; if (monitoredItem == null) { return; } var subscription = monitoredItem.Subscription; SessionsCTRL.Delete(monitoredItem); if (subscription.MonitoredItemCount == 0) { // Remove subscription if no more items CommandBTN.Tag = subscription; ContextMenu_OnCancelSubscription(sender, e); } } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); } }
private void ContextMenu_OnCancel(object sender, RoutedEventArgs e) { try { SessionsCTRL.Delete(CommandBTN.Tag as Subscription); } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); } }
private void ContextMenu_OnCancel(IUICommand command) { try { SessionsCTRL.Delete(command.Id as Subscription); } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); } }
/// <summary> /// Respond to button click to delete whole subscription list /// -- refresh content display accordingly /// </summary> private void ContextMenu_OnCancelSubscription(object sender, RoutedEventArgs e) { Button CommandBTN = sender as Button; try { foreach (MonitoredItem x in (CommandBTN.Tag as Subscription).MonitoredItems) { SessionsCTRL.Delete(x); } SessionsCTRL.Delete(CommandBTN.Tag as Subscription); } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); } }
private void ContextMenu_OnDelete(IUICommand command) { try { var monitoredItem = command.Id as MonitoredItem; if (monitoredItem == null) { return; } var subscription = monitoredItem.Subscription; SessionsCTRL.Delete(monitoredItem); if (subscription.MonitoredItemCount == 0) { // Remove subscription if no more items command.Id = subscription; ContextMenu_OnCancel(command); } } catch (Exception exception) { GuiUtils.HandleException(String.Empty, GuiUtils.CallerName(), exception); } }