private void edit_link() { if (lvSoftware.SelectedItems.Count > 0) { string link = lvSoftware.SelectedItem[1].ToString(); var new_link = RadInputBox.Show("Enter link", program_title, link); if (new_link != "") { lvSoftware.SelectedItem[1] = new_link; } else { lvSoftware.SelectedItem[1] = "--"; } } }
private void edit_name() { if (lvSoftware.SelectedItems.Count > 0) { var name = lvSoftware.SelectedItem[0].ToString(); var new_name = RadInputBox.Show("Enter name", program_title, name); var count = 0; foreach (ListViewDataItem item in lvSoftware.Items) { string name_check = item[0].ToString(); if (new_name == name_check) { count = count + 1; } else if (name == name_check) { count = count + 1; } } if (count != 2) { if (new_name != "") { MessageBox.Show(count.ToString()); lvSoftware.SelectedItem[0] = new_name; } } else { RadMessageBox.Show("The name already exists", program_title, MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } } }
private void add() { var name = RadInputBox.Show("Enter name", program_title, ""); var link = RadInputBox.Show("Enter link", program_title, ""); if (name != "") { if (link == "") { link = "--"; } ListViewDataItem add = new ListViewDataItem(); add.SubItems.Add(name); add.SubItems.Add(link); bool existe = false; foreach (ListViewDataItem item in lvSoftware.Items) { string name_check = item[0].ToString(); if (name == name_check) { existe = true; } } if (existe == false) { lvSoftware.Items.Add(add); } else { RadMessageBox.Show("The name already exists", program_title, MessageBoxButtons.OK, RadMessageIcon.Error, MessageBoxDefaultButton.Button1); } } }