private void StartCmdExecute(object obj) { var wlyEntity = new AppEntity("15820299689", "game1314"); wlyEntity.Start(ProgramPath); entityList.Add(wlyEntity); }
private void KeepAliveElapsed(object sender, ElapsedEventArgs e) { m_timer.Stop(); var now = DateTime.Now; try { foreach (var entity in entityList.ToList()) { if ((entity.State == RunningState.Stopped) || ((now - entity.StartTime).TotalMinutes > 10)) { entity.Stop(); entityList.Remove(entity); var newEntity = new AppEntity(entity); entityList.Add(newEntity); newEntity.Start(m_config.ProgramPath); } } foreach (var reg in regList) { if (!reg.Run) { reg.Start(m_config.ProgramPath, reg.Index); } } } catch (Exception ex) { WxLog.Error($"MainWindowViewModel.KeepAliveElapsed Ex <{ex}>"); } finally { m_timer.Start(); } }