private void editBtn_Click(object sender, EventArgs e) { VenueState selectedVenueState = (VenueState)list.SelectedItems[0].Tag; VenueEditor editor = new VenueEditor(selectedVenueState); editor.Text = Strings.EditVenue; editor.Closing += new CancelEventHandler(CheckForDupIP); editor.Closing += new CancelEventHandler(CheckForDupID); DialogResult dr = editor.ShowDialog(); if (dr == DialogResult.OK) { VenueState newVenueState = editor.GetVenueState(); if (newVenueState.Identifier != selectedVenueState.Identifier) { // The venue identifier was edited, so we need to completely delete & re-add this venue StorageFile.DeleteVenue(selectedVenueState.Identifier); StorageFile.AddVenue(newVenueState); } else { StorageFile.UpdateVenue(newVenueState); } // Don't remove the image; it will screw up the images for all of the other venues // But we will check to see if the image has changed (if not, just use the old imageIndex) int imageIndex; if (newVenueState.Venue.Icon == selectedVenueState.Venue.Icon) { imageIndex = list.SelectedItems[0].ImageIndex; } else { imageIndex = AddVenueIcon(newVenueState.Venue.Icon); } // Remove the old item list.Items.RemoveAt(list.SelectedIndices[0]); // Create and add the new item list.Items.Add(CreateLvi(newVenueState, imageIndex)); } }
private void newBtn_Click(object sender, EventArgs e) { VenueEditor editor = new VenueEditor(new VenueState()); editor.Text = Strings.NewVenue; editor.Closing += new CancelEventHandler(CheckForDupIP); editor.Closing += new CancelEventHandler(CheckForDupID); DialogResult dr = editor.ShowDialog(); if (dr == DialogResult.OK) { // Get the new venue VenueState venueState = editor.GetVenueState(); // Store it StorageFile.AddVenue(venueState); // Create the new LVI int imageIndex = AddVenueIcon(venueState.Venue.Icon); // Add it to the list list.Items.Add(CreateLvi(venueState, imageIndex)); } }
private void newBtn_Click(object sender, EventArgs e) { VenueEditor editor = new VenueEditor(new VenueState()); editor.Text = Strings.NewVenue; editor.Closing += new CancelEventHandler(CheckForDupIP); editor.Closing += new CancelEventHandler(CheckForDupID); DialogResult dr = editor.ShowDialog(); if (dr == DialogResult.OK) { // Get the new venue VenueState venueState = editor.GetVenueState(); // Store it StorageFile.AddVenue(venueState); // Create the new LVI int imageIndex = AddVenueIcon(venueState.Venue.Icon); // Add it to the list list.Items.Add (CreateLvi(venueState, imageIndex)); } }
private void editBtn_Click(object sender, EventArgs e) { VenueState selectedVenueState = (VenueState)list.SelectedItems[0].Tag; VenueEditor editor = new VenueEditor(selectedVenueState); editor.Text = Strings.EditVenue; editor.Closing += new CancelEventHandler(CheckForDupIP); editor.Closing += new CancelEventHandler(CheckForDupID); DialogResult dr = editor.ShowDialog(); if (dr == DialogResult.OK) { VenueState newVenueState = editor.GetVenueState(); if (newVenueState.Identifier != selectedVenueState.Identifier) { // The venue identifier was edited, so we need to completely delete & re-add this venue StorageFile.DeleteVenue(selectedVenueState.Identifier); StorageFile.AddVenue(newVenueState); } else { StorageFile.UpdateVenue(newVenueState); } // Don't remove the image; it will screw up the images for all of the other venues // But we will check to see if the image has changed (if not, just use the old imageIndex) int imageIndex; if (newVenueState.Venue.Icon == selectedVenueState.Venue.Icon) imageIndex = list.SelectedItems[0].ImageIndex; else imageIndex = AddVenueIcon(newVenueState.Venue.Icon); // Remove the old item list.Items.RemoveAt(list.SelectedIndices[0]); // Create and add the new item list.Items.Add (CreateLvi(newVenueState, imageIndex)); } }