/// <summary> /// Called when the object gets disposed. /// </summary> internal override void Dispose() { // Unsubscribe events EveMonClient.CharacterAssetsUpdated -= EveMonClient_CharacterAssetsUpdated; EveMonClient.CharacterMarketOrdersUpdated -= EveMonClient_CharacterMarketOrdersUpdated; EveMonClient.CorporationMarketOrdersUpdated -= EveMonClient_CorporationMarketOrdersUpdated; EveMonClient.CharacterContractsUpdated -= EveMonClient_CharacterContractsUpdated; EveMonClient.CorporationContractsUpdated -= EveMonClient_CorporationContractsUpdated; EveMonClient.CharacterIndustryJobsUpdated -= EveMonClient_CharacterIndustryJobsUpdated; EveMonClient.CorporationIndustryJobsUpdated -= EveMonClient_CorporationIndustryJobsUpdated; EveMonClient.CharacterIndustryJobsCompleted -= EveMonClient_CharacterIndustryJobsCompleted; EveMonClient.CorporationIndustryJobsCompleted -= EveMonClient_CorporationIndustryJobsCompleted; EveMonClient.CharacterPlaneteryPinsCompleted -= EveMonClient_CharacterPlaneteryPinsCompleted; EveMonClient.APIKeyInfoUpdated -= EveMonClient_APIKeyInfoUpdated; EveMonClient.TimerTick -= EveMonClient_TimerTick; // Unsubscribe events SkillQueue.Dispose(); CharacterIndustryJobs.Dispose(); CorporationIndustryJobs.Dispose(); PlanetaryColonies.Dispose(); // Unsubscribe events if (m_characterDataQuerying != null) { m_characterDataQuerying.Dispose(); m_characterDataQuerying = null; } if (m_corporationDataQuerying != null) { m_corporationDataQuerying.Dispose(); m_corporationDataQuerying = null; } }
/// <summary> /// Exports the industry jobs. /// </summary> /// <returns></returns> private IEnumerable <SerializableJob> IndustryJobsExport() { // Until we can determine what data the character's API keys can query, // we have to keep the data unprocessed. Once we know, we filter them IEnumerable <SerializableJob> corporationIndustryJobsExport = EveMonClient.ESIKeys.Any(apiKey => !apiKey.IsProcessed) || m_corporationDataQuerying != null ? CorporationIndustryJobs.ExportOnlyIssuedByCharacter() : new List <SerializableJob>(); IEnumerable <SerializableJob> characterIndustryJobsExport = EveMonClient.ESIKeys.Any(apiKey => !apiKey.IsProcessed) || m_characterDataQuerying != null ? CharacterIndustryJobs.Export() : new List <SerializableJob>(); return(characterIndustryJobsExport.Concat(corporationIndustryJobsExport)); }
/// <summary> /// Handles the CharacterIndustryJobsCompleted event of the EveMonClient control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EVEMon.Common.CustomEventArgs.IndustryJobsEventArgs"/> instance containing the event data.</param> private void EveMonClient_CharacterIndustryJobsCompleted(object sender, IndustryJobsEventArgs e) { if (e.Character == this) { m_jobsCompletedForCharacter.AddRange(e.CompletedJobs); // If character has completed corporation issued jobs, wait until those are gathered too if (!CorporationIndustryJobs.Any(job => job.ActiveJobState == ActiveJobState.Ready && !job.NotificationSend)) { EveMonClient.Notifications.NotifyCharacterIndustryJobCompletion(this, m_jobsCompletedForCharacter); // Now that we have send the notification clear the list m_jobsCompletedForCharacter.Clear(); } } }
/// <summary> /// Handles the CharacterIndustryJobsCompleted event of the EveMonClient control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="EVEMon.Common.CustomEventArgs.IndustryJobsEventArgs"/> instance containing the event data.</param> private void EveMonClient_CharacterIndustryJobsCompleted(object sender, IndustryJobsEventArgs e) { if (e.Character != this) { return; } // Add the completed jobs to a list m_jobsCompletedForCharacter.AddRange(e.CompletedJobs); // If character has completed corporation issued jobs, we wait till we gather those too if (CorporationIndustryJobs.Any(job => job.ActiveJobState == ActiveJobState.Ready && !job.NotificationSend)) { return; } // Notify completed jobs issued by the character EveMonClient.Notifications.NotifyCharacterIndustryJobCompletion(this, m_jobsCompletedForCharacter); // Now that we have send the notification clear the list m_jobsCompletedForCharacter.Clear(); }
/// <summary> /// Imports the industry jobs. /// </summary> /// <param name="industryJobs">The industry jobs.</param> private void IndustryJobsImport(IList <SerializableJob> industryJobs) { CharacterIndustryJobs.Import(industryJobs.Where(job => job.IssuedFor == IssuedFor.Character)); CorporationIndustryJobs.Import(industryJobs.Where(job => job.IssuedFor == IssuedFor.Corporation)); }