[reflection] Coop handles icalls in System.Reflection and System.RuntimeTypeHandle...
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / Internal / PropertyEditing / Editors / RTLValueConverter.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4 namespace System.Activities.Presentation.Internal.PropertyEditing.Editors 
5 {
6
7     using System;
8     using System.Collections;
9     using System.Diagnostics;
10     using System.Diagnostics.CodeAnalysis;
11     using System.Globalization;
12     using System.Windows.Data;
13     using System.Windows;
14     using System.Activities.Presentation.Internal.PropertyEditing.Model;
15     using System.Activities.Presentation.Internal.PropertyEditing.Resources;
16     using System.Activities.Presentation.PropertyEditing;
17     using System.Activities.Presentation;
18     using System.Runtime;
19
20     // <summary>
21     // Checks the property entry and converts it
22     // to appropriate FlowDirection value which is returned back.
23     // </summary>
24     [SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses")]
25     internal class RTLValueConveter : IMultiValueConverter 
26     {
27         public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) {
28             FlowDirection returnValue = FlowDirection.LeftToRight;
29             Fx.Assert(values.Length == 3, "Incorrect values in the MultiValueConverter!");
30             if (values.Length == 3) 
31             {
32                 ModelPropertyEntry propertyEntry = values[1] as ModelPropertyEntry;
33                 if (propertyEntry != null) 
34                 {
35                     if (!propertyEntry.DisplayName.Equals("Name")) 
36                     {
37                         if (targetType == typeof(FlowDirection)) 
38                         {
39                             object propertyValue = values[0];
40                             if (propertyValue == null || propertyValue.GetType() == typeof(string)) 
41                             {
42                                 //customize it to controls FlowDirection Property
43                                 returnValue = (FlowDirection)PropertyInspectorResources.GetResources()["SelectedControlFlowDirectionRTL"];
44                             }
45                         }
46                     }
47                 }
48             }
49             return returnValue;
50         }
51
52
53         public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) {
54             throw FxTrace.Exception.AsError(new NotImplementedException());
55         }
56
57     }
58 }