private void buttonAddProfile_Click(object sender, EventArgs e) { Form f = new FormNewProfile(((FormMain)parent).dm); f.Tag = this.Tag; f.ShowDialog(); ((FormMain)parent).ds.SerializeDataModel(); ((FormMain)parent).listProfilesRefresh(); this.listProfilesRefresh(); if (this.listProfiles.Items.Count > 0) this.listProfiles.SelectedIndex = this.listProfiles.Items.Count - 1; }
public void buttonAddProfile_Click(object sender, EventArgs e) { Form f = new FormNewProfile(dm); f.Tag = this; f.ShowDialog(); ds.SerializeDataModel(); listProfilesRefresh(); listViewProfiles.Select(); if (listViewProfiles.Items.Count > 0) { listViewProfiles.Items[listViewProfiles.Items.Count - 1].Selected = true; listViewProfiles.Items[listViewProfiles.Items.Count - 1].Focused = true; } }
private void buttonEditProfile_Click(object sender, EventArgs e) { int i = -1; if (listViewProfiles.SelectedItems.Count > 0) { i = listViewProfiles.SelectedIndices[0]; Form f = new FormNewProfile(dm, ((Profile)listViewProfiles.SelectedItems[0].Tag)); f.Tag = this; f.ShowDialog(); ds.SerializeDataModel(); listProfilesRefresh(); listViewProfiles.Items[i].Selected = true; listViewProfiles.Items[i].Focused = true; listViewProfiles.Select(); } }