Ejemplo n.º 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();
                }
            }
        }
Ejemplo n.º 2
0
        public static NotifierEntry CreateAndEditNewNotifier(MonitorPack monitorPack)
        {
            NotifierEntry newNotifierEntry = CreateNewNotifier();

            if (newNotifierEntry != null)
            {
                Management.EditNotifierEntry editNotifierEntry = new Management.EditNotifierEntry();
                editNotifierEntry.SelectedEntry      = newNotifierEntry;
                editNotifierEntry.LaunchAddEntry     = LastLaunchAddEntryOption;
                editNotifierEntry.ShowRawEditOnStart = LastShowRawEditOnStartOption;

                if (editNotifierEntry.ShowDialog(monitorPack) != System.Windows.Forms.DialogResult.OK)
                {
                    newNotifierEntry = null;
                }
            }
            return(newNotifierEntry);
        }
Ejemplo n.º 3
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);
                    }
                }
            }
        }
Ejemplo n.º 4
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();
                     }
                 }
             }
         });
     });
 }
Ejemplo n.º 5
0
 public static System.Windows.Forms.DialogResult EditNotifierEntry(NotifierEntry notifierEntry, MonitorPack monitorPack)
 {
     Management.EditNotifierEntry editNotifierEntry = new Management.EditNotifierEntry();
     editNotifierEntry.SelectedEntry = notifierEntry;
     return(editNotifierEntry.ShowDialog(monitorPack));
 }