Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System.Activities.Core.Presentation / System / Activities / Core / Presentation / FlowchartExpressionAutomationPeer.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.Activities.Core.Presentation
6 {
7     using System.Runtime;
8     using System.Windows;
9     using System.Windows.Automation.Peers;
10
11     [Fx.Tag.XamlVisible(false)]
12     class FlowchartExpressionAutomationPeer : UIElementAutomationPeer
13     {
14         const string ExpressionNotShown = "(null)";
15         AutomationPeer wrappedAutomationPeer;
16
17         public FlowchartExpressionAutomationPeer(FrameworkElement owner, AutomationPeer wrappedAutomationPeer)
18             : base(owner)
19         {
20             this.wrappedAutomationPeer = wrappedAutomationPeer;
21         }
22
23         protected override string GetItemStatusCore()
24         {
25             Fx.Assert(this.Owner != null, "FlowchartExpressionAutomationPeer should have this.Owner != null.");
26             bool expressionShown = false;
27             if (this.Owner is FlowDecisionDesigner)
28             {
29                 expressionShown = ((FlowDecisionDesigner)this.Owner).ExpressionShown;
30             }
31             else
32             {
33                 Fx.Assert(this.Owner is FlowSwitchDesigner, "this.Owner should either be FlowDecisionDesigner or FlowSwitchDesigner.");
34                 expressionShown = ((FlowSwitchDesigner)this.Owner).ExpressionShown;
35             }
36             return expressionShown ? FlowchartExpressionAdorner.GetExpressionString(this.Owner) : ExpressionNotShown;
37         }
38
39         protected override string GetClassNameCore()
40         {
41             return this.wrappedAutomationPeer.GetClassName();
42         }
43
44         protected override string GetNameCore()
45         {
46             return this.wrappedAutomationPeer.GetName();
47         }
48
49         protected override string GetAutomationIdCore()
50         {
51             return this.wrappedAutomationPeer.GetAutomationId();
52         }
53     }
54 }