public void Refresh() { if (this.Target != null) { lblName.Text = String.Concat("Corpse of ", this.Target.Name.A(this.Target.Properties.GetValue <bool>("HasProperName"))); lstInventory.Children.Clear(); foreach (var item in this.Target.Inventory.GetContents().Where(i => !ActorHelper.HasFlag(i, "NoSell") && i.Properties.GetValue <bool>("IsInventoryItem"))) { ItemListItem listItem = ItemListItem.Create(item); listItem.CommerceType = CommerceType.Get; listItem.Action += new ActionEventHandler(OnListItemAction); listItem.Refresh(); lstInventory.Children.Add(listItem); } } }
public void Refresh() { if (this.Target != null) { lstGoods.Children.Clear(); foreach (var item in this.Target.Inventory.GetContents().Where(i => !ActorHelper.HasFlag(i, "NoSell"))) { // Ensure that the buy prices have been set. ItemHelper.EnsureBuyCost(item, this.Target.Properties.GetValue <double>("MarkupPercentage")); ItemListItem listItem = ItemListItem.Create(item); listItem.CommerceType = CommerceType.Buy; listItem.Action += new ActionEventHandler(OnListItemAction); listItem.Refresh(); lstGoods.Children.Add(listItem); } this.HideLoading(); } if (this.Player != null) { lstInventory.Children.Clear(); foreach (var item in this.Player.Inventory.GetContents().Where(i => !ActorHelper.HasFlag(i, "NoSell"))) { // Ensure that the sell prices have been set. if (this.Target != null) { ItemHelper.EnsureSellCost(item, this.Target.Properties.GetValue <double>("MarkdownPercentage")); } ItemListItem listItem = ItemListItem.Create(item); listItem.CommerceType = CommerceType.Sell; listItem.Action += new ActionEventHandler(OnListItemAction); listItem.Refresh(); lstInventory.Children.Add(listItem); } } }