private void SaveItem(SampleListItem item, string dirPath, WebClient client)
        {
            string fileUrl = item.PicPath;
            fileUrl = fileUrl.Substring(fileUrl.LastIndexOf('/')).TrimStart('/');
            string imgName = fileUrl.Substring(0, fileUrl.LastIndexOf('.'));

            string ext = fileUrl.Substring(fileUrl.LastIndexOf('.'));
            string fileName = item.Id + "_" + imgName + ext;
            string infoName = fileName + ".info";

            if (Directory.GetFiles(dirPath, infoName, SearchOption.TopDirectoryOnly).Length == 0)
            {
                string filePath = string.Format(@"{0}\{1}", dirPath, fileName);
                string infoPath = string.Format(@"{0}\{1}", dirPath, infoName);
                client.DownloadFile(item.PicPath, filePath);

                using (StreamWriter writer = new StreamWriter(infoPath, false, Encoding.UTF8))
                {
                    writer.WriteLine(string.Format("ItemId:{0}", item.Id));
                    writer.WriteLine(string.Format("ItemTitle:{0}", item.Title));
                    writer.WriteLine(string.Format("ItemPrice:{0}", item.Price));
                    writer.WriteLine(string.Format("ImageLocalPath:{0}", filePath));
                    writer.WriteLine(string.Format("ImageUrl:{0}", item.PicPath));
                    writer.Flush();
                }
            }
        }
 private void btnOk_Click(object sender, EventArgs e)
 {
     selectedIidList = new List<SampleListItem>();
     foreach (CtrlItem ctrl in fpnlList.Controls)
     {
         if (ctrl.Checked)
         {
             SampleListItem item = new SampleListItem();
             item.Id = ctrl.Iid;
             item.Title = ctrl.ItemName;
             item.Price = ctrl.Price;
             item.PicPath = ctrl.ImagePath;
             item.Location = ctrl.ImageUrl;
             selectedIidList.Add(item);
         }
     }
     DialogResult = DialogResult.OK;
     this.Close();
 }