Exemple #1
0
 /// <summary>
 /// This function, when executed, shows the toast form
 /// with animation.
 /// </summary>
 /// <param name="ski">An skImage instance stored in memory</param>
 public static void ShowToastForm(skImage ski)
 {
     //create a new toastform instance.
     using (toastform slice = new toastform(ski)) {
         slice.ShowDialog();
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            //check for the first time
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            if (mySettings.FirstTime) {
                var i = new GUI.FirstTime();
                i.ShowDialog();
            }
            if (args.Length > 0) {
                //we have a context menu item...
                string filename = args[0].ToLower();
                if (System.IO.File.Exists(filename)) {
                    //check if its a valid picture format.
                    if (Common.IsValidImage(filename)) {
                        skImage ski = new skImage(Image.FromFile(filename), filename);
                        Common.ShowToastForm(ski);
                    } else if (System.IO.Path.GetExtension(filename) == ".psd") {
                        //its a PSD file.
                        //save a local copy of the PSD as jpeg
                        //double check location
                        Photoshop.PsdFile psd = new Photoshop.PsdFile();
                        //load the file
                        psd.Load(filename);
                        //decode the image
                        Image myPsdImage = Photoshop.ImageDecoder.DecodeImage(psd);
                        //create new image
                        skImage ski = new skImage(myPsdImage);
                        Common.ShowToastForm(ski);
                    }
                    //exit silently
                }
            } else {
                bool firstInstance;
                Mutex mutex = new Mutex(false, "Local\\" + "SkimptProgramRunning", out firstInstance);

                if (firstInstance) {
                    Application.Run(new GUI.main());
                }
            }
            //wait till all toast forms are closed
            while (Application.OpenForms.Count > 0)
            {
                  Application.DoEvents();
            }
        }
Exemple #3
0
        private void KeyboardHookInstance_KeyIntercepted(KeyboardHookEventArgs keyboardEvents)
        {
            skImage myImage = null;
            Bitmap i;

            if (keyboardEvents.PressedKey == Keys.PrintScreen) {
                switch (CurrentMode) {
                    case mode.FullScreen:
                        i = skImageCapture.GetDesktopWindowCaptureAsBitmap();
                        myImage = new skImage(i);
                        break;
                    case mode.CameraMode:
                        this.Hide();
                        if (!instanceCreated) {
                            mc = new WindowLayer();
                            instanceCreated = true;
                            mc.Show();
                        } else {
                            WindowFrameToCapture = mc.GetWindowFrame();
                            i = skImageCapture.CaptureDeskTopRectangle(WindowFrameToCapture, WindowFrameToCapture.Width, WindowFrameToCapture.Height);
                            myImage = new skImage(i);
                            mc.Dispose();
                            mc = null;
                            instanceCreated = false;
                        }
                        break;
                    case mode.HighlightMode:
                        this.Hide();
                        if (!instanceCreated) {
                            mc = new WindowLayer();
                            instanceCreated = true;
                            mc.Show();
                        } else {
                            WindowFrameToCapture = mc.GetWindowFrame();
                            i = skImageCapture.GetDesktopWindowCaptureAsBitmap();
                            myImage = new skImage(i, WindowFrameToCapture);
                            mc.Dispose();
                            mc = null;
                            instanceCreated = false;
                        }
                        break;
                    default:
                        MessageBox.Show("unable to capture screen");
                        break;
                }

                if (myImage != null) {
                    Common.ShowToastForm(myImage);
                }

            }
        }
Exemple #4
0
 /// <summary>
 /// This function, when executed, shows the toast form
 /// with animation. 
 /// </summary>
 /// <param name="ski">An skImage instance stored in memory</param>
 public static void ShowToastForm(skImage ski)
 {
     //create a new toastform instance.
     using (toastform slice = new toastform(ski)) {
         slice.ShowDialog();
     }
 }