Update Reference Sources to .NET Framework 4.6.1
[mono.git] / mcs / class / referencesource / System.Activities.Core.Presentation / System / Activities / Core / Presentation / ForEachDesigner.xaml.cs
1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation.  All rights reserved.
3 //----------------------------------------------------------------
4
5 namespace System.Activities.Core.Presentation
6 {
7     using System;
8     using System.Activities;
9     using System.Activities.Statements;
10     using System.Activities.Presentation.Metadata;
11     using System.Activities.Presentation.Model;
12     using System.Activities.Presentation.View;
13     using System.Collections;
14     using System.Collections.Generic;
15     using System.ComponentModel;
16     using System.Diagnostics;
17     using System.Windows;
18     using System.Runtime;
19     using System.Activities.Presentation;
20     using System.Reflection;
21
22     /// <summary>
23     /// Interaction logic for ForEachDesigner.xaml
24     /// </summary>
25     partial class ForEachDesigner
26     {
27         public ForEachDesigner()
28         {
29             InitializeComponent();
30         }
31
32         public static void RegisterMetadata(AttributeTableBuilder builder)
33         {
34             Type[] types = new Type[]
35             {
36                 typeof(System.Activities.Statements.ForEach<>),
37                 typeof(System.Activities.Statements.ParallelForEach<>)
38             };
39
40             foreach (Type type in types)
41             {
42                 builder.AddCustomAttributes(type, new DesignerAttribute(typeof(ForEachDesigner)));
43                 builder.AddCustomAttributes(type, type.GetProperty("Body"), BrowsableAttribute.No);
44             }
45
46             builder.AddCustomAttributes(typeof(System.Activities.Statements.ForEach<>), new FeatureAttribute(typeof(UpdatableGenericArgumentsFeature)));
47             builder.AddCustomAttributes(typeof(System.Activities.Statements.ParallelForEach<>), new FeatureAttribute(typeof(UpdatableGenericArgumentsFeature)));
48             builder.AddCustomAttributes(typeof(System.Activities.Core.Presentation.Factories.ForEachWithBodyFactory<>), new DefaultTypeArgumentAttribute(typeof(int)));
49             builder.AddCustomAttributes(typeof(System.Activities.Core.Presentation.Factories.ParallelForEachWithBodyFactory<>), new DefaultTypeArgumentAttribute(typeof(int)));
50          
51         }
52
53         void OnValuesBoxLoaded(object sender, RoutedEventArgs e)
54         {
55             ExpressionTextBox etb = sender as ExpressionTextBox;
56             Fx.Assert(null != etb, "sender should not be null!");
57             etb.ExpressionType = typeof(IEnumerable<>).MakeGenericType(this.ModelItem.ItemType.GetGenericArguments());
58         }
59     }
60 }