public SecurityForm() { _staffTable = new Access_control_in_OneWire.StaffDataTable(); _staffTableAdapter = new StaffTableAdapter(); _staffTableAdapter.ClearBeforeFill = true; _staffTableAdapter.Fill(_staffTable); _eventLogAdapter = new JoinedEventLogAdapter(); _eventLogAdapter.ClearBeforeFill = true; _eventLogAdapter.Adapter.InsertCommand.Connection = _eventLogAdapter.Connection; _shAdapter.ClearBeforeFill = true; _shTable = new Access_control_in_OneWire.ScheduleDataTable(); //try{ _dialog = new UIDCOMDialog(Properties.Settings.Default.COMName, Properties.Settings.Default.BaudRate, 8, _listener_UIDReceived); //} //catch(Exception) //{ // MessageBox.Show(this, "Не удалось получить доступ к COM-порту.", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); // this.Close(); /// return; //} InitializeComponent(); this.CenterToScreen(); }
private void cB_listen_Click(object sender, EventArgs e) { if (_dialog != null && _dialog.IsOpen()) { _dialog.Close(); } _dialog = new UIDCOMDialog(coB_coms.Text, 9600, 8, OnUIDReceived); }
private void UIDReadingForm_Load(object sender, EventArgs e) { try { _dialog = new UIDCOMDialog(Settings.Default.COMName, Settings.Default.BaudRate, 8, ReceivingHandler); } catch (Exception) { DialogResult = DialogResult.Cancel; this.Close(); } }