private void ConfigTypeLoad() { lblConfigType = new System.Windows.Forms.Label(); lblConfigType.Location = new System.Drawing.Point(13, 10); lblConfigType.Name = "lblConfigType"; lblConfigType.Size = new System.Drawing.Size(100, 23); lblConfigType.TabIndex = 5; lblConfigType.Text = "Reader Type"; lblConfigType.Click += new System.EventHandler(this.Label1Click); ConfigType = new System.Windows.Forms.ComboBox(); ConfigType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; ConfigType.FormattingEnabled = true; ConfigType.Location = new System.Drawing.Point(132, 10); ConfigType.Name = "ConfigType"; ConfigType.Size = new System.Drawing.Size(121, 21); ConfigType.TabIndex = 4; ConfigType.SelectedIndexChanged += new System.EventHandler(this.Config_typeSelectedIndexChanged); ConfigType.Items.AddRange(ConfigTypes()); IEnumerator configEnumerator = ConfigType.Items.GetEnumerator(); while (configEnumerator.MoveNext()) { string value = readConfig.getString("type"); if (value != null && value.CompareTo(configEnumerator.Current) == 0) { ConfigType.SelectedItem = configEnumerator.Current; } } Controls.Add(lblConfigType); Controls.Add(ConfigType); }
public bool connectReader() { string configType = readConfiguration.getString("type"); string configDevice = readConfiguration.getString("device"); string configSchema = readConfiguration.getString("schema"); if (configType == null || configDevice == null || configSchema == null) { return(false); } LS8000 ls8000 = new LS8000(); if (ls8000.getName().CompareTo(configType) == 0) { device = ls8000; } ACR122 acr122 = new ACR122(); if (acr122.getName().CompareTo(configType) == 0) { device = acr122; } ACR122_Sim acr122_sim = new ACR122_Sim(); if (acr122_sim.getName().CompareTo(configType) == 0) { device = acr122_sim; } ACR122_v2 acr122_v2 = new ACR122_v2(); if (acr122_v2.getName().CompareTo(configType) == 0) { device = acr122_v2; } if (device == null) { return(false); } KeeleCard keeleCard = new KeeleCard(device, configDevice); if (keeleCard.getName().CompareTo(configSchema) == 0) { schema = keeleCard; } if (schema == null) { return(false); //return device.connect(configDevice); } return(true); /* * if (_serialPort == -1) * return false; * int val = LS8000CommsLib.Comms.rf_init_com(_serialPort,NotificationIcon.baud); * if (val == 0) * return true; * * else * MessageBox.Show("Failed to connect to reader on Com " + _serialPort, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); * return false; */ }