/// <summary> /// Connects the drawing interface. /// </summary> /// <returns>A boolean value indicating whether the interface is connected.</returns> public bool Connect() { try { if (this.connection == null) { this.connection = new TSDrawingConnection(); SeparateThread.Execute( delegate { TSDrawingConnection.SetMessageExecutionStatus( TSDrawingConnection.MessageExecutionModeEnum.BY_COMMIT); }); } if (this.events == null) { this.events = new TSDrawingEvents(); this.RegisterEvents(); } } catch (Exception ex) { Debug.WriteLine(ex); this.Disconnect(); } return(this.IsActive); }
/// <summary> /// Disconnects the drawing interface. /// </summary> public void Disconnect() { try { this.UnregisterEvents(); } catch (Exception ex) { Debug.WriteLine(ex); } finally { this.events = null; this.connection = null; } }