Example #1
0
 private void Start()
 {
     try
     {
         sr = new SingleRun(applist[AppIndex]);
         sr.StartApp();
         LoadAppMsg((int)Status.Start, applist[AppIndex].Id);
         appTimer          = new System.Timers.Timer();
         appTimer.Interval = Settings.Default.CardTime * 60000;
         appTimer.Start();
         appTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
     }
     catch (Exception e)
     {
         Settings.Default.AppEnabled = false;
         LoadAppMsg((int)Status.Exit, applist[AppIndex].Id);
         CMDprintError(e.Message);
         MessageBox.Show(e.Message);
     }
 }
Example #2
0
 private void OnTimedEvent(object source, ElapsedEventArgs e)
 {
     if (--sr.Virtualcard < 1)
     {
         sr.StopApp();
         LoadAppMsg((int)Status.End, applist[AppIndex].Id);
         ++AppIndex;
         try
         {
             sr = new SingleRun(applist[AppIndex]);
             sr.StartApp();
             LoadAppMsg((int)Status.Start, applist[AppIndex].Id);
         }
         catch (Exception ex)
         {
             Settings.Default.AppEnabled = false;
             Kill();
             appTimer.Stop();
             appTimer.Close();
             LoadAppMsg((int)Status.Exit, applist[AppIndex - 1].Id);
             CMDprintError(ex.Message);
         }
     }
 }