InvokeFunc.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / System.Activities / System / Activities / Expressions / InvokeFunc.cs / 1305376 / InvokeFunc.cs

                            //------------------------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------------------------

namespace System.Activities.Expressions 
{
    using System.Activities.Validation; 
    using System.Collections.Generic; 
    using System.ComponentModel;
    using System.Windows.Markup; 

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    { 
        public InvokeFunc()
        { 
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func
        {
            get;
            set; 
        }
 
        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return;
            }
            context.ScheduleFunc(this.Func, 
                new CompletionCallback(this.OnActivityFuncComplete));
        } 
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            {
                this.Result.Set(context, resultValue);
            } 
            else
            { 
                this.Result.Set(context, default(TResult)); 
            }
        } 
    }

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        { 
        }
 
        [RequiredArgument]
        public InArgument Argument
        {
            get; 
            set;
        } 
 
        public ActivityFunc Func
        { 
            get;
            set;
        }
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            }
            context.ScheduleFunc(this.Func, this.Argument.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete));
        } 

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            }
            else
            { 
                this.Result.Set(context, default(TResult));
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [DefaultValue(null)] 
        public ActivityFunc Func
        { 
            get; 
            set;
        } 

        protected override void Execute(NativeActivityContext context)
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            } 

            context.ScheduleFunc(this.Func, 
                this.Argument1.Get(context),
                this.Argument2.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete));
        } 

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            }
        }
    } 

    [ContentProperty("Func")] 
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        {
        }

        [RequiredArgument] 
        public InArgument Argument1
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument2
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument3
        {
            get;
            set; 
        }
 
        [DefaultValue(null)] 
        public ActivityFunc Func
        { 
            get;
            set;
        }
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            }

            context.ScheduleFunc(this.Func,
                this.Argument1.Get(context), 
                this.Argument2.Get(context),
                this.Argument3.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument3
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument4
        { 
            get;
            set; 
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func
        {
            get;
            set; 
        }
 
        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return;
            }
 
            context.ScheduleFunc(this.Func,
                this.Argument1.Get(context), 
                this.Argument2.Get(context), 
                this.Argument3.Get(context),
                this.Argument4.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete));
        }

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        {
            if (completedInstance.State == ActivityInstanceState.Closed) 
            { 
                this.Result.Set(context, resultValue);
            } 
        }
    }

    [ContentProperty("Func")] 
    public sealed class InvokeFunc : NativeActivity
    { 
        public InvokeFunc() 
        {
        } 

        [RequiredArgument]
        public InArgument Argument1
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument2
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument3
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument4 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument5 
        {
            get; 
            set; 
        }
 
        [DefaultValue(null)]
        public ActivityFunc Func
        {
            get; 
            set;
        } 
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null)
            {
                return;
            } 

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context), 
                Argument4.Get(context), Argument5.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete));
        } 

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed) 
            {
                this.Result.Set(context, resultValue); 
            } 
        }
    } 

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    { 
        public InvokeFunc()
        { 
        } 

        [RequiredArgument] 
        public InArgument Argument1
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument2
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument3 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument4 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument5
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument6 
        {
            get;
            set;
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func 
        {
            get; 
            set;
        }

        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            { 
                return;
            } 

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        {
            if (completedInstance.State == ActivityInstanceState.Closed) 
            {
                this.Result.Set(context, resultValue);
            }
        } 
    }
 
    [ContentProperty("Func")] 
    public sealed class InvokeFunc : NativeActivity
    { 
        public InvokeFunc()
        {
        }
 
        [RequiredArgument]
        public InArgument Argument1 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument2 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument3
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument4 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument5 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument6
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument7
        { 
            get;
            set; 
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func
        {
            get;
            set; 
        }
 
        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return;
            }
 
            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument3
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument4
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument5
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument6
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument7 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument8 
        {
            get; 
            set; 
        }
 
        [DefaultValue(null)]
        public ActivityFunc Func
        {
            get; 
            set;
        } 
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null)
            {
                return;
            } 

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context), 
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue); 
            }
        } 
    }

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        { 
        }
 
        [RequiredArgument]
        public InArgument Argument1
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument2 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument3 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument4
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument5
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument6
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument7
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument8 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument9 
        {
            get; 
            set; 
        }
 
        [DefaultValue(null)]
        public ActivityFunc Func
        {
            get; 
            set;
        } 
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null)
            {
                return;
            } 

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context), 
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue); 
            }
        } 
    }

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        { 
        }
 
        [RequiredArgument]
        public InArgument Argument1
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument2 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument3 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument4
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument5
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument6
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument7
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument8 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument9 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument10
        {
            get; 
            set;
        } 
 
        [DefaultValue(null)]
        public ActivityFunc Func 
        {
            get;
            set;
        } 

        protected override void Execute(NativeActivityContext context) 
        { 
            if (this.Func == null || this.Func.Handler == null)
            { 
                return;
            }

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context), 
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument3
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument4
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument5
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument6
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument7 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument8 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument9
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument10 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument11 
        {
            get; 
            set;
        }

        [DefaultValue(null)] 
        public ActivityFunc Func
        { 
            get; 
            set;
        } 

        protected override void Execute(NativeActivityContext context)
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            } 

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context), 
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context),
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete));
        } 

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            }
        }
    } 

    [ContentProperty("Func")] 
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        {
        }

        [RequiredArgument] 
        public InArgument Argument1
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument2
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument3
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument4
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument5 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument6 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument7
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument8 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument9 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument10
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument11
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument12
        {
            get;
            set; 
        }
 
        [DefaultValue(null)] 
        public ActivityFunc Func
        { 
            get;
            set;
        }
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            }

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument3
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument4
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument5
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument6
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument7 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument8 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument9
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument10 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument11 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument12
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument13
        { 
            get;
            set; 
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func
        {
            get;
            set; 
        }
 
        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return;
            }
 
            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context), 
                Argument12.Get(context), Argument13.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue); 
            }
        } 
    }

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        { 
        }
 
        [RequiredArgument]
        public InArgument Argument1
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument2 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument3 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument4
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument5
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument6
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument7
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument8 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument9 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument10
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument11 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument12 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument13
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument14
        { 
            get;
            set; 
        } 

        [DefaultValue(null)] 
        public ActivityFunc Func
        {
            get;
            set; 
        }
 
        protected override void Execute(NativeActivityContext context) 
        {
            if (this.Func == null || this.Func.Handler == null) 
            {
                return;
            }
 
            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context), 
                Argument12.Get(context), Argument13.Get(context), Argument14.Get(context),
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue); 
            }
        } 
    }

    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity 
    {
        public InvokeFunc() 
        { 
        }
 
        [RequiredArgument]
        public InArgument Argument1
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument2 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument3 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument4
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument5
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument6
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument7
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument8 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument9 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument10
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument11 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument12 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument13
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument14
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument15
        {
            get;
            set; 
        }
 
        [DefaultValue(null)] 
        public ActivityFunc Func
        { 
            get;
            set;
        }
 
        protected override void Execute(NativeActivityContext context)
        { 
            if (this.Func == null || this.Func.Handler == null) 
            {
                return; 
            }

            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context), Argument13.Get(context), Argument14.Get(context), Argument15.Get(context), 
                new CompletionCallback(this.OnActivityFuncComplete)); 
        }
 
        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue)
        {
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            } 
        } 
    }
 
    [ContentProperty("Func")]
    public sealed class InvokeFunc : NativeActivity
    {
        public InvokeFunc() 
        {
        } 
 
        [RequiredArgument]
        public InArgument Argument1 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument2 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument3
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument4
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument5
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument6
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument7 
        { 
            get;
            set; 
        }

        [RequiredArgument]
        public InArgument Argument8 
        {
            get; 
            set; 
        }
 
        [RequiredArgument]
        public InArgument Argument9
        {
            get; 
            set;
        } 
 
        [RequiredArgument]
        public InArgument Argument10 
        {
            get;
            set;
        } 

        [RequiredArgument] 
        public InArgument Argument11 
        {
            get; 
            set;
        }

        [RequiredArgument] 
        public InArgument Argument12
        { 
            get; 
            set;
        } 

        [RequiredArgument]
        public InArgument Argument13
        { 
            get;
            set; 
        } 

        [RequiredArgument] 
        public InArgument Argument14
        {
            get;
            set; 
        }
 
        [RequiredArgument] 
        public InArgument Argument15
        { 
            get;
            set;
        }
 
        [RequiredArgument]
        public InArgument Argument16 
        { 
            get;
            set; 
        }

        [DefaultValue(null)]
        public ActivityFunc Func 
        {
            get; 
            set; 
        }
 
        protected override void Execute(NativeActivityContext context)
        {
            if (this.Func == null || this.Func.Handler == null)
            { 
                return;
            } 
 
            context.ScheduleFunc(this.Func, Argument1.Get(context), Argument2.Get(context), Argument3.Get(context),
                Argument4.Get(context), Argument5.Get(context), Argument6.Get(context), Argument7.Get(context), 
                Argument8.Get(context), Argument9.Get(context), Argument10.Get(context), Argument11.Get(context),
                Argument12.Get(context), Argument13.Get(context), Argument14.Get(context), Argument15.Get(context),
                Argument16.Get(context), new CompletionCallback(this.OnActivityFuncComplete));
        } 

        void OnActivityFuncComplete(NativeActivityContext context, ActivityInstance completedInstance, TResult resultValue) 
        { 
            if (completedInstance.State == ActivityInstanceState.Closed)
            { 
                this.Result.Set(context, resultValue);
            }
        }
    } 
}

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK