コード例 #1
0
ファイル: Characteriscics.cs プロジェクト: vasekaa/arctic
        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();
        }
コード例 #2
0
ファイル: Characteriscics.cs プロジェクト: vasekaa/arctic
        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();
            }
        }