private void btnAdd_Click(object sender, EventArgs e) { QuickTaskInfo taskInfo = new QuickTaskInfo(); ListViewItem lvi = new ListViewItem(); lvi.Tag = taskInfo; Program.Settings.QuickTaskPresets.Add(taskInfo); lvPresets.Items.Add(lvi); Edit(taskInfo); lvi.Text = taskInfo.ToString(); }
private void btnEdit_Click(object sender, EventArgs e) { if (lvPresets.SelectedItems.Count > 0) { ListViewItem lvi = lvPresets.SelectedItems[0]; QuickTaskInfo taskInfo = lvi.Tag as QuickTaskInfo; Edit(taskInfo); lvi.Text = taskInfo.ToString(); } }
private void EditSelectedItem() { if (lvPresets.SelectedItems.Count > 0) { ListViewItem lvi = lvPresets.SelectedItems[0]; QuickTaskInfo taskInfo = lvi.Tag as QuickTaskInfo; Edit(taskInfo); lvi.Text = taskInfo.ToString(); } }
private void UpdateItem(ListViewItem lvi, QuickTaskInfo taskInfo) { lvi.Tag = taskInfo; lvi.Text = taskInfo.ToString(); }
private void UpdateItem(ListViewItem lvi, QuickTaskInfo taskInfo) { lvi.BackColor = taskInfo.IsValid ? Color.White : Color.WhiteSmoke; lvi.Tag = taskInfo; lvi.Text = taskInfo.ToString(); }