/// <summary>
 /// Constructor to update a character.
 /// </summary>
 public CharacterImportationWindow(UriCharacter uriCharacter)
     : this()
 {
     m_uriCharacter = uriCharacter;
 }
Exemple #2
0
        /// <summary>
        /// Updates the given character.
        /// </summary>
        /// <param name="character"></param>
        /// <exception cref="System.ArgumentNullException">character</exception>
        public void UpdateCharacter(UriCharacter character)
        {
            character.ThrowIfNull(nameof(character));

            CharacterIdentity identity = GetIdentity(m_result);

            // Updates
            if (m_apiResult != null)
                character.Update(identity, Uri, m_apiResult);
            else
            {
                SerializableCCPCharacter ccpCharacter = m_result as SerializableCCPCharacter;
                character.Update(identity, Uri, ccpCharacter);
            }
        }
        /// <summary>
        /// When the user clicks the OK button, we may have to generate the character
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okButton_Click(object sender, EventArgs e)
        {
            // Shouldn't occur but, well...
            if (m_args == null || m_args.HasError)
            {
                DialogResult = DialogResult.Cancel;
                return;
            }

            // Generates or updates the character
            if (m_uriCharacter == null)
                m_uriCharacter = m_args.CreateCharacter();
            else
                m_args.UpdateCharacter(m_uriCharacter);

            m_uriCharacter.Name = nameTextBox.Text;

            DialogResult = DialogResult.OK;
        }