Ejemplo n.º 1
0
        /// <summary>
        /// Updates the extra data shown on screen.
        /// </summary>
        private void UpdateExtraData()
        {
            string extraText    = string.Empty;
            var    ccpCharacter = Character as CCPCharacter;

            if (m_showLocation)
            {
                // Determine the character's system location
                int locID = Character?.LastKnownLocation?.SolarSystemID ?? 0;
                if (locID == 0)
                {
                    extraText = EveMonConstants.UnknownText + " Location";
                }
                else
                {
                    extraText = StaticGeography.GetSolarSystemName(locID);
                }
            }
            else if (m_showJobs && ccpCharacter != null)
            {
                int    jobs, max, indJobs = 0, resJobs = 0, reaJobs = 0;
                string desc;
                // Sum up by type
                foreach (var job in ccpCharacter.CharacterIndustryJobs)
                {
                    switch (job.Activity)
                    {
                    case BlueprintActivity.Reactions:
                    case BlueprintActivity.SimpleReactions:
                        reaJobs++;
                        break;

                    case BlueprintActivity.Manufacturing:
                        indJobs++;
                        break;

                    case BlueprintActivity.Copying:
                    case BlueprintActivity.Duplicating:
                    case BlueprintActivity.Invention:
                    case BlueprintActivity.ResearchingMaterialEfficiency:
                    case BlueprintActivity.ResearchingTechnology:
                    case BlueprintActivity.ResearchingTimeEfficiency:
                    case BlueprintActivity.ReverseEngineering:
                        resJobs++;
                        break;

                    default:
                        break;
                    }
                }
                // Determine the character's jobs remaining (character only)
                switch ((DateTime.UtcNow.Second / INTERVAL) % 3)
                {
                case 0:
                default:
                    // Industry
                    max  = IndustryJob.MaxManufacturingJobsFor(ccpCharacter);
                    jobs = indJobs;
                    desc = "Indus";
                    break;

                case 1:
                    // Research
                    max  = IndustryJob.MaxResearchJobsFor(ccpCharacter);
                    jobs = resJobs;
                    desc = "Resea";
                    break;

                case 2:
                    // Reaction
                    max  = IndustryJob.MaxReactionJobsFor(ccpCharacter);
                    jobs = reaJobs;
                    desc = "React";
                    break;
                }
                extraText = string.Format("{0:D} / {1:D} {2}", jobs, max, desc);
            }
            lblExtraInfo.Text = extraText;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Update the controls.
        /// </summary>
        private void UpdateContent()
        {
            if (!Visible)
            {
                return;
            }

            // Update character's 'Adorned Name' and 'Portrait' in case they have changed
            lblCharName.Text = Character.LabelPrefix + Character.AdornedName;
            pbCharacterPortrait.Character = Character;
            lblTotalSkillPoints.Text      = string.Format("{0:N0} SP", Character.SkillPoints);

            FormatBalance();

            var         ccpCharacter  = Character as CCPCharacter;
            QueuedSkill trainingSkill = Character.CurrentlyTrainingSkill;

            // Character in training ? We have labels to fill
            if (Character.IsTraining || (ccpCharacter != null && trainingSkill != null &&
                                         ccpCharacter.SkillQueue.IsPaused))
            {
                // Update the skill in training label
                lblSkillInTraining.Text = trainingSkill.ToString();
                DateTime endTime = trainingSkill.EndTime.ToLocalTime();

                // Updates the time remaining label
                lblRemainingTime.Text = (ccpCharacter != null && ccpCharacter.SkillQueue.
                                         IsPaused) ? "Paused" : trainingSkill.RemainingTime.ToDescriptiveText(
                    DescriptiveTextOptions.IncludeCommas);

                // Update the completion time
                lblCompletionTime.Text = (ccpCharacter != null && ccpCharacter.SkillQueue.
                                          IsPaused) ? string.Empty : $"{endTime:ddd} {endTime:G}";

                // Changes the completion time color on scheduling block
                string blockingEntry;
                bool   isAutoBlocking;
                bool   isBlocking = Scheduler.SkillIsBlockedAt(endTime, out blockingEntry,
                                                               out isAutoBlocking);
                lblCompletionTime.ForeColor = (m_showConflicts && isBlocking &&
                                               (ccpCharacter == null || ccpCharacter.SkillQueue.Count == 1 ||
                                                !isAutoBlocking)) ? Color.Red : m_settingsForeColor;

                // Update the skill queue training time label
                UpdateSkillQueueTrainingTime();

                // Show the training labels
                m_hasSkillInTraining        = true;
                m_hasCompletionTime         = true;
                m_hasRemainingTime          = true;
                m_hasSkillQueueTrainingTime = true;
            }
            else
            {
                // Hide the training labels
                m_hasSkillInTraining        = false;
                m_hasCompletionTime         = false;
                m_hasRemainingTime          = false;
                m_hasSkillQueueTrainingTime = false;
            }
            string extraText = string.Empty;

            if (m_showLocation)
            {
                // Determine the character's system location
                int locID = Character?.LastKnownLocation?.SolarSystemID ?? 0;
                if (locID == 0)
                {
                    extraText = EveMonConstants.UnknownText + " Location";
                }
                else
                {
                    extraText = StaticGeography.GetSolarSystemName(locID);
                }
            }
            else if (m_showJobs && ccpCharacter != null)
            {
                // Determine the character's industry jobs remaining (character only)
                extraText = string.Format("{0:D} / {1:D} Jobs", ccpCharacter.
                                          CharacterIndustryJobs.Count, IndustryJob.MaxManufacturingJobsFor(
                                              ccpCharacter));
            }
            lblExtraInfo.Text = extraText;
            // Adjusts all the controls layout
            PerformCustomLayout(m_isTooltip);
        }