private void BgWorkerValidateDoWork(object sender, DoWorkEventArgs e) { if (Tools.IsConnected()) { // try to start the NocsServiceervice with given credentials NocsService.AuthenticateUser(txtGUser.Text, txtGPassword.Text, true); } else { throw new Exception("No internet connection"); } }
private void BgWorkerStartService_DoWork(object sender, DoWorkEventArgs e) { // first check that user is connected to Internet if (Tools.IsConnected()) { // start the DocumentService with user's credentials // (e.Argument is a boolean determining whether to force authToken retrieval) NocsService.AuthenticateUser(NocsService.Username, NocsService.Password, (bool)e.Argument); } else { Trace.WriteLine(DateTime.Now + " - Main: couldn't connect to internet"); throw new Exception("Could not connect to internet!"); } }