c1c10b8bf640a30fd5916a0a5daf5dd91d653c17
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Annotations / NotifyArgumentVariableAnnotationTextChanged.cs
1 //----------------------------------------------------------------
2 // <copyright company="Microsoft Corporation">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>
5 //----------------------------------------------------------------
6
7 namespace System.Activities.Presentation.Annotations
8 {
9     using System;
10     using System.Activities.Presentation.Model;
11     using System.Activities.Presentation.View;
12
13     // This is to workaround a 
14     internal class NotifyArgumentVariableAnnotationTextChanged : Change
15     {
16         public ArgumentDesigner ArgumentDesigner { get; set; }
17
18         public VariableDesigner VariableDesigner { get; set; }
19
20         public override string Description
21         {
22             get { return SR.NotifyAnnotationTextChangedDescription; }
23         }
24
25         public override bool Apply()
26         {
27             this.VariableDesigner.Dispatcher.BeginInvoke(
28                 new Action(() =>
29                     {
30                         this.VariableDesigner.NotifyAnnotationTextChanged();
31                         this.ArgumentDesigner.NotifyAnnotationTextChanged();
32                     }),
33                 Windows.Threading.DispatcherPriority.ApplicationIdle,
34                 null);
35             return true;
36         }
37
38         public override Change GetInverse()
39         {
40             return new NotifyArgumentVariableAnnotationTextChanged()
41             {
42                 VariableDesigner = this.VariableDesigner,
43                 ArgumentDesigner = this.ArgumentDesigner,
44             };
45         }
46     }
47 }