private void ContainersCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { try { OkBTN.Enabled = ContainersCTRL.SelectedStore != null; } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }
private void BrowseCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { if (m_publishers != null && e.Node != null) { ReferenceDescription reference = e.Node as ReferenceDescription; if (reference != null && reference.NodeClass == NodeClass.Variable) { CommandBTN.Visibility = Visibility.Visible; CommandBTN.Content = "Publish"; RemoveAllClickEventsFromButton(); CommandBTN.Click += ContextMenu_OnReport; CommandBTN.Tag = e.Node; } else { RemoveAllClickEventsFromButton(); CommandBTN.Visibility = Visibility.Collapsed; CommandBTN.Tag = null; } } }
private void SessionCtrl_NodeSelected(object sender, TreeNodeActionEventArgs e) { if (m_publishers != null && 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; } } }
private void BrowseCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { try { // disable ok button if selection is not valid. OkBTN.Enabled = false; ReferenceDescription reference = e.Node as ReferenceDescription; if (reference == null) { return; } if (NodeId.IsNull(reference.NodeId)) { return; } // set the display name. DisplayNameTB.Text = reference.ToString(); NodeClassCB.SelectedItem = (NodeClass)reference.NodeClass; // set identifier type. IdentifierTypeCB.SelectedItem = reference.NodeId.IdType; // set namespace uri. if (!String.IsNullOrEmpty(reference.NodeId.NamespaceUri)) { NamespaceUriCB.SelectedIndex = -1; NamespaceUriCB.Text = reference.NodeId.NamespaceUri; } else { if (reference.NodeId.NamespaceIndex < NamespaceUriCB.Items.Count) { NamespaceUriCB.SelectedIndex = (int)reference.NodeId.NamespaceIndex; } else { NamespaceUriCB.SelectedIndex = -1; NamespaceUriCB.Text = null; } } // set identifier. switch (reference.NodeId.IdType) { case IdType.Opaque: { NodeIdentifierTB.Text = Convert.ToBase64String((byte[])reference.NodeId.Identifier); break; } default: { NodeIdentifierTB.Text = Utils.Format("{0}", reference.NodeId.Identifier); break; } } // selection valid - enable ok. OkBTN.Enabled = true; m_reference = reference; } catch (Exception exception) { GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception); } }