void helper_RequestCompleted_get_category_list(object o)
        {
            string strres = (string)o;

            Debug.WriteLine(
                string.Format("helper_RequestCompleted_get_syc_list  ->  = {0}"
                              , strres));
            object            olist = fastJSON.JSON.Instance.ToObjectList(strres, typeof(List <ProductCategory>), typeof(ProductCategory));
            deleControlInvoke dele  = delegate(object ol)
            {
                List <ProductCategory> resList = (List <ProductCategory>)ol;
                myCategoryList.Clear();
                if (resList.Count > 0)
                {
                    myCategoryList.AddRange(resList);
                    for (int i = 0; i < resList.Count; i++)
                    {
                        DataTable dt = null;
                        if (this.dgvProductInfo.DataSource == null)
                        {
                            dt = new DataTable();
                            dt.Columns.Add("产品编号", typeof(string));
                            dt.Columns.Add("产品名称", typeof(string));
                            dt.Columns.Add("产品图片", typeof(string));
                        }
                        else
                        {
                            dt = (DataTable)dgvProductInfo.DataSource;
                        }
                        dt.Rows.Clear();
                        foreach (ProductCategory p in resList)
                        {
                            dt.Rows.Add(new object[] {
                                p.category_id,
                                p.category_name,
                                p.category_image
                            });
                        }
                        dgvProductInfo.DataSource = dt;

                        this.resize_datagrid();
                        //this.listBox1.Items.Add("查询到产品种类:ID: "+resList[i].category_id + "  名称:" + resList[i].category_name+"  图片:"+resList[i].category_image);
                    }
                }
            };

            this.Invoke(dele, olist);
            ResSyncer rs = new ResSyncer();

            rs.start_sync("ProductCategory");
        }
示例#2
0
        void helper_RequestCompleted_get_category_list(object o)
        {
            string strres = (string)o;

            Debug.WriteLine(
                string.Format("helper_RequestCompleted_get_category_list  ->  = {0}"
                              , strres));
            object olist = fastJSON.JSON.Instance.ToObjectList(strres, typeof(List <ProductCategory>), typeof(ProductCategory));
            List <ProductCategory> resList = (List <ProductCategory>)olist;

            if (resList.Count > 0)
            {
                for (int i = 0; i < resList.Count; i++)
                {
                    ProductCategory pc = resList[i];
                    MemoryTable.AddNewConfig(
                        pc.category_id,
                        pc.category_image,
                        default_image_width,
                        default_image_height,
                        default_min_count,
                        pc.category_name,
                        (int)default_product_color.R, (int)default_product_color.G, default_product_color.B,
                        "尚未设置"
                        );
                }
            }

            //deleControlInvoke dele = delegate(object ol)
            //{

            //};
            //this.Invoke(dele, olist);
            ResSyncer rs = new ResSyncer();

            rs.start_sync("ProductCategory");
        }