예제 #1
0
        public void WindowCapture()
        {
            ScreenPath = OwnShotHelpers.RandomName(ssnamelength) + ".png";

            SetWindowStyle(true);
            System.Threading.Thread.Sleep(25);

            OwnShotHelpers.WindowCapture(ScreenPath);

            ShowBalloon(OwnShotHelpers.UploadImage(ScreenPath));

            if (OwnShotHelpers.GetConfig("DeleteMode") == "Yes")
            {
                File.Delete(ScreenPath);
            }
        }
예제 #2
0
        private void image1_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            selectionRectangle.MouseUp   -= image1_MouseLeftButtonUp;
            selectionRectangle.MouseMove -= image1_MouseMove;
            BackPanel.MouseUp            -= image1_MouseLeftButtonUp;
            BackPanel.MouseMove          -= image1_MouseMove;
            image.MouseUp   -= image1_MouseLeftButtonUp;
            image.MouseMove -= image1_MouseMove;

            if (selectionRectangle.Width > 0)
            {
                this.Hide();
                Rect      rect1  = new Rect(Canvas.GetLeft(selectionRectangle), Canvas.GetTop(selectionRectangle), selectionRectangle.Width, selectionRectangle.Height);
                Int32Rect rcFrom = new Int32Rect();
                rcFrom.X      = (int)((rect1.X) * (image.Source.Width) / (image.Width));
                rcFrom.Y      = (int)((rect1.Y) * (image.Source.Height) / (image.Height));
                rcFrom.Width  = (int)((rect1.Width) * (image.Source.Width) / (image.Width));
                rcFrom.Height = (int)((rect1.Height) * (image.Source.Height) / (image.Height));
                BitmapSource bs            = new CroppedBitmap(image.Source as BitmapSource, rcFrom);
                var          PreScreenPath = "";
                using (MemoryStream outStream = new MemoryStream())
                {
                    BitmapEncoder enc = new BmpBitmapEncoder();
                    enc.Frames.Add(BitmapFrame.Create(bs));
                    enc.Save(outStream);
                    PreScreenPath = ScreenPath;
                    ScreenPath    = ScreenPath.Replace("_pre", "");
                    new Bitmap(outStream).Save(ScreenPath, System.Drawing.Imaging.ImageFormat.Png);
                }

                ShowBalloon(OwnShotHelpers.UploadImage(ScreenPath));
                SetWindowStyle(true);
                selectionRectangle.Width = 0; //workaround

                if (OwnShotHelpers.GetConfig("DeleteMode") == "Yes")
                {
                    File.Delete(ScreenPath);
                    File.Delete(PreScreenPath);
                }
            }
            selectionRectangle.Visibility = Visibility.Visible;
        }
예제 #3
0
        public void screenCapture(bool showCursor, bool Partial = false)
        {
            ScreenPath = OwnShotHelpers.RandomName(ssnamelength) + (Partial ? "_pre" : "") + ".png";

            SetWindowStyle(true);
            System.Threading.Thread.Sleep(25);

            OwnShotHelpers.CaptureImage(showCursor, ScreenPath);

            if (!Partial)
            {
                ShowBalloon(OwnShotHelpers.UploadImage(ScreenPath));
            }

            SetWindowStyle(!Partial);

            if (!Partial && OwnShotHelpers.GetConfig("DeleteMode") == "Yes")
            {
                File.Delete(ScreenPath);
            }
        }