[runtime] Fix corlib out of date error with disabled COM
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Toolbox / ActivityTemplateFactory.cs
1 // <copyright>
2 //   Copyright (c) Microsoft Corporation.  All rights reserved.
3 // </copyright>
4
5 namespace System.Activities.Presentation.Toolbox
6 {
7     using System.Activities.Presentation;
8     using System.Activities.XamlIntegration;
9     using System.ComponentModel;
10     using System.Reflection;
11     using System.Runtime;
12     using System.Windows;
13     using System.Windows.Markup;
14     using System.Xaml;
15
16     /// <summary>
17     /// ActivityTemplateFactory is the XAML representation for an IActivityTemplateFactory. This class is for XAML serialization purpose only and is not expected to be used by developers.
18     /// </summary>
19     [ContentProperty("Implementation")]
20     public abstract class ActivityTemplateFactory : IActivityTemplateFactory
21     {
22         /// <summary>
23         /// Gets or sets the a factory method that create an activity as the implementation.
24         /// </summary>
25         [XamlDeferLoad(typeof(FuncDeferringLoader), typeof(ActivityTemplateFactory))]
26         [DefaultValue(null)]
27         [Browsable(false)]
28         [Ambient]
29         protected virtual Func<Activity> Implementation
30         {
31             get;
32             set;
33         }
34
35         /// <summary>
36         /// Create an activity by calling Implementation.
37         /// </summary>
38         /// <param name="target">A reference to the user interface - not used.</param>
39         /// <returns>The activity created by the implementation method or null if implementation is not set.</returns>
40         public Activity Create(DependencyObject target)
41         {
42             if (this.Implementation != null)
43             {
44                 return this.Implementation();
45             }
46             else
47             {
48                 return null;
49             }
50         }
51     }
52 }