1 //----------------------------------------------------------------
2 // Copyright (c) Microsoft Corporation. All rights reserved.
3 //----------------------------------------------------------------
5 namespace System.Activities.Core.Presentation
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;
19 using System.Activities.Presentation;
20 using System.Reflection;
23 /// Interaction logic for ForEachDesigner.xaml
25 partial class ForEachDesigner
27 public ForEachDesigner()
29 InitializeComponent();
32 public static void RegisterMetadata(AttributeTableBuilder builder)
34 Type[] types = new Type[]
36 typeof(System.Activities.Statements.ForEach<>),
37 typeof(System.Activities.Statements.ParallelForEach<>)
40 foreach (Type type in types)
42 builder.AddCustomAttributes(type, new DesignerAttribute(typeof(ForEachDesigner)));
43 builder.AddCustomAttributes(type, type.GetProperty("Body"), BrowsableAttribute.No);
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)));
53 void OnValuesBoxLoaded(object sender, RoutedEventArgs e)
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());