override public bool Disconnect(ref string errorMessage) { try { if (!Connected) { return(true); } else { string message = ""; if (triggering) { StopReadBarcode(ref message, ref errorMessage); } reader.Dispose(); return(true); } } catch (Exception ex) { errorMessage = String.Concat("斷線失敗 : ", ex.ToString()); return(false); } }
/// <summary> /// 连接释放 /// </summary> public void Dispose() { if (m_reader != null) { m_reader.Dispose(); } if (m_searcher != null) { m_searcher.Dispose(); } if (liveviewForm != null) { liveviewForm.Dispose(); } }
/// <summary> /// 條碼讀取器關閉,傳入條件:1.liveviewForm物件、2.readerAccessor物件 /// </summary> /// <param name="liveviewForm">liveviewForm物件</param> /// <param name="readerAccessor">readerAccessor物件</param> public static void ReadClose(LiveviewForm liveviewForm, ReaderAccessor readerAccessor) { liveviewForm.EndReceive(); readerAccessor.Dispose(); }