private void BackgroundWorker_DoWork(object sender, System.ComponentModel.DoWorkEventArgs e) { try { LoginInformation loginInfo = ( LoginInformation )e.Argument; if (_worker.CancellationPending) { e.Cancel = true; return; } if (_vm != null) { ErrType err = _vm.Login(loginInfo.AccountName, loginInfo.Password, loginInfo.AccountType); if (_worker.CancellationPending) { e.Cancel = true; return; } e.Result = err; } CheckUpdateProgram(); } catch (Exception ex) { e.Result = new ErrType(ERR.EXEPTION, ErrorText.ServiceError); } }