Exemple #1
0
        private void AddToolStripMenuItemClick(object sender, EventArgs e)
        {
            if (Tree.SelectedNode == null)
            {
                return;
            }

            switch (Tree.SelectedNode.Text)
            {
            case "MODULES":
            {
                var form = new AddModule();
                if (form.ShowDialog() == DialogResult.OK)
                {
                    Cfg.Modules.Add(form.Module);
                }
                break;
            }

            case "SPOOLS":
            {
                var spool = new SpoolXml {
                    Id = "New Spool"
                };
                Cfg.Spools.Add(spool);
                break;
            }

            default:
            {
                // Aggiungo un Timer
                if (Tree.SelectedNode.Tag is SpoolXml)
                {
                    var timer = new Timer {
                        Id = "New Timer"
                    };
                    var spool = Tree.SelectedNode.Tag as SpoolXml;
                    if (spool.Timers == null)
                    {
                        spool.Timers = new List <Timer>();
                    }
                    spool.Timers.Add(timer);
                }
                break;
            }
            }

            BindConfiguration(false);
        }
Exemple #2
0
 private int CountModulesInTimer(Timer timer)
 {
     return(Cfg.Modules.Count(mod => mod.Timer == timer.Id));
 }