private void SessionCtrl_NodeSelected(object sender, TreeNodeActionEventArgs e)
{
if (e.Node != null)
{
MonitoredItem item = e.Node as MonitoredItem;
if (e.Node is MonitoredItem)
{
CommandBTN.Visibility = Visibility.Visible;
CommandBTN.Content = "Delete";
RemoveAllClickEventsFromButton();
CommandBTN.Click += ContextMenu_OnDelete;
CommandBTN.Tag = e.Node;
}
else if (e.Node is Subscription)
{
CommandBTN.Visibility = Visibility.Visible;
CommandBTN.Content = "Cancel";
RemoveAllClickEventsFromButton();
CommandBTN.Click += ContextMenu_OnCancel;
CommandBTN.Tag = e.Node;
}
else if (e.Node is Session)
{
CommandBTN.Visibility = Visibility.Visible;
CommandBTN.Content = "Disconnect";
RemoveAllClickEventsFromButton();
CommandBTN.Click += ContextMenu_OnDisconnect;
CommandBTN.Tag = e.Node;
// Update current session object
m_session = (Session)e.Node;
}
else
{
RemoveAllClickEventsFromButton();
CommandBTN.Visibility = Visibility.Collapsed;
CommandBTN.Tag = null;
}
}
}