Exemplo n.º 1
0
        private void HideAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("HideAnnotation called.");

            if (this.status == AnnotationStatus.Hidden)
            {
                return;
            }

            if (this.status == AnnotationStatus.Floating)
            {
                this.FloatingAnnotation.UpdateModelItem();
                this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
            }

            if (this.status == AnnotationStatus.Docked)
            {
                this.Indicator.Visibility = Visibility.Visible;

                this.DockedAnnotation.Visibility = Visibility.Collapsed;
            }

            this.status             = AnnotationStatus.Hidden;
            this.IsAnnotationDocked = false;
        }
Exemplo n.º 2
0
        private void ShowAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("ShowAnnotation called.");

            switch (this.status)
            {
            case AnnotationStatus.Floating:
                return;

            case AnnotationStatus.Hidden:
                this.AnnotationAdornerService.Show(this.AnnotationAdorner);
                break;

            case AnnotationStatus.Docked:
                if (this.Indicator != null)
                {
                    this.Indicator.Visibility = Visibility.Visible;
                }

                this.DockedAnnotation.Visibility = Visibility.Collapsed;

                this.AnnotationAdornerService.Show(this.AnnotationAdorner);
                break;
            }

            this.status             = AnnotationStatus.Floating;
            this.IsAnnotationDocked = false;
        }
Exemplo n.º 3
0
        public void Initialize()
        {
            if (this.isInitialized)
            {
                return;
            }

            this.ModelItem      = this.workflowViewElement.ModelItem;
            this.EditingContext = this.workflowViewElement.Context;

            if (!this.CanInitialize())
            {
                return;
            }

            this.EditingContext.Items.Subscribe <ReadOnlyState>(this.OnReadOnlyStateChanged);
            this.ViewStateService.ViewStateChanged += new ViewStateChangedEventHandler(this.OnViewStateChanged);
            this.ModelItem.PropertyChanged         += new PropertyChangedEventHandler(this.OnModelItemPropertyChanged);
            this.Indicator.IsMouseOverChanged      += new EventHandler(this.OnIndicatorIsMouseOverChanged);
            this.helpService = this.EditingContext.Services.GetService <IIntegratedHelpService>();

            this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null;

            if (this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue == null)
            {
                this.Indicator.Visibility = Visibility.Collapsed;
                if (this.dockedAnnotation != null)
                {
                    this.DockedAnnotation.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                if (this.IsAnnotationDocked)
                {
                    this.Indicator.Visibility        = Visibility.Collapsed;
                    this.DockedAnnotation.Visibility = Visibility.Visible;
                    this.status = AnnotationStatus.Docked;
                }
                else
                {
                    this.Indicator.Visibility        = Visibility.Visible;
                    this.DockedAnnotation.Visibility = Visibility.Collapsed;
                }
            }

            this.isInitialized = true;
        }
Exemplo n.º 4
0
        private void DockAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("DockAnnotation called.");

            if (this.status == AnnotationStatus.Docked)
            {
                return;
            }

            if (this.status == AnnotationStatus.Floating)
            {
                this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
            }

            this.Indicator.Visibility        = Visibility.Collapsed;
            this.DockedAnnotation.Visibility = Visibility.Visible;

            this.status             = AnnotationStatus.Docked;
            this.IsAnnotationDocked = true;
        }
Exemplo n.º 5
0
        private void OnModelItemPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Annotation.AnnotationTextPropertyName)
            {
                bool previouslyHadAnnotation = this.hasAnnotation;
                this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null;

                if (!this.hasAnnotation)
                {
                    //// annotation is removed

                    if (this.status == AnnotationStatus.Floating)
                    {
                        this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
                    }

                    this.Indicator.Visibility = Visibility.Collapsed;
                    if (this.dockedAnnotation != null)
                    {
                        this.dockedAnnotation.Visibility = Visibility.Collapsed;
                    }

                    this.status = AnnotationStatus.Hidden;
                }
                else if (!previouslyHadAnnotation)
                {
                    //// annotation is added

                    if (this.IsAnnotationDocked)
                    {
                        this.Indicator.Visibility        = Visibility.Collapsed;
                        this.DockedAnnotation.Visibility = Visibility.Visible;
                        this.status = AnnotationStatus.Docked;
                    }
                    else
                    {
                        this.Indicator.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        private void DockAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("DockAnnotation called.");

            if (this.status == AnnotationStatus.Docked)
            {
                return;
            }

            if (this.status == AnnotationStatus.Floating)
            {
                this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
            }

            this.Indicator.Visibility = Visibility.Collapsed;
            this.DockedAnnotation.Visibility = Visibility.Visible;

            this.status = AnnotationStatus.Docked;
            this.IsAnnotationDocked = true;
        }
        private void HideAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("HideAnnotation called.");

            if (this.status == AnnotationStatus.Hidden)
            {
                return;
            }

            if (this.status == AnnotationStatus.Floating)
            {
                this.FloatingAnnotation.UpdateModelItem();
                this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
            }

            if (this.status == AnnotationStatus.Docked)
            {
                this.Indicator.Visibility = Visibility.Visible;

                this.DockedAnnotation.Visibility = Visibility.Collapsed;
            }

            this.status = AnnotationStatus.Hidden;
            this.IsAnnotationDocked = false;
        }
        private void ShowAnnotation()
        {
            System.Diagnostics.Debug.WriteLine("ShowAnnotation called.");

            switch (this.status)
            {
                case AnnotationStatus.Floating:
                    return;
                case AnnotationStatus.Hidden:
                    this.AnnotationAdornerService.Show(this.AnnotationAdorner);
                    break;
                case AnnotationStatus.Docked:
                    if (this.Indicator != null)
                    {
                        this.Indicator.Visibility = Visibility.Visible;
                    }

                    this.DockedAnnotation.Visibility = Visibility.Collapsed;

                    this.AnnotationAdornerService.Show(this.AnnotationAdorner);
                    break;
            }

            this.status = AnnotationStatus.Floating;
            this.IsAnnotationDocked = false;
        }
        private void OnModelItemPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == Annotation.AnnotationTextPropertyName)
            {
                bool previouslyHadAnnotation = this.hasAnnotation;
                this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null;

                if (!this.hasAnnotation)
                {
                    //// annotation is removed

                    if (this.status == AnnotationStatus.Floating)
                    {
                        this.AnnotationAdornerService.Hide(this.AnnotationAdorner);
                    }

                    this.Indicator.Visibility = Visibility.Collapsed;
                    if (this.dockedAnnotation != null)
                    {
                        this.dockedAnnotation.Visibility = Visibility.Collapsed;
                    }

                    this.status = AnnotationStatus.Hidden;
                }
                else if (!previouslyHadAnnotation)
                {
                    //// annotation is added

                    if (this.IsAnnotationDocked)
                    {
                        this.Indicator.Visibility = Visibility.Collapsed;
                        this.DockedAnnotation.Visibility = Visibility.Visible;
                        this.status = AnnotationStatus.Docked;
                    }
                    else
                    {
                        this.Indicator.Visibility = Visibility.Visible;
                    }
                }
            }
        }
        public void Initialize()
        {
            if (this.isInitialized)
            {
                return;
            }

            this.ModelItem = this.workflowViewElement.ModelItem;
            this.EditingContext = this.workflowViewElement.Context;

            if (!this.CanInitialize())
            {
                return;
            }

            this.EditingContext.Items.Subscribe<ReadOnlyState>(this.OnReadOnlyStateChanged);
            this.ViewStateService.ViewStateChanged += new ViewStateChangedEventHandler(this.OnViewStateChanged);
            this.ModelItem.PropertyChanged += new PropertyChangedEventHandler(this.OnModelItemPropertyChanged);
            this.Indicator.IsMouseOverChanged += new EventHandler(this.OnIndicatorIsMouseOverChanged);
            this.helpService = this.EditingContext.Services.GetService<IIntegratedHelpService>();

            this.hasAnnotation = this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue != null;

            if (this.ModelItem.Properties[Annotation.AnnotationTextPropertyName].ComputedValue == null)
            {
                this.Indicator.Visibility = Visibility.Collapsed;
                if (this.dockedAnnotation != null)
                {
                    this.DockedAnnotation.Visibility = Visibility.Collapsed;
                }
            }
            else
            {
                if (this.IsAnnotationDocked)
                {
                    this.Indicator.Visibility = Visibility.Collapsed;
                    this.DockedAnnotation.Visibility = Visibility.Visible;
                    this.status = AnnotationStatus.Docked;
                }
                else
                {
                    this.Indicator.Visibility = Visibility.Visible;
                    this.DockedAnnotation.Visibility = Visibility.Collapsed;
                }
            }

            this.isInitialized = true;
        }