Esempio n. 1
0
        protected override void OnClick(EventArgs e)
        {
            SlideModel slide = null;

            Model.Viewer.ViewerStateModel vsm = null;

            using (Synchronizer.Lock(this.m_Model.Workspace.CurrentDeckTraversal.SyncRoot)) {
                if ((~this.m_Model.Workspace.CurrentDeckTraversal) != null)
                {
                    using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                        slide = (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide;
                    }
                }
            }

            using (Synchronizer.Lock(this.m_Model.SyncRoot)) {
                vsm = this.m_Model.ViewerState;
            }

            if (slide != null && vsm != null)
            {
                CaptureGraphForm cg_form = new CaptureGraphForm(slide, vsm);
                if (cg_form.ShowDialog() == DialogResult.OK)
                {
                    InsertMenu.InsertImage(cg_form.Image, slide);
                }
            }
        }
Esempio n. 2
0
        private void WindowSnapshotMenuItem_Click(object sender, EventArgs e)
        {
            if (this.m_AppWindow != null && !this.m_AppWindow.Minimized)
            {
                MemoryStream ms = new MemoryStream();
                try {
                    this.m_AppWindow.WindowAsBitmap.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
                } catch {
                    return;
                }
                ms.Position = 0;
                Image image = Image.FromStream(ms);

                SlideModel slide = null;
                using (Synchronizer.Lock(this.m_Model.Workspace.CurrentDeckTraversal.SyncRoot)) {
                    if ((~this.m_Model.Workspace.CurrentDeckTraversal) != null)
                    {
                        using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                            slide = (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide;
                        }
                    }
                }

                if (slide != null)
                {
                    InsertMenu.InsertImage(image, slide);
                }
            }
        }
Esempio n. 3
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            IDataObject clipboardDateObject = Clipboard.GetDataObject();

            if (clipboardDateObject.GetDataPresent(DataFormats.Bitmap))
            {
                Image image = (Bitmap)clipboardDateObject.GetData(DataFormats.Bitmap);

                SlideModel slide = null;
                using (Synchronizer.Lock(this.m_Model.Workspace.CurrentDeckTraversal.SyncRoot)) {
                    if ((~this.m_Model.Workspace.CurrentDeckTraversal) != null)
                    {
                        using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                            slide = (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide;
                        }
                    }
                }

                if (slide != null)
                {
                    InsertMenu.InsertImage(image, slide);
                }
            }
        }
Esempio n. 4
0
        protected override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            //Show up the OpenFileDialog
            //get the image that the user wants to load
            OpenFileDialog file_dialog = new OpenFileDialog();

            file_dialog.Filter = "JPEG files (*.jpg)|*.jpg|BMP files (*.bmp)|*.bmp|PNG files (*.png)|*.png";
            if (file_dialog.ShowDialog() == DialogResult.OK)
            {
                Image      image = Image.FromFile(file_dialog.FileName);
                SlideModel slide = null;

                using (Synchronizer.Lock(this.m_Model.Workspace.CurrentDeckTraversal.SyncRoot)) {
                    if ((~this.m_Model.Workspace.CurrentDeckTraversal) != null)
                    {
                        using (Synchronizer.Lock((~this.m_Model.Workspace.CurrentDeckTraversal).SyncRoot)) {
                            slide = (~this.m_Model.Workspace.CurrentDeckTraversal).Current.Slide;
                        }
                    }
                }

                if (slide != null)
                {
                    InsertMenu.InsertImage(image, slide);
                }
            }
        }