Ejemplo n.º 1
0
        private void button_openReader_Click(object sender, EventArgs e)
        {
            string strError = "";

            using (OpenReaderDialog dlg = new OpenReaderDialog())
            {
                dlg.ShowDialog(this);
                if (dlg.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                var connectionString = dlg.BuildConnectionString();

                var iret = RFIDLIB.rfidlib_reader.RDR_Open(connectionString, ref this._readerHandle);
                if (iret != 0)
                {
                    strError = "Open Reader Fail";
                    goto ERROR1;
                }
                else
                {
                    this.button_openReader.Enabled  = false;
                    this.button_closeReader.Enabled = true;
                }
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }
Ejemplo n.º 2
0
        private void button_openReader_Click(object sender, EventArgs e)
        {
            string strError = "";

            using (OpenReaderDialog dlg = new OpenReaderDialog())
            {
                dlg.UiState = ClientInfo.Config.Get("reader_dialog", "ui_state");

                dlg.ShowDialog(this);

                ClientInfo.Config.Set("reader_dialog", "ui_state", dlg.UiState);
                if (dlg.DialogResult == DialogResult.Cancel)
                {
                    return;
                }

                var oldCursor = this.Cursor;
                this.Cursor = Cursors.WaitCursor;

                try
                {
                    var connectionString = dlg.BuildConnectionString();

                    var iret = RFIDLIB.rfidlib_reader.RDR_Open(connectionString, ref this._readerHandle);
                    if (iret != 0)
                    {
                        strError = "Open Reader Fail";
                        goto ERROR1;
                    }
                    else
                    {
                        this.button_openReader.Enabled  = false;
                        this.button_closeReader.Enabled = true;
                    }
                }
                finally
                {
                    this.Cursor = oldCursor;
                }
            }

            return;

ERROR1:
            MessageBox.Show(this, strError);
        }