Esempio n. 1
0
        private void AddRecordButton_Click(object sender, EventArgs e)
        {
            AdEditorForm aef = new AdEditorForm(_igaconnector);
            aef.ShowDialog();

            if (aef.Success)
            {
                // success!
                try
                {
                    uint newcid = _igaconnector.NewEntry(aef.Entry);

                    MessageBox.Show("Record added successfully.  You should now import a DDS image for the ad.\r\n\r\nThe new record's contentId is " + newcid.ToString() + ".", "Ad Cache Editor", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (DatabaseUpdateFailureException)
                {
                    MessageBox.Show("There was a problem trying to updating the cache file!");
                }

                RefreshList();
            }
        }
Esempio n. 2
0
        private void EditRecordButton_Click(object sender, EventArgs e)
        {
            if (CacheEntryList.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select only one item first.");
            }
            else
            {
                uint contentId = UInt32.Parse(CacheEntryList.SelectedItems[0].SubItems[0].Text);
                ContentEntry entry = _igaconnector.GetEntry(contentId, false);
                if (entry == null)
                {
                    MessageBox.Show("Oops, no data was returned from IGADatabaseConnector.GetEntry.  This probably means that there was a problem retriving the row from the database, or it doesn't exist.");
                    return;
                }
                AdEditorForm aef = new AdEditorForm(_igaconnector, entry);
                aef.ShowDialog();
                if (aef.Success)
                {

                    try
                    {
                        _igaconnector.EditEntry(contentId, aef.Entry, false);
                    }
                    catch (DatabaseUpdateFailureException)
                    {
                        MessageBox.Show("There was a problem updating the database.  The record you tried to update may have been deleted by another program, or the record could have been orphaned by the ad software (in which case it will NEVER show in the game until you make a new copy of this ad).");
                    }
                    RefreshList();
                }
            }
        }