本文整理汇总了C#中System.Activities.Activity类的典型用法代码示例。如果您正苦于以下问题:C# Activity类的具体用法?C# Activity怎么用?C# Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Activity类属于System.Activities命名空间,在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CacheMetadata
internal override void CacheMetadata(ActivityMetadata metadata, Activity owner, string operationName)
{
this.ShredParameters();
int index = 0;
foreach (Type type in this.argumentTypes)
{
if ((type == null) || (type == TypeHelper.VoidType))
{
metadata.AddValidationError(System.ServiceModel.Activities.SR.ArgumentCannotHaveNullOrVoidType(owner.DisplayName, this.argumentNames[index]));
}
if ((type == MessageDescription.TypeOfUntypedMessage) || MessageBuilder.IsMessageContract(type))
{
metadata.AddValidationError(System.ServiceModel.Activities.SR.ReceiveParametersContentDoesNotSupportMessage(owner.DisplayName, this.argumentNames[index]));
}
index++;
}
if (!metadata.HasViolations)
{
foreach (KeyValuePair<string, OutArgument> pair in this.Parameters)
{
RuntimeArgument argument = new RuntimeArgument(pair.Key, pair.Value.ArgumentType, ArgumentDirection.Out);
metadata.Bind(pair.Value, argument);
metadata.AddArgument(argument);
}
}
}
示例2: GetTransitionNames
/// <summary>
/// The get transitions.
/// </summary>
/// <param name="record">
/// The record.
/// </param>
/// <param name="rootActivity">
/// The root activity.
/// </param>
/// <returns>
/// A collection of possible transitions
/// </returns>
public static List<string> GetTransitionNames(this StateMachineStateRecord record, Activity rootActivity)
{
var transitions = GetTransitions(record, rootActivity);
return transitions != null
? transitions.Select(transition => transition.DisplayName).ToList()
: new List<string>();
}
示例3: Resolve
public static Activity Resolve(Activity root, string id)
{
if (root == null)
{
throw FxTrace.Exception.ArgumentNull("root");
}
if (string.IsNullOrEmpty(id))
{
throw FxTrace.Exception.ArgumentNullOrEmpty("id");
}
if (!root.IsMetadataCached)
{
IList<ValidationError> validationErrors = null;
ActivityUtilities.CacheRootMetadata(root, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.FullCachingOptions, null, ref validationErrors);
ActivityValidationServices.ThrowIfViolationsExist(validationErrors);
}
QualifiedId parsedId = QualifiedId.Parse(id);
Activity result;
if (!QualifiedId.TryGetElementFromRoot(root, parsedId, out result))
{
throw FxTrace.Exception.Argument("id", SR.IdNotFoundInWorkflow(id));
}
return result;
}
示例4: GenerateValidationErrorPrefix
internal static string GenerateValidationErrorPrefix(Activity toValidate, ActivityUtilities.ActivityCallStack parentChain, out Activity source)
{
bool flag = true;
string str = "";
source = toValidate;
for (int i = 0; i < parentChain.Count; i++)
{
ActivityUtilities.ChildActivity activity = parentChain[i];
if (activity.Activity.MemberOf.Parent != null)
{
flag = false;
break;
}
}
while (source.MemberOf.Parent != null)
{
source = source.Parent;
}
if (toValidate.MemberOf.Parent != null)
{
return System.Activities.SR.ValidationErrorPrefixForHiddenActivity(source);
}
if (!flag)
{
str = System.Activities.SR.ValidationErrorPrefixForPublicActivityWithHiddenParent(source.Parent, source);
}
return str;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:ActivityValidationServices.cs
示例5: NinjectWorkflowApplicationUnhandledExceptionEventArgs
/// <summary>
/// Initializes a new instance of the <see cref="NinjectWorkflowApplicationUnhandledExceptionEventArgs"/> class.
/// </summary>
/// <param name="instanceId">The instance id.</param>
/// <param name="unhandledException">The unhandled exception.</param>
/// <param name="exceptionSource">The exception source.</param>
/// <param name="exceptionSourceInstanceId">The exception source instance id.</param>
public NinjectWorkflowApplicationUnhandledExceptionEventArgs(Guid instanceId, Exception unhandledException, Activity exceptionSource, string exceptionSourceInstanceId)
: base(instanceId)
{
this.UnhandledException = unhandledException;
this.ExceptionSource = exceptionSource;
this.ExceptionSourceInstanceId = exceptionSourceInstanceId;
}
开发者ID:dmetzgar,项目名称:Ninject.Extensions.Wf,代码行数:14,代码来源:NinjectWorkflowApplicationUnhandledExceptionEventArgs.cs
示例6: CreateTwilioBookmarkName
/// <summary>
/// Creates a bookmark name for the given activity.
/// </summary>
/// <param name="context"></param>
/// <param name="callback"></param>
/// <returns></returns>
public static string CreateTwilioBookmarkName(this NativeActivityContext context, Activity activity)
{
return string.Format("{0}_{1}_{2}",
activity.Id,
activity.DisplayName,
Math.Abs(Guid.NewGuid().GetHashCode()));
}
示例7: printActivityTreeA
public static void printActivityTreeA(Activity activity)
{
if (tag == null)
{
tag = new activityStruct();
tag.parent = null;
tag.currentActivity = activity;
tag.displayName = activity.DisplayName;
}
System.Collections.Generic.IEnumerator<Activity> list = WorkflowInspectionServices.GetActivities(activity).GetEnumerator();
while (list.MoveNext())
{
activityStruct temp = new activityStruct();
temp.parent = tag;
temp.currentActivity = list.Current;
temp.displayName = list.Current.DisplayName;
printActivityTreeA(list.Current);
}
}
示例8: GatherAndValidateOverloads
public static bool GatherAndValidateOverloads(Activity activity, out Dictionary<string, List<RuntimeArgument>> overloadGroups, out List<RuntimeArgument> requiredArgumentsNotInOverloadGroups, out OverloadGroupEquivalenceInfo equivalenceInfo, ref IList<ValidationError> validationErrors)
{
overloadGroups = null;
requiredArgumentsNotInOverloadGroups = null;
foreach (RuntimeArgument argument in activity.RuntimeArguments)
{
if (!argument.OverloadGroupNames.IsNullOrEmpty())
{
foreach (string str in argument.OverloadGroupNames)
{
if (overloadGroups == null)
{
overloadGroups = new Dictionary<string, List<RuntimeArgument>>();
}
List<RuntimeArgument> list = null;
if (!overloadGroups.TryGetValue(str, out list))
{
list = new List<RuntimeArgument>();
overloadGroups.Add(str, list);
}
list.Add(argument);
}
}
else if (argument.IsRequired)
{
if (requiredArgumentsNotInOverloadGroups == null)
{
requiredArgumentsNotInOverloadGroups = new List<RuntimeArgument>();
}
requiredArgumentsNotInOverloadGroups.Add(argument);
}
}
equivalenceInfo = GetOverloadGroupEquivalence(overloadGroups);
return ValidateOverloadGroupDefinitions(activity, equivalenceInfo, overloadGroups, ref validationErrors);
}
示例9:
void ActivityInstanceMap.IActivityReference.Load(Activity activity, ActivityInstanceMap instanceMap)
{
if (this.activityInstance.Activity == null)
{
((ActivityInstanceMap.IActivityReference) this.activityInstance).Load(activity, instanceMap);
}
}
示例10: SetupWorkflowCompensationBehavior
internal void SetupWorkflowCompensationBehavior(NativeActivityContext context, BookmarkCallback callback, Activity workflowCompensationBehavior)
{
this.WorkflowCompensationScheduled = context.CreateBookmark(callback);
context.ScheduleSecondaryRoot(workflowCompensationBehavior, null);
this.Add(0L, new CompensationTokenData(0L, 0L));
this.IsWorkflowCompensationBehaviorScheduled = true;
}
示例11: MappableLocation
public MappableLocation(LocationReference locationOwner, Activity activity, System.Activities.ActivityInstance activityInstance, System.Activities.Location location)
{
this.Name = locationOwner.Name;
this.OwnerDisplayName = activity.DisplayName;
this.Location = location;
this.MappingKeyName = string.Format(CultureInfo.InvariantCulture, "activity.{0}-{1}_{2}", new object[] { activity.Id, locationOwner.Id, activityInstance.Id });
}
示例12: CreateLogicalThread
private int CreateLogicalThread(Activity activity, System.Activities.ActivityInstance instance, bool primeCurrentInstance)
{
Stack<System.Activities.ActivityInstance> ancestors = null;
if (!this.DebugStartedAtRoot)
{
ancestors = new Stack<System.Activities.ActivityInstance>();
if (((activity != instance.Activity) || primeCurrentInstance) && (primeCurrentInstance || !IsParallelActivity(instance.Activity)))
{
ancestors.Push(instance);
}
System.Activities.ActivityInstance parent = instance.Parent;
while ((parent != null) && !IsParallelActivity(parent.Activity))
{
ancestors.Push(parent);
parent = parent.Parent;
}
if (((parent != null) && IsParallelActivity(parent.Activity)) && (this.GetExecutingThreadId(parent.Activity, false) < 0))
{
int num = this.CreateLogicalThread(parent.Activity, parent, true);
}
}
string threadName = string.Empty;
if (activity.Parent != null)
{
threadName = "DebuggerThread:" + activity.Parent.DisplayName;
}
int key = this.stateManager.CreateLogicalThread(threadName);
Stack<Activity> stack2 = new Stack<Activity>();
this.runningThreads.Add(key, stack2);
if (!this.DebugStartedAtRoot && (ancestors != null))
{
this.PrimeCallStack(key, ancestors);
}
return key;
}
示例13: Declare
public void Declare(LocationReference locationReference, Activity owner, ref IList<ValidationError> validationErrors)
{
if (locationReference.Name == null)
{
if (this.unnamedDeclarations == null)
{
this.unnamedDeclarations = new List<LocationReference>();
}
this.unnamedDeclarations.Add(locationReference);
}
else if (this.Declarations.ContainsKey(locationReference.Name))
{
string id = null;
if (owner != null)
{
id = owner.Id;
}
ValidationError data = new ValidationError(System.Activities.SR.SymbolNamesMustBeUnique(locationReference.Name)) {
Source = owner,
Id = id
};
ActivityUtilities.Add<ValidationError>(ref validationErrors, data);
}
else
{
this.Declarations.Add(locationReference.Name, locationReference);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:28,代码来源:ActivityLocationReferenceEnvironment.cs
示例14: InvokeExpression
public object InvokeExpression(int expressionId, System.Collections.Generic.IList<System.Activities.LocationReference> locations, System.Activities.ActivityContext activityContext) {
if ((this.rootActivity == null)) {
this.rootActivity = this;
}
if ((this.dataContextActivities == null)) {
this.dataContextActivities = paper_use1_TypedDataContext2_ForReadOnly.GetDataContextActivitiesHelper(this.rootActivity, this.forImplementation);
}
if ((expressionId == 0)) {
System.Activities.XamlIntegration.CompiledDataContext[] cachedCompiledDataContext = paper_use1_TypedDataContext2_ForReadOnly.GetCompiledDataContextCacheHelper(this.dataContextActivities, activityContext, this.rootActivity, this.forImplementation, 1);
if ((cachedCompiledDataContext[0] == null)) {
cachedCompiledDataContext[0] = new paper_use1_TypedDataContext2_ForReadOnly(locations, activityContext, true);
}
paper_use1_TypedDataContext2_ForReadOnly valDataContext0 = ((paper_use1_TypedDataContext2_ForReadOnly)(cachedCompiledDataContext[0]));
return valDataContext0.ValueType___Expr0Get();
}
if ((expressionId == 1)) {
System.Activities.XamlIntegration.CompiledDataContext[] cachedCompiledDataContext = paper_use1_TypedDataContext2_ForReadOnly.GetCompiledDataContextCacheHelper(this.dataContextActivities, activityContext, this.rootActivity, this.forImplementation, 1);
if ((cachedCompiledDataContext[0] == null)) {
cachedCompiledDataContext[0] = new paper_use1_TypedDataContext2_ForReadOnly(locations, activityContext, true);
}
paper_use1_TypedDataContext2_ForReadOnly valDataContext1 = ((paper_use1_TypedDataContext2_ForReadOnly)(cachedCompiledDataContext[0]));
return valDataContext1.ValueType___Expr1Get();
}
return null;
}
开发者ID:ThinerZQ,项目名称:CrowdSourcingWithWWF,代码行数:25,代码来源:CrowdSourcing.xaml_paper_use1_CompiledExpressionRoot.cs
示例15: GetVariables
public static GenericVariableCollection GetVariables(NativeActivityContext context, Activity activity)
{
Contract.Requires(context != null);
Contract.Requires(activity != null);
return GetVariables(context, activity.Id);
}