/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="character"></param>
        public CharacterDeletionWindow(Character character)
        {
            InitializeComponent();
            m_character = character;
            m_account = character.Identity.Account;

            // Replaces end of text with character's name
            string newText = label1.Text.Replace("a character", m_character.Name);
            label1.Text = newText;

            // Checks whether there will be no characters left after this deletion and hide/display the relevant labels.
            int charactersLeft = EveClient.Characters.Count(x => x.Identity.Account == m_account);
            bool noCharactersLeft = (m_account != null && m_character is CCPCharacter && charactersLeft == 1);
            noCharactersCheckBox.Visible = noCharactersLeft;
            noCharactersLabel.Visible = noCharactersLeft;
        }
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="account"></param>
        public AccountDeletionWindow(Account account)
        {
            InitializeComponent();
            m_account = account;

            // Add characters
            charactersListView.Items.Clear();
            foreach (var id in account.CharacterIdentities)
            {
                // Skip if there is no CCP character for this identity.
                var ccpCharacter = id.CCPCharacter;
                if (ccpCharacter == null) continue;

                // Add an item for this character
                var item = new ListViewItem(ccpCharacter.Name);
                item.Tag = ccpCharacter;
                item.Checked = true;
                charactersListView.Items.Add(item);
            }
        }
        /// <summary>
        /// Creates or updates the account.
        /// </summary>
        /// <returns></returns>
        public Account CreateOrUpdate()
        {
            // Checks whether this account already exists to update it.
            var account = EveClient.Accounts[m_userID];
            if (account != null)
            {
                account.UpdateAPIKey(m_apiKey, m_keyLevel, m_identities, m_serialCharacterList, m_serialAccountStatus);

                // Collection did not change but there is no "AccountChanged" event
                EveClient.OnAccountCollectionChanged();
            }
            else
            {
                account = new Account(m_userID);
                account.UpdateAPIKey(m_apiKey, m_keyLevel, m_identities, m_serialCharacterList, m_serialAccountStatus);
                EveClient.Accounts.Add(account, true);
            }

            return account;
        }
 /// <summary>
 /// Constructor for editing an existing account.
 /// </summary>
 /// <param name="account"></param>
 public AccountUpdateOrAdditionWindow(Account account)
     : this()
 {
     m_account = account;
     m_updateMode = (account != null);
 }
        /// <summary>
        /// Validates the operation and closes the window.
        /// </summary>
        private void Complete()
        {
            if (m_creationArgs == null)
                return;
            m_account = m_creationArgs.CreateOrUpdate();

            // Takes care of the ignore list
            foreach (ListViewItem item in charactersListView.Items)
            {
                var id = (CharacterIdentity)item.Tag;
                if (item.Checked)
                {
                    m_account.IgnoreList.Remove(id);
                }
                else
                {
                    var ccpCharacter = id.CCPCharacter;
                    if (ccpCharacter != null)
                        m_account.IgnoreList.Add(ccpCharacter);
                }
            }

            // Closes the window
            Close();
        }
Example #6
0
 /// <summary>
 /// Called when an account status has been updated.
 /// </summary>
 /// <param name="account">The account.</param>
 internal static void OnAccountStatusUpdated(Account account)
 {
     Trace("EveClient.OnAccountStatusUpdated - {0}", account);
     if (AccountStatusUpdated != null)
         AccountStatusUpdated(null, EventArgs.Empty);
 }
Example #7
0
 /// <summary>
 /// Called when all account characters 'skill in training' check has been updated.
 /// </summary>
 /// <param name="account">The account.</param>
 /// <param name="character">The character.</param>
 internal static void OnAccountCharactersSkillInTrainingUpdated(Account account)
 {
     Trace("EveClient.OnAccountCharactersSkillInTrainingUpdated - {0}", account);
     if (AccountCharactersSkillInTrainingUpdated != null)
         AccountCharactersSkillInTrainingUpdated(null, EventArgs.Empty);
 }
Example #8
0
 /// <summary>
 /// Called when the character list changed.
 /// </summary>
 /// <param name="account">The account.</param>
 internal static void OnCharacterListChanged(Account account)
 {
     Trace("EveClient.OnCharacterListChanged - {0}", account);
     Settings.Save();
     if (CharacterListChanged != null)
         CharacterListChanged(null, EventArgs.Empty);
 }