private void addCharactButton_Click(object sender, EventArgs e) { Characteristic characteristic = new Characteristic(CharacteristicsTypes.valueOf(charactTypeComboBox.SelectedItem.ToString()), charactNameTextFiled.Text); characteristicsService.addCharacteristic(characteristic); string[] row = { characteristic.id.ToString(), characteristic.name, characteristic.type.ToString() }; ListViewItem item = new ListViewItem(row); this.characteristicsListView.Items.Add(item); this.characteristicsListView.Refresh(); this.charactNameTextFiled.Clear(); }
private void changeButton_Click(object sender, EventArgs e) { if (charactListViewSelectedItemForChange > 0) { ListViewItem charactListItem = this.characteristicsListView.Items[charactListViewSelectedItemForChange]; int selectedCharactId = Int32.Parse(charactListItem.SubItems[0].Text); Characteristic characteristic = new Characteristic(CharacteristicsTypes.valueOf(charactTypeComboBox.SelectedItem.ToString()), charactNameTextFiled.Text, selectedCharactId); characteristicsService.updateCharacteristic(characteristic); this.characteristicsListView.Items.RemoveAt(charactListViewSelectedItemForChange); string[] row = { characteristic.id.ToString(), characteristic.name, characteristic.type.ToString() }; ListViewItem item = new ListViewItem(row); this.characteristicsListView.Items.Add(item); this.characteristicsListView.Refresh(); } }
public List <Characteristic> getAllCharacteristics() { SQLiteCommand cmd = new SQLiteCommand(Program.conn); List <Characteristic> characteristics = new List <Characteristic>(); cmd.CommandText = SELECT_ALL; try { SQLiteDataReader r = cmd.ExecuteReader(); Characteristic characteristic = null; while (r.Read()) { characteristic = new Characteristic(CharacteristicsTypes.getCharacteristicsTypesByType(Int32.Parse(r["type"].ToString())), r["name"].ToString(), Int32.Parse(r["id"].ToString())); characteristics.Add(characteristic); logger.Debug("r.Read(): " + characteristic); } r.Close(); } catch (SQLiteException ex) { logger.Error(ex); } return(characteristics); }
public SensorChars(CC2650SensorTag.PropertyServiceCls.SensorTagProperties Property) { Property_Index = Property; Type = CharacteristicsTypes.property; CharcteristicsP = new Dictionary <CC2650SensorTag.PropertyServiceCls.SensorTagProperties, GattCharacteristic>(); }
public SensorChars(CC2650SensorTag.SensorServicesCls.SensorIndexes Sensor) { Sensor_Index = Sensor; Type = CharacteristicsTypes.sensor; Charcteristics = new Dictionary <CC2650SensorTag.SensorServicesCls.CharacteristicTypes, GattCharacteristic>(); }