private void backgroundWorkerTrain_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { int countProgress = 0; SeleniumServices seleniumServices = new SeleniumServices(Application.StartupPath, "https://la.footballteamgame.com/", int.Parse(ConfigurationManager.AppSettings["navigatorId"])); try { seleniumServices.LogIn(_user); var resultIndex = seleniumServices.NavigateToUrl(_user.Training, "training"); while (countProgress < _user.Count) { backgroundWorkerTrain.ReportProgress(++countProgress * 100 / _user.Count); seleniumServices.doOneActivity(_user.Training, resultIndex, "btn btn-primary tile-box__btn pulse-in-tutorial"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { seleniumServices.LogOut(true); } }
private void backgroundWorkerFood_DoWork(object sender, DoWorkEventArgs e) { int countProgress = 0; SeleniumServices seleniumServices = new SeleniumServices(Application.StartupPath, "https://la.footballteamgame.com/", int.Parse(ConfigurationManager.AppSettings["navigatorId"])); try { seleniumServices.LogIn(_user); var resultIndex = seleniumServices.NavigateToUrl(_user.Food, "food"); while (countProgress < _user.Count) { backgroundWorkerFood.ReportProgress(++countProgress * 100 / _user.Count); seleniumServices.doOneActivity(_user.Food, resultIndex, "btn btn-lg btn-primary"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { seleniumServices.LogOut(true); } }