コード例 #1
0
            /// <summary>
            /// Opens a peripheral.
            /// </summary>
            /// <param name="peripheralName">Name of the peripheral.</param>
            /// <param name="peripheralConfig">Configuration parameters of the peripheral.</param>
            public void Open(string peripheralName, PeripheralConfiguration peripheralConfig)
            {
                if (this.oposSigCap == null)
                {
                    this.oposSigCap = new OPOSSigCap();

                    this.oposSigCap.DataEvent  += this.OnSigCapDataEvent;
                    this.oposSigCap.ErrorEvent += this.OnSigCapErrorEvent;

                    try
                    {
                        // Open
                        Task.Run(() => this.oposSigCap.Open(peripheralName)).Wait(OposHelper.ClaimTimeOut);
                        OposHelper.CheckResultCode(this, this.oposSigCap.ResultCode);

                        // Claim
                        this.oposSigCap.ClaimDevice(OposHelper.ClaimTimeOut);
                        OposHelper.CheckResultCode(this, this.oposSigCap.ResultCode);

                        // Configure
                        this.CapUserTerminated = this.oposSigCap.CapUserTerminated;
                        this.MaximumX          = this.oposSigCap.MaximumY;
                        this.MaximumY          = this.oposSigCap.MaximumY;
                    }
                    catch
                    {
                        this.Close();
                        throw;
                    }
                }

                // NOTE: Hardware station does not support "ReatlTimeDataEnabled" property.
            }
コード例 #2
0
            /// <summary>
            /// Closes the peripheral.
            /// </summary>
            public void Close()
            {
                if (this.oposSigCap != null)
                {
                    try
                    {
                        this.oposSigCap.DataEvent  -= this.OnSigCapDataEvent;
                        this.oposSigCap.ErrorEvent -= this.OnSigCapErrorEvent;

                        this.oposSigCap.Close(); // Releases device and closes resources
                    }
                    finally
                    {
                        this.oposSigCap = null;
                    }
                }
            }