コード例 #1
0
        public static PhotoInfo[] GetPhotoList(ArrayList enumFileList)
        {
            PhotoInfo[] ImageFiles;

            //依次将From文件夹中的所有文件列出来
            if (enumFileList != null)
            {
                ImageFiles = new PhotoInfo[enumFileList.Count];
                PhotoInfo photoInfo;
                int       index = 0;
                foreach (string foundFile in enumFileList)
                {
                    string fileName = Path.GetFullPath(foundFile);
                    string title    = Path.GetFileNameWithoutExtension(fileName);
                    string ext      = Path.GetExtension(fileName).ToLower();
                    if (ext == ".png" || ext == ".bmp" || ext == ".tif" || ext == ".gif" || ext == ".jpg")
                    {
                        if (fileName != string.Empty)
                        {
                            photoInfo         = new PhotoInfo();
                            photoInfo.Path    = fileName;
                            photoInfo.Title   = title;
                            photoInfo.Index   = index;
                            ImageFiles[index] = photoInfo;
                            index++;
                        }
                    }
                }
                return(ImageFiles);
            }

            return(null);
        }
コード例 #2
0
        private void UploadFile(PhotoInfo photo)
        {
            string title = photo.Title;

            //1.拆分文件名获取档号信息
            //2.验证档号信息中的文件级信息是否存在
            //3.上传扫描件
            //4.增加或修改原件信息
            string ArchivesHeader = title.Substring(0, 2);

            switch (ArchivesHeader)
            {
            case "GD":
                uploadScan.UploadFile_GD(title, photo.Path, IsDeleteOld);
                break;

            case "WS":
                uploadScan.UploadFile_WS(title, photo.Path, IsDeleteOld);
                break;

            case "SB":
                uploadScan.UploadFile_SB(title, photo.Path, IsDeleteOld);
                break;

            case "GA":
                uploadScan.UploadFile_GA(title, photo.Path, IsDeleteOld);
                break;

            case "KJ":
                uploadScan.UploadFile_KJ(title, photo.Path, IsDeleteOld);
                break;

            case "CJ":
                break;

            default:
                break;
            }
        }
コード例 #3
0
        private void UploadYJ()
        {
            changeLableTextSafe("上传原件中……");
            setProgressBarValueSafe(0);

            for (int i = 0; i < photoList.Length; i++)
            {
                PhotoInfo photo = (PhotoInfo)photoList[i];
                if (photo.Title != null)
                {
                    changeLableTextSafe("正在上传 " + photo.Title + " ……");
                    setProgressBarValueSafe(i * (100 / photoList.Length));//设置进度条
                    UploadFile(photo);

                    Thread.Sleep(500);//等待1秒
                }
            }

            setProgressBarValueSafe(100);        //进度完成
            changeLableTextSafe("上传完成!");
            System.Threading.Thread.Sleep(1000); //等待1秒

            IsStop = true;
        }