Example #1
0
        public static void TakeScreenshot(Screen screen, string screenName, string path, int screenNumber)
        {
            try
            {
                if (!string.IsNullOrEmpty(path))
                {
                    Bitmap bitmap = screenNumber == 5 ? GetActiveWindowBitmap() : GetScreenBitmap(screen, m_ratio);

                    if (bitmap != null)
                    {
                        Screenshot screenshot = new Screenshot(DateTime.Now.ToString(MacroParser.DateFormat), path, screenNumber, m_format);

                        SaveToFile(bitmap, m_format, screenshot.Path);

                        ScreenshotCollection.Add(screenshot);
                    }

                    GC.Collect();
                }
            }
            catch (Exception ex)
            {
                Log.Write("ScreenCapture::TakeScreenshot", ex);
            }
        }
Example #2
0
        private void RunEditor(string name, string application, string arguments)
        {
            AddEditor(name, application, arguments);

            string selectedFile = ScreenshotCollection.GetBySlidename(Slideshow.SelectedSlide, Slideshow.SelectedScreen == 0 ? 1 : Slideshow.SelectedScreen).Path;

            if (File.Exists(selectedFile))
            {
                Process.Start(application, arguments.Replace("%screenshot%", selectedFile));
            }
        }
Example #3
0
        /// <summary>
        /// Gets the images associated with the slide.
        /// </summary>
        /// <param name="slideName">The name of the slide.</param>
        /// <returns></returns>
        public static ArrayList GetImages(string slideName, DateTime selectedDate)
        {
            ArrayList images = new ArrayList();

            for (int i = 1; i <= 5; i++)
            {
                // This is the old method of obtaining the images based on a slide name.
                //string path = GetImageFilePath(slideName, i);
                string path = string.Empty;
                // If we can't find an image based on the old method then chances are we
                // now need to search for the image by looking inside the screenshot collection class.
                //if (string.IsNullOrEmpty(path))
                //{
                Screenshot screenshot = ScreenshotCollection.GetBySlidename(slideName, i);

                if (screenshot != null)
                {
                    if (screenshot.Screen == i && selectedDate.ToString(MacroParser.DateFormat) == screenshot.Date)
                    {
                        path = screenshot.Path;
                    }
                }
                //}

                if (File.Exists(path))
                {
                    images.Add(Bitmap.FromFile(path));
                }
                else
                {
                    images.Add(null);
                }
            }

            return(images);
        }