protected virtual void Dispose(bool disposing) { Logging.Debug("PDFAnnotationItem::Dispose({0}) @{1}", disposing, dispose_count); WPFDoEvents.InvokeInUIThread(() => { WPFDoEvents.SafeExec(() => { if (dispose_count == 0) { // Get rid of managed resources / get rid of cyclic references: if (null != pdf_annotation) { pdf_annotation.Bindable.PropertyChanged -= pdf_annotation_PropertyChanged; } ButtonAnnotationDetails.MouseEnter -= ButtonAnnotationDetails_MouseEnter; ButtonAnnotationDetails.MouseLeave -= ButtonAnnotationDetails_MouseLeave; ButtonAnnotationDetails.MouseDown -= ButtonAnnotationDetails_MouseDown; TextAnnotationText.GotFocus -= TextAnnotationText_GotFocus; TextAnnotationText.LostFocus -= TextAnnotationText_LostFocus; TextAnnotationText.PreviewMouseDown -= TextAnnotationText_PreviewMouseDown; TextAnnotationText.PreviewMouseMove -= TextAnnotationText_PreviewMouseMove; TextAnnotationText.PreviewMouseUp -= TextAnnotationText_PreviewMouseUp; ObjTagEditorControl.GotFocus -= ObjTagEditorControl_GotFocus; ObjTagEditorControl.LostFocus -= ObjTagEditorControl_LostFocus; ObjTagEditorControl.TagFeature_Add = null; ObjTagEditorControl.TagFeature_Remove = null; Dispatcher.ShutdownStarted -= Dispatcher_ShutdownStarted; } }); WPFDoEvents.SafeExec(() => { // Clear the references for sanity's sake DataContext = null; }); WPFDoEvents.SafeExec(() => { pdf_annotation_layer = null; pdf_annotation = null; pdf_annotation_editor_control_popup = null; }); ++dispose_count; }); }
private static void run_AnnotationEdit_MouseDown(object sender, MouseButtonEventArgs e) { Run run = (Run)sender; PDFAnnotation pdf_annotation = (PDFAnnotation)run.Tag; PDFAnnotationEditorControl pdf_annotation_editor_control = new PDFAnnotationEditorControl(); pdf_annotation_editor_control.SetAnnotation(pdf_annotation); AugmentedToolWindow pdf_annotation_editor_control_popup = new AugmentedToolWindow(pdf_annotation_editor_control, "Edit Annotation"); pdf_annotation_editor_control_popup.IsOpen = true; e.Handled = true; }
private void ButtonAnnotationDetails_MouseDown(object sender, MouseButtonEventArgs e) { // If we have never had a pop-up, create it now if (null == pdf_annotation_editor_control_popup) { PDFAnnotationEditorControl pdf_annotation_editor_control = new PDFAnnotationEditorControl(); pdf_annotation_editor_control.SetAnnotation(pdf_annotation); pdf_annotation_editor_control_popup = new AugmentedToolWindow(pdf_annotation_editor_control, "Edit Annotation"); } pdf_annotation_editor_control_popup.IsOpen = true; e.Handled = true; }
protected virtual void Dispose(bool disposing) { Logging.Debug("PDFAnnotationItem::Dispose({0}) @{1}", disposing, dispose_count); try { if (dispose_count == 0) { // Get rid of managed resources / get rid of cyclic references: if (null != pdf_annotation) { pdf_annotation.Bindable.PropertyChanged -= pdf_annotation_PropertyChanged; } ButtonAnnotationDetails.MouseEnter -= ButtonAnnotationDetails_MouseEnter; ButtonAnnotationDetails.MouseLeave -= ButtonAnnotationDetails_MouseLeave; ButtonAnnotationDetails.MouseDown -= ButtonAnnotationDetails_MouseDown; TextAnnotationText.GotFocus -= TextAnnotationText_GotFocus; TextAnnotationText.LostFocus -= TextAnnotationText_LostFocus; TextAnnotationText.PreviewMouseDown -= TextAnnotationText_PreviewMouseDown; TextAnnotationText.PreviewMouseMove -= TextAnnotationText_PreviewMouseMove; TextAnnotationText.PreviewMouseUp -= TextAnnotationText_PreviewMouseUp; ObjTagEditorControl.GotFocus -= ObjTagEditorControl_GotFocus; ObjTagEditorControl.LostFocus -= ObjTagEditorControl_LostFocus; ObjTagEditorControl.TagFeature_Add = null; ObjTagEditorControl.TagFeature_Remove = null; } // Clear the references for sanity's sake DataContext = null; pdf_annotation_layer = null; pdf_annotation = null; pdf_renderer_control_stats = null; pdf_annotation_editor_control_popup = null; } catch (Exception ex) { Logging.Error(ex); } ++dispose_count; }