Ejemplo n.º 1
0
        private void refreshListViewDress()
        {
            listViewDress.Items.Clear();
            string fullPath = treeViewCategory.SelectedNode.FullPath.ToString();
            Data   dressIds = ShardDb.getDressIdsByCondition(fullPath);

            if (!dressIds.Success)
            {
                this.Close();
                return;
            }
            if (dressIds.DataTable != null && dressIds.DataTable.Rows.Count > 0)
            {
                Data thumbnailData = ShardDb.getThumbnailsByIds(dressIds.DataTable);
                if (!thumbnailData.Success)
                {
                    this.Close();
                    return;
                }
                ImageList imageList = new ImageList();
                foreach (DataRow row in thumbnailData.DataTable.Rows)
                {
                    if (row.ItemArray[1] != DBNull.Value)
                    {
                        imageList.Images.Add(row.ItemArray[0].ToString(), Image.FromStream(new MemoryStream((byte[])row.ItemArray[1])));
                    }
                }
                imageList.ImageSize          = new Size(100, 100);
                listViewDress.LargeImageList = imageList;

                for (int j = 0; j < imageList.Images.Count; j++)
                {
                    ListViewItem item = new ListViewItem();
                    item.ImageKey = imageList.Images.Keys[j];
                    this.listViewDress.Items.Add(item);
                }
            }
        }