/// <summary> /// This function sets the current info state and sents /// the state to the GUI /// </summary> /// <param name="webParserInfoState">WebParserInfoState</param> void SetAndSendState(WebParserInfoState webParserInfoState) { #if DEBUG Console.WriteLine(@"State: {0} / ThreadRunning: {1} / ErrorCode: {2} / Percent: {3}", State, ThreadRunning, webParserInfoState.LastErrorCode, webParserInfoState.Percentage); #endif // Set state to "idle" if (webParserInfoState.LastErrorCode == WebParserErrorCodes.Finished || webParserInfoState.LastErrorCode < 0) { State = WebParserState.Idle; CancelThread = false; } // Send state if (OnWebParserUpdate != null) { if (ThreadRunning) { OnWebParserUpdate(this, new OnWebParserUpdateEventArgs(webParserInfoState)); } } // Stop thread if (webParserInfoState.LastErrorCode == WebParserErrorCodes.Finished || webParserInfoState.LastErrorCode < 0) { ThreadRunning = false; } }
/// <summary> /// Constructor /// </summary> /// <param name="webParserInfoState">Last error code of the webparser</param> /// Error code see the class "WebParser" /// <param name="percent">Value in percent of the process run</param> /// <param name="exception">Exception which maybe occurred</param> public OnWebParserUpdateEventArgs(WebParserInfoState webParserInfoState) { _webParserInfoState = webParserInfoState; }