Ejemplo n.º 1
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void UCCaptureScreen_DoubleClick(object sender, EventArgs e)
 {
     try
     {
         this.Enabled = !(this.bShowWin = true);
         this.csw = new CaptureScreenWindow();
         this.csw.CopyScreenCutEvent += new CaptureScreenHandler(delegate(Image data)
         {
             if (data != null)
             {
                 string path = string.Format("{0}\\截屏图片_{1:HH-mm-ss}.jpg", System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop), DateTime.Now);
                 data.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);
             }
         });
         this.csw.ShowDialog(this);
     }
     catch (Exception x)
     {
         Program.GlobalExceptionHandler(x);
         this.OnMessageEvent(MessageType.PopupWarn, "截图异常:" + x.Message);
     }
     finally
     {
         this.Enabled = !(this.bShowWin = false);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UCCaptureScreenSet_DoubleClick(object sender, EventArgs e)
        {
            try
            {
                this.Enabled = !(this.bShowWin = true);
                this.csw = new CaptureScreenWindow();
                FileUploadItems items = null;
                this.csw.CopyScreenCutEvent += new CaptureScreenHandler(delegate(Image data)
                {
                    if (data != null)
                    {
                        string path = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
                        Catalog c = this.CoreService["catalog"] as Catalog;
                        if (c != null)
                        {
                            path += string.Format("\\{0}_截屏_{1:HHmmss}.jpg", c.CatalogName, DateTime.Now);
                        }
                        else
                        {
                            path += string.Format("\\截屏_{0:HHmmss}.jpg", DateTime.Now);
                        }
                        data.Save(path, System.Drawing.Imaging.ImageFormat.Jpeg);

                        if (System.IO.File.Exists(path))
                        {
                            items = new FileUploadItems();
                            string strFileName = System.IO.Path.GetFileName(path);
                            string strExt = System.IO.Path.GetExtension(path);

                            items.Add(new FileUploadItem(strFileName, strExt, path));
                        }
                    }
                });
                this.csw.CopyScreenWindowClosed += new EventHandler(delegate(object o, EventArgs x)
                {
                    ThreadPool.QueueUserWorkItem(new WaitCallback(delegate(object obj)
                    {
                        Thread.Sleep(100);
                        this.ThreadSafeMethod(new MethodInvoker(delegate()
                        {
                            this.AddUploadWindow(items);
                        }));
                    }));
                });
                this.csw.ShowDialog(this);
            }
            catch (Exception x)
            {
                Program.GlobalExceptionHandler(x);
                this.OnMessageEvent(MessageType.PopupWarn, "截图异常:" + x.Message);
            }
            finally
            {
                this.Enabled = !(this.bShowWin = false);
            }
        }