本文整理匯總了C#中System.Activities.NativeActivity<TResult>類的典型用法代碼示例。如果您正苦於以下問題:C# NativeActivity<TResult>類的具體用法?C# NativeActivity<TResult>怎麽用?C# NativeActivity<TResult>使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
NativeActivity<TResult>類屬於System.Activities命名空間,在下文中一共展示了NativeActivity<TResult>類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Execute
public sealed class ReadInt : NativeActivity<int>
{
[RequiredArgument]
public InArgument<string> BookmarkName { get; set; }
protected override void Execute(NativeActivityContext context)
{
string name = BookmarkName.Get(context);
if (string.IsNullOrEmpty(name))
{
throw new ArgumentException("BookmarkName cannot be an Empty string.",
"BookmarkName");
}
context.CreateBookmark(name, new BookmarkCallback(OnReadComplete));
}
// NativeActivity derived activities that do asynchronous operations by calling
// one of the CreateBookmark overloads defined on System.Activities.NativeActivityContext
// must override the CanInduceIdle property and return true.
protected override bool CanInduceIdle
{
get { return true; }
}
void OnReadComplete(NativeActivityContext context, Bookmark bookmark, object state)
{
this.Result.Set(context, Convert.ToInt32(state));
}
}