private void CloseFormPreview() { if (null != m_webBrowser) { m_webBrowser.Browser.DocumentCompleted -= Browser_DocumentCompleted; } //if (null != m_docCompleteEvt) //{ // m_docCompleteEvt.Dispose(); // m_docCompleteEvt = null; //} //m_webBrowser.Exit(); //m_webBrowser.Close(); //m_webBrowser = null; //if(m_webThread!=null && m_webThread.IsAlive) //{ // if (m_webThread.Join(30000)) // { // m_webThread.Abort(); // m_webThread.Join(10000); // } // m_webThread = null; //} m_webBrowser = null; }
private void OnWebThread() { try { m_webBrowser = new FormPrintTest(); m_webBrowser.Show(); m_webBrowser.Browser.DocumentCompleted += Browser_DocumentCompleted; m_webBrowser.FormClosing += M_webBrowser_FormClosing; Application.ThreadException += (argSender, argParam) => { Log.BusinessService.LogError("The unhandle exception of A4 print service", argParam.Exception); }; m_openEvt.Set(); Application.Run(); } catch (ThreadAbortException exp) { Thread.ResetAbort(); Log.BusinessService.LogError("The thread to start A4 printer service was terminated", exp); } catch (System.Exception ex) { Log.BusinessService.LogError("Failed to start A4 printer service", ex); } }