Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        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));
            }
        }
Esempio n. 3
0
        private void newBtn_Click(object sender, EventArgs e)
        {
            VenueEditor editor = new VenueEditor(new Venue());
            editor.Text = "New Venue";
            editor.Closing += new CancelEventHandler(CheckForDupIP);
            editor.Closing += new CancelEventHandler(CheckForDupID);
            DialogResult dr = editor.ShowDialog();

            if (dr == DialogResult.OK)
            {
                // Get the new venue
                Venue venue = editor.GetVenue();

                // Store it
                StorageFile.AddVenue(venue);

                // Create the new LVI
                int imageIndex = AddVenueIcon(venue.Icon);

                // Add it to the list
                list.Items.Add (CreateLvi(venue, imageIndex));
            }
        }
Esempio n. 4
0
        private void editBtn_Click(object sender, EventArgs e)
        {
            Venue selectedVenue = (Venue)list.SelectedItems[0].Tag;
            VenueEditor editor = new VenueEditor(selectedVenue);
            editor.Text = "Edit Venue";
            editor.Closing += new CancelEventHandler(CheckForDupIP);
            editor.Closing += new CancelEventHandler(CheckForDupID);
            DialogResult dr = editor.ShowDialog();

            if (dr == DialogResult.OK)
            {
                Venue editedVenue = editor.GetVenue();

                if (editedVenue.Identifier != selectedVenue.Identifier)
                {
                    // The venue identifier was edited, so we need to completely delete & re-add this venue
                    StorageFile.DeleteVenue(selectedVenue.Identifier);
                    StorageFile.AddVenue(editedVenue);
                }
                else
                {
                    StorageFile.UpdateVenue(editedVenue);
                }

                // 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 (editedVenue.Icon == selectedVenue.Icon)
                    imageIndex = list.SelectedItems[0].ImageIndex;
                else
                    imageIndex = AddVenueIcon(editedVenue.Icon);

                // Remove the old item
                list.Items.RemoveAt(list.SelectedIndices[0]);

                // Create and add the new item
                list.Items.Add (CreateLvi(editedVenue, imageIndex));
            }
        }