예제 #1
0
        private async void ShowData()
        {
            //Get all products
            var products = await wc.Product.GetAll(new Dictionary <string, string>() {
                { "page", PageID.ToString() }
            });

            Thread.Sleep(2000);
            ITemcoProduct.Clear();
            for (int i = 0; i < (int)products.Count; i++)
            {
                // textBox3.Text += products[i].name + "\n";
                //listBox1.Items.Insert(i, products[i].name);
                TemcoProduct tp = new TemcoProduct();
                tp.ID          = products[i].id.ToString();
                tp.Name        = products[i].name.ToString();
                tp.Description = products[i].description.ToString();
                tp.Price       = products[i].price.ToString();
                tp.Weight      = products[i].weight.ToString();
                tp.ImagesLink  = products[i].images[0].src.ToString();
                tp.SKU         = products[i].sku;
                ITemcoProduct.Add(tp);
            }

            BTProduct = new BindingList <TemcoProduct>(ITemcoProduct);

            this.dataGridView1.DataSource = BTProduct;
        }
예제 #2
0
        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            m_current_Row = e.RowIndex;
            m_current_Col = e.ColumnIndex;

            TemcoProduct tp = new TemcoProduct();

            tp = ITemcoProduct[e.RowIndex];
            textBox_ID.Text     = tp.ID;
            textBox_Name.Text   = tp.Name;
            textBox_Price.Text  = tp.Price;
            textBox_Weight.Text = tp.Weight;

            // string url = @"http://web.sr.gehua.net.cn/r/_u/239/295239/avatar/29523920150327184235.jpg";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(tp.ImagesLink);

            using (WebResponse response = request.GetResponse())
            {
                pictureBox_Image.Image = Image.FromStream(response.GetResponseStream());
            }
            webBrowser_Description.DocumentText = tp.Description;
        }