Exemple #1
0
        /// <summary>
        /// Occurs when we downloaded a loadout from Battleclinic
        /// </summary>
        /// <param name="feed"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        private void OnLoadoutDownloaded(SerializableLoadoutFeed loadoutFeed, string errorMessage)
        {
            if (this.IsDisposed)
            {
                return;
            }

            // Reset the controls
            btnPlan.Enabled = false;
            m_prerequisites.Clear();
            tvLoadout.Nodes.Clear();
            Cursor.Current = Cursors.Default;

            // Was there an error ?
            if (!String.IsNullOrEmpty(errorMessage) || loadoutFeed.Race.Loadouts.Length == 0)
            {
                lblTrainTime.Text    = "Couldn't download that loadout.\r\n" + errorMessage;
                lblTrainTime.Visible = true;
                return;
            }

            var loadout = loadoutFeed.Race.Loadouts[0];

            // Fill the items tree
            var slotTypes = loadout.Slots.GroupBy(x => x.SlotType);

            foreach (var slotType in slotTypes)
            {
                TreeNode typeNode = new TreeNode(s_typeMap[slotType.Key]);

                foreach (var slot in slotType)
                {
                    Item item = StaticItems.GetItem(slot.ItemID);
                    if (item == null)
                    {
                        continue;
                    }

                    TreeNode slotNode = new TreeNode();
                    slotNode.Text = item.Name;
                    slotNode.Tag  = item;
                    typeNode.Nodes.Add(slotNode);

                    m_prerequisites.AddRange(item.Prerequisites);
                }

                tvLoadout.Nodes.Add(typeNode);
            }

            // Compute the training time
            UpdatePlanningControls();
            tvLoadout.ExpandAll();
        }
Exemple #2
0
 /// <summary>
 /// Constructor from the API.
 /// </summary>
 /// <param name="src"></param>
 protected MarketOrder(SerializableAPIOrder src)
 {
     m_state           = GetState(src);
     m_orderID         = src.OrderID;
     m_item            = StaticItems.GetItem(src.ItemID);
     m_station         = StaticGeography.GetStation(src.StationID);
     m_unitaryPrice    = src.UnitaryPrice;
     m_initialVolume   = src.InitialVolume;
     m_remainingVolume = src.RemainingVolume;
     m_lastStateChange = DateTime.UtcNow;
     m_minVolume       = src.MinVolume;
     m_duration        = src.Duration;
     m_issued          = src.Issued;
 }