Пример #1
0
        //加载图片
        private void LoadPhotos(decimal dock_id, decimal pms_id, string dir)
        {
            using (OCR.Model.OcrPhoto.T_OCR_PHOTODataTable ds = SearchBLL.GetPhoto(dock_id))
            {
                OCR.Model.OcrDBPmsServer pms = OcrDBPmsServerList[Convert.ToInt32(pms_id)];

                if (pms == null)
                {
                    throw new Exception("图片服务器设置异常");
                }

                string path = string.Format(@"http://{0}:{1}", pms.Ip, pms.Port);

                foreach (OCR.Model.OcrPhoto.T_OCR_PHOTORow dr in ds)
                {
                    //int photo_pos = Convert.ToInt32(dr["PHOTO_POS"]);
                    string url = string.Format(@"{0}{1}", path, dr.PHOTO_URL);

                    SavePic(url, string.Format(@"{0}\{1}.jpg", dir, dr.PHOTO_ID));
                }
            }
        }
Пример #2
0
        //¼ÓÔØͼƬ
        private void LoadPhotos()
        {
            using (OcrPhoto.T_OCR_PHOTODataTable ds = SearchBLL.GetPhoto(dock_id))
            {
                string url1 = string.Empty;
                string url2 = string.Empty;
                string url3 = string.Empty;
                string url4 = string.Empty;
                string url5 = string.Empty;
                string url6 = string.Empty;
                string url7 = string.Empty;
                string url8 = string.Empty;

                OcrDBPmsServer pms = OcrDBPmsServerList[Convert.ToInt32(pms_id)];

                if (pms == null)
                {
                    throw new Exception("ͼƬ·þÎñÆ÷ÉèÖÃÒì³£");
                }

                string path = string.Format(@"http://{0}:{1}", pms.Ip, pms.Port);

                foreach (OcrPhoto.T_OCR_PHOTORow dr in ds)
                {
                    //int photo_pos = Convert.ToInt32(dr["PHOTO_POS"]);
                    string url = string.Format(@"{0}{1}", path, dr.PHOTO_URL);

                    switch (Convert.ToInt32(dr.PHOTO_POS))
                    {
                    case 1:
                        url1 = url;
                        break;

                    case 2:
                        url2 = url;
                        break;

                    case 3:
                        url3 = url;
                        break;

                    case 4:
                        url4 = url;
                        break;

                    case 5:
                        url5 = url;
                        break;

                    case 6:
                        url6 = url;
                        break;

                    case 7:
                        url7 = url;
                        break;

                    case 8:
                        url8 = url;
                        break;
                    }
                }

                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb1, url1));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb2, url2));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb3, url4));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb4, url3));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb5, url5));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb6, url6));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb7, url7));
                ThreadPool.QueueUserWorkItem(new WaitCallback(LoadPhotoAsy), new LoadPhotoState(pb8, url8));
            }
        }