Ejemplo n.º 1
0
        /// <summary>
        /// Occurs when the user click the throbber.
        /// Query the API for or a full update when possible, or show the throbber's context menu.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.MouseEventArgs"/> instance containing the event data.</param>
        private void UpdateThrobber_MouseDown(object sender, MouseEventArgs e)
        {
            UpdateThrobber.Cursor = Cursors.Default;

            CCPCharacter ccpCharacter = m_character as CCPCharacter;

            // This is not a CCP character, it can't be updated
            if (ccpCharacter == null)
            {
                return;
            }

            if (e.Button == MouseButtons.Right)
            {
                return;
            }

            // There has been an error in the past (Authorization, Server Error, etc.)
            // or updating now will return the same data because the cache has not expired
            // or character has no associated API key
            if (UpdateThrobber.State == ThrobberState.Strobing || !ccpCharacter.Identity.ESIKeys.Any() ||
                ccpCharacter.QueryMonitors.Any(x => !x.CanForceUpdate))
            {
                ThrobberContextMenu.Show(MousePosition);
                return;
            }

            // All checks out query everything
            ccpCharacter.QueryMonitors.QueryEverything();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Occurs when the user click the throbber.
        /// Query the API for or a full update when possible, or show the throbber's context menu.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void UpdateThrobber_Click(object sender, EventArgs e)
        {
            var ccpCharacter = m_character as CCPCharacter;

            // This is not a CCP account, it can't be updated
            if (ccpCharacter == null)
            {
                return;
            }

            // There has been an error in the past (Authorization, Server Error, etc.)
            if (UpdateThrobber.State == ThrobberState.Strobing)
            {
                ThrobberContextMenu.Show(MousePosition);
                return;
            }

            // Updating now will return an API error because the cache has not expired.
            if (ccpCharacter.QueryMonitors.Any(x => x.ForceUpdateWillCauseError))
            {
                ThrobberContextMenu.Show(MousePosition);
                return;
            }

            // All checks out query everything
            ccpCharacter.QueryMonitors.QueryEverything();
        }