private void RunUIJobSync(IOperationViewer operationViewer, Operation operation, IUIJob job) { // Run the job. If the job fails, ignore that exception as well but log it too! try { job.OnNewOperation(operationViewer, operation); } catch (Exception ex) { // Be careful when processing the jobs, we don't want a malicious job to terminate the process! Logger.Instance.LogFormat(LogType.Warning, this, $"An error occurred while processing UI-job '{job.GetType().Name}'!"); Logger.Instance.LogException(this, ex); } }
private void RunUIJobAsync(IOperationViewer operationViewer, Operation operation, IUIJob job) { ThreadPool.QueueUserWorkItem(o => { // Run the job. If the job fails, ignore that exception as well but log it too! try { job.OnNewOperation(operationViewer, operation); } catch (Exception ex) { // Be careful when processing the jobs, we don't want a malicious job to terminate the process! Logger.Instance.LogFormat(LogType.Warning, this, string.Format("An error occurred while processing the asynchronous UI-job '{0}'!", job.GetType().Name)); Logger.Instance.LogException(this, ex); } }); }
private void RunUIJobSync(IOperationViewer operationViewer, Operation operation, IUIJob job) { // Run the job. If the job fails, ignore that exception as well but log it too! try { job.OnNewOperation(operationViewer, operation); } catch (Exception ex) { // Be careful when processing the jobs, we don't want a malicious job to terminate the process! Logger.Instance.LogFormat(LogType.Warning, this, string.Format("An error occurred while processing UI-job '{0}'!", job.GetType().Name)); Logger.Instance.LogException(this, ex); } }