コード例 #1
0
        /// <summary>
        /// Updates the loadout feed information.
        /// </summary>
        /// <param name="e">The <see cref="LoadoutFeedEventArgs"/> instance containing the event data.</param>
        private void UpdateLoadoutFeedInfo(LoadoutFeedEventArgs e)
        {
            if (IsDisposed)
                return;

            // Restore the default cursor instead of the waiting one
            Cursor = Cursors.Default;
            btnPlan.Enabled = false;

            if (Settings.LoadoutsProvider.Provider == null)
                return;

            // Was there an error ?
            if (e.HasError)
            {
                throbberLoadouts.State = ThrobberState.Strobing;
                lblLoadouts.Text = $"There was a problem connecting to {Settings.LoadoutsProvider.Provider.Name}, " +
                                   $"it may be down for maintainance.{Environment.NewLine}{e.Error.Message}";

                return;
            }

            m_loadoutInfo = Settings.LoadoutsProvider.Provider.DeserializeLoadoutsFeed(m_ship, e.LoadoutFeed);

            // Are there no feeds ?
            if (!m_loadoutInfo.Loadouts.Any())
            {
                throbberLoadouts.State = ThrobberState.Strobing;
                lblLoadouts.Text = $"There are no loadouts for {m_ship.Name}, " +
                                   $"why not submit one to {Settings.LoadoutsProvider.Provider.Name}?";
                return;
            }

            // Add the listview items for every loadout
            foreach (Loadout loadout in m_loadoutInfo.Loadouts)
            {
                ListViewItem lvi = new ListViewItem(loadout.Name) { Text = loadout.Name, Tag = loadout };
                lvi.SubItems.Add(loadout.Author);
                lvi.SubItems.Add(loadout.Rating.ToString(CultureConstants.DefaultCulture));
                lvi.SubItems.Add(loadout.SubmissionDate.ToString("G"));
                lvLoadouts.Items.Add(lvi);
            }

            // Update the header
            lblLoadouts.Text = $"Found {lvLoadouts.Items.Count} loadouts";

            // Update the listview's comparer and sort
            lvLoadouts.Sort();
            UpdateSortVisualFeedback();

            // Adjust the size of the columns
            AdjustColumns();

            throbberLoadouts.State = ThrobberState.Stopped;
            persistentSplitContainer.Visible = lvLoadouts.Items.Count > 0;
        }
コード例 #2
0
 /// <summary>
 /// Occurs when the loadout feed from the provider updated.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
 /// <exception cref="System.NotImplementedException"></exception>
 private void EveMonClient_LoadoutFeedUpdated(object sender, LoadoutFeedEventArgs e)
 {
     UpdateLoadoutFeedInfo(e);
 }