Esempio n. 1
0
    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void subscriptionDiagnosticsToolStripMenuItem_Click(object sender, EventArgs e)
    {
      try
      {
        if (listView1.SelectedItems.Count > 0)
        {
          ListViewItem lvi = listView1.SelectedItems[0];
          Browser browser = new Browser(m_Session);
          browser.MaxReferencesReturned = 0;
          browser.BrowseDirection = BrowseDirection.Forward;
          browser.IncludeSubtypes = true;
          browser.NodeClassMask = (int)NodeClass.Variable;
          browser.ContinueUntilDone = true;
          browser.ReferenceTypeId = null;
          NodeId sessionNodeId = new NodeId(lvi.Tag.ToString());
          ReferenceDescriptionCollection refs = browser.Browse(sessionNodeId);

          foreach (ReferenceDescription rf in refs)
          {
            if (m_Session.TypeTree.IsTypeOf(new ExpandedNodeId(rf.TypeDefinition), new ExpandedNodeId(VariableTypes.SubscriptionDiagnosticsArrayType)))
            {
              MonitoredItem mi = new MonitoredItem(m_Subscription.DefaultItem);
              NodeId id = new NodeId(rf.NodeId.ToString());
              INode node = m_Session.NodeCache.Find(id);
              mi.StartNodeId = id;
              mi.NodeClass = node.NodeClass;
              mi.AttributeId = Attributes.Value;
              mi.DisplayName = m_Session.NodeCache.GetDisplayText(node);
              mi.MonitoringMode = MonitoringMode.Reporting;
              m_Subscription.PublishingEnabled = true;
              m_Subscription.AddItem(mi);
              m_Subscription.ModifyItems();
              m_Subscription.ApplyChanges();
              MonitoredItemDlg dlg = new MonitoredItemDlg();
              m_Forms.Add(dlg);
              dlg.Show(mi);
              
              break;

            }
          }
        }
      }
      catch (Exception exception)
      {
        GuiUtils.HandleException(this.Text, MethodBase.GetCurrentMethod(), exception);
      }
    }
Esempio n. 2
0
 private void DetailsToolStripMenuItem_Click(object sender, EventArgs e)
 {
   if (ItemsLV.SelectedItems.Count > 0)
   {
     DiagnosticListViewItem dlvi = ItemsLV.SelectedItems[0].Tag as DiagnosticListViewItem;
     if (dlvi != null)
     {
       MonitoredItemDlg dlg = new MonitoredItemDlg();
       m_Forms.Add(dlg);
       dlg.Show(dlvi.MonitoredItem);
     }
   }
 }