예제 #1
0
        /// <summary>
        /// Processes the queried character's market orders. Called from the history fetch on
        /// success or failure, but merges the original orders too.
        /// </summary>
        /// <param name="result"></param>
        /// <remarks>This method is sensitive to which "issued for" orders gets queried first</remarks>
        private void OnMarketOrdersCompleted(EsiResult <EsiAPIMarketOrders> result,
                                             object regularOrders)
        {
            var target = m_ccpCharacter;

            // Character may have been deleted since we queried
            if (target != null && regularOrders is EsiAPIMarketOrders orders)
            {
                var endedOrders = new LinkedList <MarketOrder>();
                var allOrders   = new EsiAPIMarketOrders();
                // Add normal orders first
                if (orders != null)
                {
                    allOrders.AddRange(orders);
                }
                // Add result second
                if (result != null && !result.HasError && result.Result != null)
                {
                    allOrders.AddRange(result.Result);
                }
                allOrders.SetAllIssuedBy(target.CharacterID);
                target.CharacterMarketOrders.Import(allOrders, IssuedFor.Character,
                                                    endedOrders);
                EveMonClient.OnCharacterMarketOrdersUpdated(target, endedOrders);
                allOrders.Clear();
                // Notify if either one failed
                if (result != null && result.HasError)
                {
                    EveMonClient.Notifications.NotifyCharacterMarketOrdersError(target,
                                                                                result);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Processes the queried character's market orders. Called from the history fetch on
        /// success or failure, but merges the original orders too.
        /// </summary>
        /// <param name="result"></param>
        /// <remarks>This method is sensitive to which "issued for" orders gets queried first</remarks>
        private void OnMarketOrdersCompleted(EsiResult <EsiAPIMarketOrders> result,
                                             object regularOrders)
        {
            var target = m_ccpCharacter;

            // Character may have been deleted since we queried
            if (target != null && regularOrders is EsiAPIMarketOrders orders)
            {
                var endedOrders = new LinkedList <MarketOrder>();
                var allOrders   = new EsiAPIMarketOrders();
                m_orderHistoryResponse = result.Response;
                // Ignore the If-Modified-Since and cache timer on order history to ensure
                // that old orders are not wiped out
                if (m_orderHistoryResponse != null)
                {
                    m_orderHistoryResponse.Expires = null;
                    m_orderHistoryResponse.ETag    = null;
                }
                // Add normal orders first
                if (orders != null)
                {
                    allOrders.AddRange(orders);
                }
                // Add result second
                if (result != null && !result.HasError && result.Result != null)
                {
                    allOrders.AddRange(result.Result);
                }
                allOrders.SetAllIssuedBy(target.CharacterID);
                target.CharacterMarketOrders.Import(allOrders, IssuedFor.Character,
                                                    endedOrders);
                EveMonClient.OnCharacterMarketOrdersUpdated(target, endedOrders);
                allOrders.Clear();
                // Notify if either one failed
                if (result != null && result.HasError)
                {
                    EveMonClient.Notifications.NotifyCharacterMarketOrdersError(target,
                                                                                result);
                }
            }
        }