protected void OnAnnotationViewModelAdded(AnnotationViewModel annotation)
 {
     var ev = AnnotationAdded;
     if (ev != null)
     {
         ev(this, new AnnotationViewModelAddedEventsArgs(annotation));
     }
 }
 public void AddInProgressAnnotation(AnnotationViewModel annotation)
 {
     _annotations.Add(annotation);
     if (IsInCurrentPage(annotation))
     {
         this.RaisePropertyChanged("Annotations"); // rebinds to UI
     }
 }
 protected bool IsInCurrentPage(AnnotationViewModel annotation)
 {
     return IsInCurrentPage(annotation.Annotation);
 }
 public void AddInProgressAnnotation(AnnotationViewModel annotation)
 {
     _annotations.Add(annotation);
     if (IsInCurrentPage(annotation))
     {
         this.RaisePropertyChanged("Annotations"); // rebinds to UI
     }
 }
 public AnnotationViewModel CreateAnnotationViewModel(Annotation annotation)
 {
     return(AnnotationViewModel.Create(annotation, SurfaceSize));
 }
 protected bool IsInCurrentPage(AnnotationViewModel annotation)
 {
     return(IsInCurrentPage(annotation.Annotation));
 }
 public AnnotationViewModelAddedEventsArgs(AnnotationViewModel annotation)
 {
     Annotation = annotation;
 }
        void AnnotationCanvas_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (CurrentAnnotationType == null) return;

            this.CaptureMouse();
            IsEditing = true;

            var p = e.GetPosition(this);
            var vm = DataContext as AgentAnnotationViewModel;


            _currentBuilder = vm.CreateBuilder(CurrentAnnotationType.Value);
            _currentAnnotation = vm.CreateAnnotationViewModel(_currentBuilder.Annotation);
            vm.AddInProgressAnnotation(_currentAnnotation);

            _currentBuilder.OnNextPoint(ConvertPoint(p));
        }
        private void WrapUpMove()
        {
            _currentBuilder = null;
            _currentAnnotation = null;

            ReleaseMouseCapture();

            IsEditing = false;
            CurrentAnnotationType = null;
        }