protected virtual void OnFinished(IntPtr converter, int success) { Tracer.Trace(string.Format("T:{0} Conversion Finished: {1}", Thread.CurrentThread.Name, success != 0 ? "Succeeded" : "Failed")); FinishEventHandler handler = this.Finished; try { if (handler != null) { handler(this, success != 0); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Finish event handler", Thread.CurrentThread.Name), e); } }
protected virtual void OnError(IntPtr converter, string errorText) { Tracer.Warn(string.Format("T:{0} Conversion Error: {1}", Thread.CurrentThread.Name, errorText)); ErrorEventHandler handler = this.Error; try { if (handler != null) { handler(this, errorText); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Error event handler", Thread.CurrentThread.Name), e); } }
protected virtual void OnProgressChanged(IntPtr converter, int progress) { string progressDescription = PechkinStatic.GetProgressDescription(converter); Tracer.Trace(string.Format("T:{0} Conversion Progress Changed: ({1}) {2}", Thread.CurrentThread.Name, progress, progressDescription)); ProgressChangedEventHandler handler = this.ProgressChanged; try { if (handler != null) { handler(this, progress, progressDescription); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Progress event handler", Thread.CurrentThread.Name), e); } }
protected virtual void OnBegin(IntPtr converter) { int expectedPhaseCount = PechkinStatic.GetPhaseCount(converter); Tracer.Trace(string.Format("T:{0} Conversion started, {1} phases awaiting", Thread.CurrentThread.Name, expectedPhaseCount)); BeginEventHandler handler = this.Begin; try { if (handler != null) { handler(this, expectedPhaseCount); } } catch (Exception e) { Tracer.Warn(String.Format("T:{1} Exception in Begin event handler {0}", e, Thread.CurrentThread.Name)); } }
protected virtual void OnPhaseChanged(IntPtr converter) { int phaseNumber = PechkinStatic.GetPhaseNumber(converter); string phaseDescription = PechkinStatic.GetPhaseDescription(converter, phaseNumber); Tracer.Trace(string.Format("T:{0} Conversion Phase Changed: #{1} {2}", Thread.CurrentThread.Name, phaseNumber, phaseDescription)); PhaseChangedEventHandler handler = this.PhaseChanged; try { if (handler != null) { handler(this, phaseNumber, phaseDescription); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in PhaseChange event handler", Thread.CurrentThread.Name), e); } }
private void OnWarning(IntPtr converter, string warningText) { Tracer.Warn(string.Format("T:{0} Conversion Warning: {1}", Thread.CurrentThread.Name, warningText)); try { if (Warning != null) { var args = new WarningEventArgs { Document = ProcessingDocument, WarningMessage = warningText }; Warning(this, args); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Warning event handler", Thread.CurrentThread.Name), e); } }
private void OnFinished(IntPtr converter, int success) { Tracer.Trace(string.Format("T:{0} Conversion Finished: {1}", Thread.CurrentThread.Name, success != 0 ? "Succeeded" : "Failed")); try { if (Finish != null) { var args = new FinishEventArgs { Document = ProcessingDocument, Success = success != 0 }; Finish(this, args); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Finish event handler", Thread.CurrentThread.Name), e); } }
private void OnError(IntPtr converter, string errorText) { Tracer.Warn(string.Format("T:{0} Conversion Error: {1}", Thread.CurrentThread.Name, errorText)); try { if (Error != null) { var args = new ErrorEventArgs { Document = ProcessingDocument, ErrorMessage = errorText }; Error(this, args); } } catch (Exception e) { Tracer.Warn(string.Format("T:{0} Exception in Error event handler", Thread.CurrentThread.Name), e); } }
private void OnBegin(IntPtr converter) { int expectedPhaseCount = Toolset.GetPhaseCount(converter); Tracer.Trace(string.Format("T:{0} Conversion started, {1} phases awaiting", Thread.CurrentThread.Name, expectedPhaseCount)); try { if (Begin != null) { var args = new BeginEventArgs { Document = ProcessingDocument, ExpectedPhaseCount = expectedPhaseCount }; Begin(this, args); } } catch (Exception e) { Tracer.Warn(String.Format("T:{1} Exception in Begin event handler {0}", e, Thread.CurrentThread.Name)); } }