Example #1
0
        private void ReloadSelectedTilesPanel()
        {
            lstvTileAttributes.Items.Clear();

            foreach (var ta in TileHandler.GetAttributeCountOfSelectedTiles())
            {
                if (ta.Value == 0)
                {
                    continue;
                }

                //If this item has already been added, just update it. Otherwise create it.
                ListViewItem lstvItem = lstvTileAttributes.Items.Count != 0 ? lstvTileAttributes.Items.Cast <ListViewItem>().FirstOrDefault(x => (TileAttributes)x.Tag == ta.Key) : null;
                if (lstvItem == null)
                {
                    //Add an item.
                    lstvItem     = new ListViewItem(ta.Key.ToString() + " (" + ta.Value + "/" + TileHandler.SelectedTiles.Count + ")", 0);
                    lstvItem.Tag = ta.Key;

                    //The data.
                    //lstvItem.SubItems.Add(item.ResourceItem.ResourceData.LastName);

                    //Add the item row to the list view.
                    lstvTileAttributes.Items.Add(lstvItem);
                }
                else
                {
                    //Just update what's neccessary.
                    //lstvItem.SubItems[5].Text = item.Location.ToString();
                }
            }

            cmbTileAttribute.Items.Clear();
            cmbTileAttribute.Items.AddRange(Enum.GetValues(typeof(TileAttributes)).OfType <object>().ToArray());
        }