예제 #1
0
        private void configureToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode currentNode = tvwMonPack.SelectedNode;

            if (currentNode.Tag != null && currentNode.Tag is CollectorEntry)
            {
                CollectorEntry     ce = (CollectorEntry)currentNode.Tag;
                EditCollectorEntry editCollectorEntry = new EditCollectorEntry();
                string             oldParent          = ce.ParentCollectorId;
                editCollectorEntry.SelectedEntry = ce;
                if (editCollectorEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                {
                    ce = editCollectorEntry.SelectedEntry;
                    string uniqueId = ce.UniqueId;
                    RefreshMonitorPack();
                    TreeNode collectorRootNode = (from TreeNode n in tvwMonPack.Nodes[0].Nodes
                                                  where n.Name == "Collectors"
                                                  select n).First();
                    SelectCollectorNodeById(uniqueId, collectorRootNode);
                }
            }
            else if (currentNode.Tag != null && currentNode.Tag is NotifierEntry)
            {
                NotifierEntry     ne = (NotifierEntry)currentNode.Tag;;
                EditNotifierEntry editNotifierEntry = new EditNotifierEntry();
                editNotifierEntry.SelectedEntry = ne;
                if (editNotifierEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                {
                    RefreshMonitorPack();
                }
            }
        }
예제 #2
0
        private void toolStripButtonAdd_Click(object sender, EventArgs e)
        {
            TreeNode currentNode = tvwMonPack.SelectedNode;

            if ((currentNode.Tag != null && currentNode.Tag is CollectorEntry) ||
                (currentNode.Tag == null && currentNode.Text == "Collectors"))
            {
                EditCollectorEntry editCollectorEntry = new EditCollectorEntry();
                if (currentNode.Tag is CollectorEntry)
                {
                    editCollectorEntry.SelectedEntry.ParentCollectorId = ((CollectorEntry)currentNode.Tag).UniqueId;
                }
                if (editCollectorEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                {
                    monitorPack.Collectors.Add(editCollectorEntry.SelectedEntry);
                    if (editCollectorEntry.SelectedEntry.ParentCollectorId != null && editCollectorEntry.SelectedEntry.ParentCollectorId.Length > 0)
                    {
                        TreeNode collectorRootNode = (from TreeNode n in tvwMonPack.Nodes[0].Nodes
                                                      where n.Name == "Collectors"
                                                      select n).First();
                        currentNode = SelectCollectorNodeById(editCollectorEntry.SelectedEntry.ParentCollectorId, collectorRootNode);
                        if (currentNode == null)
                        {
                            currentNode = collectorRootNode; //should never happen really but if...
                        }
                    }
                    LoadCollectorEntry(editCollectorEntry.SelectedEntry, currentNode);
                    currentNode.Expand();
                }
            }
            else if (currentNode.Tag == null && currentNode.Text == "Notifiers")
            {
                EditNotifierEntry editNotifierEntry = new EditNotifierEntry();
                if (editNotifierEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                {
                    monitorPack.Notifiers.Add(editNotifierEntry.SelectedEntry);
                    LoadNotifierEntry(editNotifierEntry.SelectedEntry, currentNode);
                    if (editNotifierEntry.SelectedEntry.Notifier != null && editNotifierEntry.SelectedEntry.Notifier.HasViewer)
                    {
                        cboDefaultViewerNotifier.Items.Add(editNotifierEntry.SelectedEntry.Name);
                    }
                }
            }
        }
예제 #3
0
 private void ShowEdit()
 {
     System.Threading.ThreadPool.QueueUserWorkItem(delegate
     {
         this.Invoke((MethodInvoker) delegate
         {
             if (tvwMonPack.SelectedNode != null)
             {
                 TreeNode currentNode = tvwMonPack.SelectedNode;
                 if (currentNode.Tag != null && currentNode.Tag is CollectorEntry)
                 {
                     CollectorEntry ce = (CollectorEntry)currentNode.Tag;
                     EditCollectorEntry editCollectorEntry = new EditCollectorEntry();
                     string oldParent = ce.ParentCollectorId;
                     editCollectorEntry.SelectedEntry = ce;
                     if (editCollectorEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                     {
                         ce = editCollectorEntry.SelectedEntry;
                         string uniqueId = ce.UniqueId;
                         RefreshMonitorPack();
                         TreeNode collectorRootNode = (from TreeNode n in tvwMonPack.Nodes[0].Nodes
                                                       where n.Name == "Collectors"
                                                       select n).First();
                         SelectCollectorNodeById(uniqueId, collectorRootNode);
                     }
                 }
                 else if (currentNode.Tag != null && currentNode.Tag is NotifierEntry)
                 {
                     NotifierEntry ne = (NotifierEntry)currentNode.Tag;;
                     EditNotifierEntry editNotifierEntry = new EditNotifierEntry();
                     editNotifierEntry.SelectedEntry     = ne;
                     if (editNotifierEntry.ShowDialog(monitorPack) == System.Windows.Forms.DialogResult.OK)
                     {
                         RefreshMonitorPack();
                     }
                 }
             }
         });
     });
 }