private void Refinery_RetrieveVirtualItem(object a_Sender, RetrieveVirtualItemEventArgs a_QueryArgs) { MainListItem listItem = m_ItemList[a_QueryArgs.ItemIndex]; Object[] columnData = GetListItemColumnData(listItem); a_QueryArgs.Item = new ListViewItem(); ListViewItem.ListViewSubItemCollection subitems = a_QueryArgs.Item.SubItems; bool isQuantityOk = (m_SelectedAssets != null) && m_Engine.m_Settings.Appearance.UseAssetQuantities; for (int i = 0; i < (int)Columns.MaxColumns; i++) { subitems.Add(new ListViewItem.ListViewSubItem()); } if (!ItemPrice.IsValidPrice((double)columnData[(int)Columns.MarketPrice])) { a_QueryArgs.Item.BackColor = Color.White; } else { a_QueryArgs.Item.BackColor = m_Engine.GetPriceColor((double)columnData[(int)Columns.RefinedCost], (double)columnData[(int)Columns.MarketPrice], isQuantityOk); } subitems[(int)Columns.Name].Text = (string)columnData[(int)Columns.Name]; subitems[(int)Columns.MetaLevel].Text = columnData[(int)Columns.MetaLevel].ToString(); subitems[(int)Columns.RefinedCost].Text = ItemPrice.FormatPrice((double)columnData[(int)Columns.RefinedCost]); subitems[(int)Columns.MarketPrice].Text = ItemPrice.FormatPrice((double)columnData[(int)Columns.MarketPrice]); subitems[(int)Columns.PriceDelta].Text = ItemPrice.FormatPrice((double)columnData[(int)Columns.PriceDelta]); subitems[(int)Columns.Yield].Text = String.Format("{0:0.00%}", (double)columnData[(int)Columns.Yield]); subitems[(int)Columns.Tritanium].Text = Engine.FormatDouble((double)columnData[(int)Columns.Tritanium]); subitems[(int)Columns.Pyerite].Text = Engine.FormatDouble((double)columnData[(int)Columns.Pyerite]); subitems[(int)Columns.Mexallon].Text = Engine.FormatDouble((double)columnData[(int)Columns.Mexallon]); subitems[(int)Columns.Isogen].Text = Engine.FormatDouble((double)columnData[(int)Columns.Isogen]); subitems[(int)Columns.Noxcium].Text = Engine.FormatDouble((double)columnData[(int)Columns.Noxcium]); subitems[(int)Columns.Zydrine].Text = Engine.FormatDouble((double)columnData[(int)Columns.Zydrine]); subitems[(int)Columns.Megacyte].Text = Engine.FormatDouble((double)columnData[(int)Columns.Megacyte]); subitems[(int)Columns.Morphite].Text = Engine.FormatDouble((double)columnData[(int)Columns.Morphite]); subitems[(int)Columns.Quantity].Text = String.Format("{0:#,0}", columnData[(int)Columns.Quantity]); subitems[(int)Columns.Type].Text = (string)columnData[(int)Columns.Type]; double lossPercent = (double)columnData[(int)Columns.LossPercent]; bool isInvalidLossPercent = double.IsInfinity(lossPercent); subitems[(int)Columns.LossPercent].Text = isInvalidLossPercent ? "" : String.Format("{0:d}%", (int)(100 * lossPercent)); subitems[(int)Columns.Volume].Text = Engine.FormatDouble((double)columnData[(int)Columns.Volume]); subitems[(int)Columns.RefinedVolume].Text = Engine.FormatDouble((double)columnData[(int)Columns.RefinedVolume]); }
public static string FormatPrice(double a_Price) { if (a_Price == ItemPrice.Empty) { return(""); } else if (a_Price == ItemPrice.Unknown) { return("Unknown"); } else if (a_Price == ItemPrice.NonMarket) { return("Non-Market"); } else if (a_Price == ItemPrice.Outdated) { return("Outdated"); } return(Engine.FormatDouble(a_Price)); }