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); } } }
void automation_EditContent(object sender, AnnEditContentEventArgs e) { AnnObject annObject = e.TargetObject; if (annObject == null || !annObject.SupportsContent || annObject is AnnSelectionObject) { return; } if (sender is AnnDrawDesigner && annObject.Id != AnnObject.StickyNoteObjectId) { return; } using (var dlg = new AutomationUpdateObjectDialog()) { dlg.Automation = this.Automation; dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Properties, false); dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false); dlg.TargetObject = annObject; if (dlg.ShowDialog(this) == DialogResult.OK) { Automation.InvalidateObject(annObject); } } }
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; } }
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); } } }
private void automation_EditContent(object sender, AnnEditContentEventArgs e) { var automation = _documentViewer.Annotations.Automation; if (automation == null) { return; } e.Cancel = true; RemoveAutomationTextBox(true); AnnObject targetObject = e.TargetObject; if (targetObject == null) { return; } // if text object, we cannot do that. Ignore, the EditText will fire var textObject = targetObject as AnnTextObject; if (textObject != null) { return; } if (sender is AnnDrawDesigner && targetObject.Id != AnnObject.StickyNoteObjectId) { return; } using (var dlg = new AutomationUpdateObjectDialog()) { dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Properties, false); dlg.SetPageVisible(AutomationUpdateObjectDialogPage.Reviews, false); dlg.TargetObject = targetObject; if (dlg.ShowDialog(this) == DialogResult.OK) { e.Cancel = false; automation.InvalidateObject(targetObject); } } }