Beispiel #1
0
        private void loadConfig(String file)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(file==null?"config.xml":file);
            int wait=0;
            String sWait=xDoc.DocumentElement.GetAttribute("wait");
            if (sWait!=null && (sWait=sWait.Trim()).Length>0) wait=Convert.ToInt32(sWait);

            XmlNodeList apps = xDoc.GetElementsByTagName("app");

            Run.runners=new List<Run>();
            int i=0;
            int w=0;
            int h=0;
            foreach (XmlElement nodo in apps) {
                CheckBox chkList =new CheckBox();
                chkList.Text = nodo.GetAttribute("nombre");
                chkList.Left=5;
                chkList.Top=chkList.Height*(i++);
                this.Controls.Add(chkList);
                w=Math.Max(w,chkList.Width);
                h=chkList.Bottom;
                Run r=new Run(nodo,chkList);
                r.Seg=r.Seg+wait;
                Run.runners.Add(r);
            }

            this.Width=w+5;
            this.Height=h+25;

            if (!Run.starTimer()) this.Text=this.Text+'.';
            Run.form=this;
        }
Beispiel #2
0
 public static int getSiguiente()
 {
     int min=-1;
     foreach(Run r in Run.runners) {
         if (r.needRun() && r.Seg>clock) {
             if (min==-1 || r.Seg<min) {
                 min=r.Seg;
                 Run.current=r;
             }
         }
     }
     int itr=min-clock;
     if (itr<0 || Run.current==null) return -1;
     Run.current.chk.Text=(Run.current.nombre+" <- "+(Run.count++));
     clock=min;
     return itr*1000;
 }