Esempio n. 1
0
        void automation_OnShowObjectProperties(object sender, AnnAutomationEventArgs e)
        {
            AnnAutomation automation = sender as AnnAutomation;

            using (var dlg = new AutomationUpdateObjectDialog())
            {
                if (automation.CurrentEditObject != null)
                {
                    // If stick note or text, hide the note
                    if (automation.CurrentEditObject.Id == AnnObject.StickyNoteObjectId || automation.CurrentEditObject is AnnTextObject)
                    {
                        // if text object, we cannot do that. Ignore, the EditText will fire
                        dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Content, false);
                    }
                }

                dlg.Automation = automation;

                try
                {
                    dlg.ShowDialog(this);
                    e.Cancel = !dlg.IsModified;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 2
0
        private void automation_OnShowObjectProperties(object sender, AnnAutomationEventArgs e)
        {
            // Get the automation object from the document viewer
            var automation = _documentViewer.Annotations.Automation;

            if (automation == null)
            {
                return;
            }

            using (var dlg = new AutomationUpdateObjectDialog())
            {
                if (automation.CurrentEditObject != null)
                {
                    var isSelectionObject = automation.CurrentEditObject is AnnSelectionObject;
                    // If is is a text or selection , hide the content
                    if (automation.CurrentEditObject is AnnTextObject || isSelectionObject)
                    {
                        // if text object, we cannot do that. Ignore, the EditText will fire
                        dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Content, false);

                        if (isSelectionObject)
                        {
                            dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false);
                        }
                    }
                }

                dlg.UserName   = _documentViewer.UserName;
                dlg.Automation = automation;
                dlg.ShowDialog(this);

                e.Cancel = !dlg.IsModified;
            }
        }
Esempio n. 3
0
        void automation_OnShowObjectProperties(object sender, AnnAutomationEventArgs e)
        {
            using (var dlg = new AutomationUpdateObjectDialog())
            {
                var automation        = this.Automation;
                var currentObject     = automation.CurrentEditObject;
                var isSelectionObject = currentObject is AnnSelectionObject;

                if (currentObject != null)
                {
                    if (!currentObject.SupportsContent || isSelectionObject)
                    {
                        dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Content, false);
                        if (isSelectionObject)
                        {
                            dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false);
                        }
                    }
                }

                dlg.Automation = automation;

                try
                {
                    dlg.ShowDialog(this);
                    e.Cancel = !dlg.IsModified;
                    MainForm.UpdateControls();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }
Esempio n. 4
0
 void _annAutomation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
 {
     if (e != null && e.Object != null)
     {
         AnnAutomationObject annAutomationObject = e.Object as AnnAutomationObject;
         if (annAutomationObject != null)
         {
             ContextMenu menu = annAutomationObject.ContextMenu as ContextMenu;
             if (menu != null)
             {
                 menu.Show(this, _rasterImageViewer.PointToClient(Cursor.Position));
             }
         }
     }
 }
Esempio n. 5
0
 void _automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
 {
     if (e != null && e.Object != null)
     {
         _rasterImageViewer.AutomationInvalidate(LeadRectD.Empty);
         AnnAutomationObject annAutomationObject = e.Object as AnnAutomationObject;
         if (annAutomationObject != null)
         {
             ObjectContextMenu menu = annAutomationObject.ContextMenu as ObjectContextMenu;
             if (menu != null)
             {
                 menu.Automation = sender as AnnAutomation;
                 menu.Show(this, RasterImageViewer.PointToClient(Cursor.Position));
             }
         }
     }
     else
     {
         ManagerContextMenu defaultMenu = new ManagerContextMenu();
         defaultMenu.Automation = sender as AnnAutomation;
         defaultMenu.Show(this, _rasterImageViewer.PointToClient(Cursor.Position));
     }
 }
Esempio n. 6
0
        private void automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
        {
            var automation = _documentViewer.Annotations.Automation;

            if (automation == null)
            {
                return;
            }

            var imageViewer = _documentViewer.View.ImageViewer;

            var position = imageViewer.PointToClient(Cursor.Position);

            if (e != null && e.Object != null)
            {
                automation.Invalidate(LeadRectD.Empty);
                var automationObject = e.Object as AnnAutomationObject;
                if (automationObject != null)
                {
                    var contextMenu = automationObject.ContextMenu as ObjectContextMenu;
                    if (contextMenu != null)
                    {
                        contextMenu.Automation = automation;
                        contextMenu.Show(imageViewer, position);
                    }
                }
            }
            else
            {
                if (_viewContextMenu == null)
                {
                    _viewContextMenu = new UI.ViewContextMenu(_documentViewer, this.DoSelectAllText);
                }

                _viewContextMenu.Show(imageViewer, position);
            }
        }
Esempio n. 7
0
        void automation_OnShowContextMenu(object sender, AnnAutomationEventArgs e)
        {
            AnnObject annEditObject = _automation.CurrentEditObject;

            if (e != null)
            {
                AnnAutomationObject annAutomationObject = e.Object;
                if (annAutomationObject != null)
                {
                    _imageViewer.AutomationInvalidate(LeadRectD.Empty);

                    ContextMenu contextMenu = annAutomationObject.ContextMenu as ContextMenu;
                    if (annAutomationObject != null && contextMenu != null)
                    {
                        ObjectContextMenu menu  = annAutomationObject.ContextMenu as ObjectContextMenu;
                        AnnLayer          layer = annEditObject.Layer;
                        if (menu != null)
                        {
                            if (layer != null && !layer.IsVisible)
                            {
                                return;
                            }

                            menu.Automation = sender as AnnAutomation;
                            contextMenu.Show(this, _imageViewer.PointToClient(Cursor.Position));
                        }
                    }
                }
            }
            else
            {
                ManagerContextMenu defaultMenu = new ManagerContextMenu();
                defaultMenu.Automation = sender as AnnAutomation;
                defaultMenu.Show(this, _imageViewer.PointToClient(Cursor.Position));
            }
        }