public ImageEditingWindow(ScreenImage si)
        {
            InitializeComponent();

            CommandBindings.Add(new CommandBinding(ApplicationCommands.Close, new ExecutedRoutedEventHandler((sender, args) => Close())));

            this.btnMinimize.Click += new RoutedEventHandler(Minimize);
            this.btnMaximize.Click += new RoutedEventHandler(Maximize);

            ScreenImage = si;

            fullSizeImage.Stretch = Stretch.None;
            fullSizeImage.ImageSource = si.BitmapSource;

            drawingCanvas.Width = si.Bitmap.Width;
            drawingCanvas.Height = si.Bitmap.Height;
        }
        public void CaptureDesktop()
        {
            Application.Current.MainWindow.Hide();

            Thread.Sleep(TIMEOUT);

            string filename = Commands.GetFileName();
            screenCapture.CaptureScreenToFile(filename, ImageFormat.Png);

            ScreenImage si = new ScreenImage(filename);
            si.Title = "Desktop Screenshot";
            _screenImages.Add(si);

            Application.Current.MainWindow.Show();
        }
        public void CaptureWindow(IntPtr hwnd)
        {
                string filename = Commands.GetFileName();
                screenCapture.CaptureWindowToFile(hwnd, filename, ImageFormat.Png);

                ScreenImage si = new ScreenImage(filename);
                si.Title = MonitorActivate.MonitorActivate.GetWindowText(hwnd);
                si.Path = MonitorActivate.MonitorActivate.GetProcessPath(hwnd);
                si.Modules = MonitorActivate.MonitorActivate.GetProcessModules(hwnd);
                si.ApplicationURL = wm.GetURL(hwnd.ToInt32());

                _screenImages.Add(si);        

        }
        public void CaptureWindow()
        {
            string filename = Commands.GetFileName();
            screenCapture.CaptureWindowToFile(filename, ImageFormat.Png);

            ScreenImage si = new ScreenImage(filename);
            si.Title = MonitorActivate.MonitorActivate.GetWindowText();
            si.Path = MonitorActivate.MonitorActivate.GetProcessPath();
            si.Modules = MonitorActivate.MonitorActivate.GetProcessModules();
            si.ApplicationURL = wm.GetURL(ProcessCapture.MonitorActivate.ScreenCapture.User32.GetForegroundWindow().ToInt32());
            
            _screenImages.Add(si);
        }
Beispiel #5
0
        public static Project FromXML(string xml, out List<ScreenImage> images)
        {
            images = new List<ScreenImage>();

            try
            {
                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.LoadXml(xml);

                Project newProject = new Project();

                newProject.ProcessName = xmlDoc.SelectSingleNode("/project/name/text()") != null ? xmlDoc.SelectSingleNode("/project/name/text()").InnerText : "";
                newProject.Description = xmlDoc.SelectSingleNode("/project/description/text()") != null ? xmlDoc.SelectSingleNode("/project/description/text()").InnerText : "";
                newProject.Author = xmlDoc.SelectSingleNode("/project/author/text()") != null ? xmlDoc.SelectSingleNode("/project/author/text()").InnerText : "";
                newProject.ProcessImage = xmlDoc.SelectSingleNode("/project/image/text()") != null ? xmlDoc.SelectSingleNode("/project/image/text()").InnerText : "";

                XmlNodeList screenshots = xmlDoc.SelectNodes("/project/screenshots/screenshot");
                foreach (XmlNode screenshot in screenshots)
                {
                    string path = screenshot.SelectSingleNode("location").InnerText;
                    ScreenImage si = new ScreenImage(path);

                    si.ApplicationURL = screenshot.SelectSingleNode("url") != null ? screenshot.SelectSingleNode("url").InnerText : "";
                    si.Title = screenshot.SelectSingleNode("title") != null ? screenshot.SelectSingleNode("title").InnerText : "";
                    si.Path = screenshot.SelectSingleNode("path") != null ? screenshot.SelectSingleNode("path").InnerText : "";
                    si.Notes = screenshot.SelectSingleNode("notes") != null ? screenshot.SelectSingleNode("notes").InnerText : "";

                    XmlNodeList modules = screenshot.SelectNodes("modules/module");
                    List<string> moduleList = new List<string>();

                    foreach (XmlNode module in modules)
                    {
                        moduleList.Add(module.InnerText);
                    }

                    si.Modules = moduleList.ToArray();

                    images.Add(si);
                }

                return newProject;
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                return null;
            }
        }
        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            if (si == null)
            {
                si = new ScreenImage(Commands.GetFileName());
                si.IsProcessDiagram = true;
                si.Title = "Process Diagram";
                Parent.ScreenImages.Add(si);
            }

            si.Save(drawingCanvas);            
        }