public void RaiseProgressChanged(Result translateResult) { results.Add(translateResult); processed++; TranslateProgressChangedEventArgs e = new TranslateProgressChangedEventArgs( translateResult, this, (int)(((double)processed) / ((double)count) * 100), this ); if (ProgressChanged != null) { ProgressChanged(this, e); } if (IsTerminated) { return; } if (processed == count) { TranslateCompletedEventArgs args = new TranslateCompletedEventArgs( this, null, false, this); try { asyncOperation.PostOperationCompleted(RaiseTranslateCompleted, args); } catch (System.InvalidOperationException) { //ignore exception raised sometime from here } IsTerminated = true; } }
internal void TranslateProgressChanged(object sender, TranslateProgressChangedEventArgs e) { resBrowser.SetResult(e.TranslateResult, e.TranslateState.LanguagePair); pbMain.Value = e.ProgressPercentage; StatManager.IncrementServiceCalls(); }
public void RaiseProgressChanged(Result translateResult) { results.Add(translateResult); processed++; TranslateProgressChangedEventArgs e = new TranslateProgressChangedEventArgs( translateResult, this, (int)(((double)processed)/((double)count)*100), this ); if (ProgressChanged != null) { ProgressChanged(this, e); } if(IsTerminated) return; if(processed == count) { TranslateCompletedEventArgs args = new TranslateCompletedEventArgs( this, null, false, this); try { asyncOperation.PostOperationCompleted(RaiseTranslateCompleted, args); } catch(System.InvalidOperationException) { //ignore exception raised sometime from here } IsTerminated = true; } }