Beispiel #1
0
 private ImgWithPath GetNextImageFromDisk()
 {
     try
     {
         ImgWithPath obj   = new ImgWithPath();
         int         Count = DI.GetFiles("*.jpg").Count();
         if (Count == 0)
         {
             string path = Path.Combine(System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location), "EmptyFolder.jpg");
             obj.Path = path;
             obj.Img  = System.Drawing.Image.FromFile(path);
             return(obj);
         }
         if (Iteration == Count)
         {
             Iteration = 0;
         }
         FileInfo file = DI.GetFiles("*.jpg")[Iteration];
         obj.Img  = System.Drawing.Image.FromFile(file.FullName);
         obj.Path = file.FullName;
         Iteration++;
         //logger.Info("Имя анализируемого файла: "+ file.FullName);
         return(obj);
     }
     catch (Exception ex)
     {
         logger.Error("Cant get file from LoadFolder: " + ex.Message);
     }
     return(null);
 }
Beispiel #2
0
 public void Start()
 {
     if (IsItHddScanner)
     {
         ImgWithPath obj = GetNextImageFromDisk();
         ImageChanged(this, new ImageChangedEventArgs(obj.Img, obj.Path));
     }
 }
Beispiel #3
0
        private void NextImage()
        {
            while (!isStopped)
            {
                //  читай файл, вызывай евент
                //
                ImgWithPath obj = GetNextImageFromDisk();

                // lastImage = obj.Img;
                ImageChanged(this, new ImageChangedEventArgs(obj.Img, obj.Path));

                System.Windows.Forms.Application.DoEvents();
                System.Threading.Thread.Sleep(TimeToSleep);
            }
        }