private void Edit_Click(object sender, EventArgs e) { try { var item = this.Sources.SelectedItems[0]; var editSource = new EditSource(item); var result = editSource.ShowDialog(); if (result == DialogResult.OK) { var vals = editSource.GetValues(); var idx = Sources.Items.IndexOf(item); //Sources.Items[idx].Text = vals.Item1; Sources.Items[idx].SubItems[0].Text = vals.Item1; Sources.Items[idx].SubItems[1].Text = vals.Item2; Sources.Items[idx].SubItems[2].Text = vals.Item3; // Not setting date here SaveSources(); PopulateControls(); } } catch (Exception ex) { Program.DisplayError(ex); } }
private void AddDirectory_Click(object sender, EventArgs e) { try { var editSource = new EditSource(); var result = editSource.ShowDialog(); if (result == DialogResult.OK) { var vals = editSource.GetValues(); Sources.Items.Add( new ListViewItem(new string[] { vals.Item1, vals.Item2, vals.Item3, Source.NeverText })); } SaveSources(); } catch (Exception ex) { Program.DisplayError(ex); } }