Esempio n. 1
0
        public void SingleCaptureJPGAndSendFTP(string ftphost,string username,string password)
        {
            try
            {
                ftp = new FtpClient(ftphost,username,password);
                nameOfFile = string.Format(	"{0}.{1}.{2} - {3}.{4}.{5}.jpg",	DateTime.Now.Year,
                    DateTime.Now.Month.ToString().PadLeft(2,'0'),
                    DateTime.Now.Day.ToString().PadLeft(2,'0'),
                    DateTime.Now.Hour.ToString().PadLeft(2,'0'),
                    DateTime.Now.Minute.ToString().PadLeft(2,'0'),
                    DateTime.Now.Second.ToString().PadLeft(2,'0'));

                //capture a JPG
                //System.Drawing.Image fileImage = (System.Drawing.Image)ScreenCapturing.GetDesktopWindowCaptureAsBitmap();
                System.Drawing.Image fileImage = (System.Drawing.Image)CaptureScreen.GetDesktopImage();
                fileImage.Save( this.nameOfFile , System.Drawing.Imaging.ImageFormat.Jpeg );

                //send a JPG to FTP Server
                ftp.Login();
                this.CreateFolder();
                ftp.Upload(nameOfFile);
                ftp.Close();

                System.IO.FileInfo file = new System.IO.FileInfo(this.nameOfFile);
                file.Delete();
            }

            catch {}

            finally
            {
                GC.Collect();
            }
        }
Esempio n. 2
0
        public void Start()
        {
            ftp = new FtpClient("192.168.0.20","planobe","planobe");

            threadClock = new Thread( new ThreadStart( CaptureJPGAndSendFTP ) );
            threadClock.IsBackground = true;
            threadClock.Start();
        }