private void BrowseCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { BrowseCTRL.ContextMenu.Commands.Clear(); if (e.Node != null) { ReferenceDescription reference = e.Node as ReferenceDescription; if (reference != null && reference.NodeClass == NodeClass.Variable) { BrowseCTRL.ContextMenu.Commands.Add(new UICommand("Report", ContextMenu_OnReport, e.Node)); BrowseCTRL.ContextMenu.Commands.Add(new UICommand("Sample", ContextMenu_OnSample, e.Node)); } } }
/// <summary> /// On node selected in source tree block /// </summary> private void BrowseCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { if (e.Node != null) { ReferenceDescription reference = e.Node as ReferenceDescription; if (reference != null && reference.NodeClass == NodeClass.Variable) { btnAddSubscription.IsEnabled = true; btnAddSubscription.Tag = e.Node; } else { btnAddSubscription.IsEnabled = true; btnAddSubscription.Tag = e.Node; } } }
/// <summary> /// On node selected in subscription list /// </summary> private void SessionCtrl_NodeSelected(object sender, TreeNodeActionEventArgs e) { if (e.Node != null) { MonitoredItem item = e.Node as MonitoredItem; if (e.Node is MonitoredItem) { btnDelSubscription.IsEnabled = true; btnDelSubscription.Tag = e.Node; } else { btnDelSubscription.IsEnabled = false; btnDelSubscription.Tag = null; } } }
private void BrowseCTRL_NodeSelected(object sender, TreeNodeActionEventArgs e) { if (e.Node != null) { ReferenceDescription reference = e.Node as ReferenceDescription; if (reference != null && reference.NodeClass == NodeClass.Variable) { CommandBTN.Visibility = Visibility.Visible; CommandBTN.Content = "Report"; 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 (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 SessionCtrl_NodeSelected(object sender, TreeNodeActionEventArgs e) { SessionsCTRL.ContextMenu.Commands.Clear(); if (e.Node != null) { MonitoredItem item = e.Node as MonitoredItem; if (e.Node is MonitoredItem) { SessionsCTRL.ContextMenu.Commands.Add(new UICommand("Delete", ContextMenu_OnDelete, e.Node)); } else if (e.Node is Subscription) { SessionsCTRL.ContextMenu.Commands.Add(new UICommand("Cancel", ContextMenu_OnCancel, e.Node)); } else if (e.Node is Session) { SessionsCTRL.ContextMenu.Commands.Add(new UICommand("Disconnect", ContextMenu_OnDisconnect, e.Node)); // Update current session object m_session = (Session)e.Node; } } }
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); } }