예제 #1
0
 void LoadImage(WPF.UCs.ImgBox pImage, string mylocalImage, string imgPath)
 {
     try
     {
         if (File.Exists(mylocalImage) && !m_blnForced2GetImagesFromFTP)
         {
             pImage.fullName = mylocalImage;
             pImage.LoadIMg();
             pImage.Tag = mylocalImage;
             return;
         }
         if (!string.IsNullOrEmpty(imgPath))
         {
             if (!PropertyLib._FTPProperties.IamLocal || m_blnForced2GetImagesFromFTP)
             {
                 FtpClient.CurrentDirectory = string.Format("{0}{1}", _FtpClientCurrentDirectory,
                     objChitiet.IdChitietchidinh.ToString());
                 if (FtpClient.FtpFileExists(FtpClient.CurrentDirectory + imgPath))
                 {
                     string sPath1 = string.Format(@"{0}\{1}\{2}", _baseDirectory,
                     objChitiet.IdChitietchidinh.ToString(), imgPath);
                     Utility.CreateFolder(sPath1);
                     FtpClient.Download(imgPath, sPath1, true);
                     pImage.fullName = sPath1;
                     pImage.LoadIMg();
                     pImage.Tag = sPath1;
                 }
                 else
                 {
                     pImage.fullName = path + @"\Path\noimage.jpg";
                     pImage.LoadIMg();
                     pImage.Tag = "";
                 }
             }
             else//Ảnh trên chính máy tính này
             {
                 pImage.fullName = imgPath;
                 pImage.LoadIMg();
                 pImage.Tag = imgPath;
             }
         }
     }
     catch
     {
     }
     finally
     {
         if (pImage._img.Source == null)
         {
             pImage.fullName = path + @"\Path\noimage.jpg";
             pImage.LoadIMg();
             pImage.Tag = "";
         }
     }
 }