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); } }
private void StartAllTwoHour() { if (applist.Count != 0) { CMDprint("一键2小时"); MessageBox.Show("一键2小时的时候别挂机,挂机别2小时", "注意"); int i = 0; foreach (AppMember item in applist) { if (Convert.ToDouble(item.Time) < 2.00 && i < 30) { SingleRun srtwo = new SingleRun(item); srtwo.StartTwoApp(); i++; } } } }
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); } } }