本文整理汇总了C#中System.Workflow.ComponentModel.Activity类的典型用法代码示例。如果您正苦于以下问题:C# Activity类的具体用法?C# Activity怎么用?C# Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Activity类属于System.Workflow.ComponentModel命名空间,在下文中一共展示了Activity类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetAllMembers
internal static void GetAllMembers(Activity activity, IList<TrackingDataItem> items, TrackingAnnotationCollection annotations)
{
Type type = activity.GetType();
foreach (FieldInfo info in type.GetFields(BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance))
{
if (!IsInternalVariable(info.Name))
{
TrackingDataItem item = new TrackingDataItem {
FieldName = info.Name,
Data = GetRuntimeValue(info.GetValue(activity), activity)
};
foreach (string str in annotations)
{
item.Annotations.Add(str);
}
items.Add(item);
}
}
foreach (PropertyInfo info2 in type.GetProperties(BindingFlags.GetProperty | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance))
{
if (!IsInternalVariable(info2.Name) && (info2.GetIndexParameters().Length <= 0))
{
TrackingDataItem item2 = new TrackingDataItem {
FieldName = info2.Name,
Data = GetRuntimeValue(info2.GetValue(activity, null), activity)
};
foreach (string str2 in annotations)
{
item2.Annotations.Add(str2);
}
items.Add(item2);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:34,代码来源:PropertyHelper.cs
示例2: InitializeCorrelationTokenCollection
internal static void InitializeCorrelationTokenCollection(Activity activity, CorrelationToken correlator)
{
if ((correlator != null) && !string.IsNullOrEmpty(correlator.OwnerActivityName))
{
string ownerActivityName = correlator.OwnerActivityName;
Activity activityByName = activity.GetActivityByName(ownerActivityName);
if (activityByName == null)
{
activityByName = Helpers.ParseActivityForBind(activity, ownerActivityName);
}
if (activityByName == null)
{
throw new ArgumentException("ownerActivity");
}
CorrelationTokenCollection tokens = activityByName.GetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty) as CorrelationTokenCollection;
if (tokens == null)
{
tokens = new CorrelationTokenCollection();
activityByName.SetValue(CorrelationTokenCollection.CorrelationTokenCollectionProperty, tokens);
}
if (!tokens.Contains(correlator.Name))
{
tokens.Add(correlator);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:26,代码来源:ActivityHelpers.cs
示例3: WalkerEventArgs
internal WalkerEventArgs(Activity currentActivity, object currentValue, PropertyInfo currentProperty, object currentPropertyOwner)
: this(currentActivity)
{
this.currentPropertyOwner = currentPropertyOwner;
this.currentProperty = currentProperty;
this.currentValue = currentValue;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:Walker.cs
示例4: Initialize
protected override void Initialize(Activity activity)
{
base.Initialize(activity);
HelpText = DR.GetString(DR.SequentialWorkflowHelpText);
Header.Text = DR.GetString(DR.StartSequentialWorkflow);
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:ServiceDesigner.cs
示例5: ApplyTo
protected override bool ApplyTo(Activity rootActivity)
{
if (rootActivity == null)
{
return false;
}
RuleDefinitions definitions = rootActivity.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
if (definitions == null)
{
definitions = new RuleDefinitions();
rootActivity.SetValue(RuleDefinitions.RuleDefinitionsProperty, definitions);
}
bool flag = false;
if (definitions.Conditions.RuntimeMode)
{
definitions.Conditions.RuntimeMode = false;
flag = true;
}
try
{
definitions.Conditions.Add(this.ConditionDefinition);
}
finally
{
if (flag)
{
definitions.Conditions.RuntimeMode = true;
}
}
return true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:AddedConditionAction.cs
示例6: ApplyTo
protected override bool ApplyTo(Activity rootActivity)
{
if (rootActivity == null)
{
return false;
}
RuleDefinitions definitions = rootActivity.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
if ((definitions == null) || (definitions.RuleSets == null))
{
return false;
}
if (definitions.RuleSets[this.RuleSetName] == null)
{
return false;
}
bool flag = false;
if (definitions.Conditions.RuntimeMode)
{
definitions.Conditions.RuntimeMode = false;
flag = true;
}
try
{
definitions.RuleSets.Remove(this.RuleSetName);
definitions.RuleSets.Add(this.updated);
}
finally
{
if (flag)
{
definitions.RuleSets.RuntimeMode = true;
}
}
return true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:UpdatedRuleSetAction.cs
示例7: CreateTypeProvider
protected static TypeProvider CreateTypeProvider(Activity rootActivity)
{
TypeProvider typeProvider = new TypeProvider(null);
Type companionType = rootActivity.GetType();
typeProvider.SetLocalAssembly(companionType.Assembly);
typeProvider.AddAssembly(companionType.Assembly);
foreach (AssemblyName assemblyName in companionType.Assembly.GetReferencedAssemblies())
{
Assembly referencedAssembly = null;
try
{
referencedAssembly = Assembly.Load(assemblyName);
if (referencedAssembly != null)
{
typeProvider.AddAssembly(referencedAssembly);
}
}
catch (Exception e)
{
if (Fx.IsFatal(e))
{
throw;
}
}
if (referencedAssembly == null && assemblyName.CodeBase != null)
{
typeProvider.AddAssemblyReference(assemblyName.CodeBase);
}
}
return typeProvider;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:35,代码来源:WorkflowDefinitionContext.cs
示例8: SaveWorkflowInstanceState
// Save the workflow instance state at the point of persistence with option of locking the instance state if it is shared
// across multiple runtimes or multiple phase instance updates
protected override void SaveWorkflowInstanceState(Activity rootActivity, bool unlock)
{
// Save the workflow
Guid contextGuid = (Guid)rootActivity.GetValue(Activity.ActivityContextGuidProperty);
Console.WriteLine("Saving instance: {0}\n", contextGuid);
SerializeToFile(
WorkflowPersistenceService.GetDefaultSerializedForm(rootActivity), contextGuid);
// See when the next timer (Delay activity) for this workflow will expire
TimerEventSubscriptionCollection timers = (TimerEventSubscriptionCollection)rootActivity.GetValue(TimerEventSubscriptionCollection.TimerCollectionProperty);
TimerEventSubscription subscription = timers.Peek();
if (subscription != null)
{
// Set a system timer to automatically reload this workflow when its next timer expires
TimerCallback callback = new TimerCallback(ReloadWorkflow);
TimeSpan timeDifference = subscription.ExpiresAt - DateTime.UtcNow;
// check to make sure timeDifference is in legal range
if (timeDifference > FilePersistenceService.MaxInterval)
{
timeDifference = FilePersistenceService.MaxInterval;
}
else if (timeDifference < TimeSpan.Zero)
{
timeDifference = TimeSpan.Zero;
}
this.instanceTimers.Add(contextGuid, new System.Threading.Timer(
callback,
subscription.WorkflowInstanceId,
timeDifference,
new TimeSpan(-1)));
}
}
开发者ID:ssickles,项目名称:archive,代码行数:34,代码来源:FilePersistence.cs
示例9: RuleSetDialog
public RuleSetDialog(Activity activity, RuleSet ruleSet)
{
if (activity == null)
throw (new ArgumentNullException("activity"));
InitializeDialog(ruleSet);
ITypeProvider typeProvider;
this.serviceProvider = activity.Site;
if (this.serviceProvider != null)
{
typeProvider = (ITypeProvider)this.serviceProvider.GetService(typeof(ITypeProvider));
if (typeProvider == null)
{
string message = string.Format(CultureInfo.CurrentCulture, Messages.MissingService, typeof(ITypeProvider).FullName);
throw new InvalidOperationException(message);
}
WorkflowDesignerLoader loader = this.serviceProvider.GetService(typeof(WorkflowDesignerLoader)) as WorkflowDesignerLoader;
if (loader != null)
loader.Flush();
}
else
{
// no service provider, so make a TypeProvider that has all loaded Assemblies
TypeProvider newProvider = new TypeProvider(null);
foreach (Assembly a in AppDomain.CurrentDomain.GetAssemblies())
newProvider.AddAssembly(a);
typeProvider = newProvider;
}
RuleValidation validation = new RuleValidation(activity, typeProvider, false);
this.ruleParser = new Parser(validation);
}
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:RuleSetDialog.cs
示例10: WorkflowCompletedEventArgs
internal WorkflowCompletedEventArgs(WorkflowInstance instance, Activity workflowDefinition)
: base(instance)
{
this._outputParameters = new Dictionary<String, Object>();
this._originalWorkflowDefinition = workflowDefinition;
this._workflowDefinition = null;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:7,代码来源:WorkflowEventArgs.cs
示例11: ApplyTo
protected internal override bool ApplyTo(Activity rootActivity)
{
if (rootActivity == null)
{
throw new ArgumentNullException("rootActivity");
}
if (!(rootActivity is CompositeActivity))
{
throw new ArgumentException(SR.GetString("Error_RootActivityTypeInvalid"), "rootActivity");
}
CompositeActivity activity = rootActivity.TraverseDottedPathFromRoot(base.OwnerActivityDottedPath) as CompositeActivity;
if (activity == null)
{
return false;
}
if (this.removedActivityIndex >= activity.Activities.Count)
{
return false;
}
activity.DynamicUpdateMode = true;
try
{
this.originalRemovedActivity = activity.Activities[this.removedActivityIndex];
activity.Activities.RemoveAt(this.removedActivityIndex);
}
finally
{
activity.DynamicUpdateMode = false;
}
return true;
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:RemovedActivityAction.cs
示例12: Evaluate
// Methods
public override bool Evaluate (Activity activity, IServiceProvider provider)
{
Activity parent = activity;
RuleDefinitions definitions = null;
while (parent != null) {
definitions = (RuleDefinitions) parent.GetValue (RuleDefinitions.RuleDefinitionsProperty);
if (definitions != null)
break;
parent = parent.Parent;
}
if (definitions == null) {
Console.WriteLine ("No definition");
return false;
}
//Console.WriteLine ("Definition {0} at {1}", definitions, parent);
RuleValidation validation = new RuleValidation (activity.GetType (), null);
RuleExecution execution = new RuleExecution (validation, parent);
RuleCondition condition = definitions.Conditions [ConditionName];
//Console.WriteLine ("Condition {0}", condition);
return condition.Evaluate (execution);
}
开发者ID:alesliehughes,项目名称:olive,代码行数:29,代码来源:RuleConditionReference.cs
示例13: FilterDependencyProperties
internal static void FilterDependencyProperties(IServiceProvider serviceProvider, Activity activity)
{
IExtenderListService service = serviceProvider.GetService(typeof(IExtenderListService)) as IExtenderListService;
if (service != null)
{
Dictionary<string, DependencyProperty> dictionary = new Dictionary<string, DependencyProperty>();
foreach (DependencyProperty property in activity.MetaDependencyProperties)
{
dictionary.Add(property.Name, property);
}
List<string> list = new List<string>();
foreach (IExtenderProvider provider in service.GetExtenderProviders())
{
if (!provider.CanExtend(activity))
{
ProvidePropertyAttribute[] customAttributes = provider.GetType().GetCustomAttributes(typeof(ProvidePropertyAttribute), true) as ProvidePropertyAttribute[];
foreach (ProvidePropertyAttribute attribute in customAttributes)
{
list.Add(attribute.PropertyName);
}
}
}
foreach (string str in list)
{
if (dictionary.ContainsKey(str))
{
activity.RemoveProperty(dictionary[str]);
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:ExtenderHelpers.cs
示例14: AddActivityToDesigner
public void AddActivityToDesigner(Activity activity)
{
if (activity == null)
{
throw new ArgumentNullException("activity");
}
IDesignerHost service = base.GetService(typeof(IDesignerHost)) as IDesignerHost;
if (service == null)
{
throw new InvalidOperationException(SR.GetString("General_MissingService", new object[] { typeof(IDesignerHost).FullName }));
}
if ((activity.Parent == null) && (service.RootComponent == null))
{
string str = activity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
string name = !string.IsNullOrEmpty(str) ? Helpers.GetClassName(str) : Helpers.GetClassName(activity.GetType().FullName);
service.Container.Add(activity, name);
this.AddTargetFrameworkProvider(activity);
}
else
{
service.Container.Add(activity, activity.QualifiedName);
this.AddTargetFrameworkProvider(activity);
}
if (activity is CompositeActivity)
{
foreach (Activity activity2 in Helpers.GetNestedActivities(activity as CompositeActivity))
{
service.Container.Add(activity2, activity2.QualifiedName);
this.AddTargetFrameworkProvider(activity2);
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:32,代码来源:WorkflowDesignerLoader.cs
示例15: ApplyDynamicUpdateMode
private void ApplyDynamicUpdateMode(Activity seedActivity)
{
Queue<Activity> queue = new Queue<Activity>();
queue.Enqueue(seedActivity);
while (queue.Count > 0)
{
Activity activity = queue.Dequeue();
activity.Readonly = true;
activity.DynamicUpdateMode = true;
foreach (DependencyProperty property in activity.MetaDependencyProperties)
{
if (activity.IsBindingSet(property))
{
ActivityBind binding = activity.GetBinding(property);
if (binding != null)
{
binding.DynamicUpdateMode = true;
}
}
}
if (activity is CompositeActivity)
{
CompositeActivity activity2 = activity as CompositeActivity;
activity2.Activities.ListChanged += new EventHandler<ActivityCollectionChangeEventArgs>(this.OnActivityListChanged);
foreach (Activity activity3 in ((CompositeActivity) activity).Activities)
{
queue.Enqueue(activity3);
}
}
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:31,代码来源:WorkflowChanges.cs
示例16: Track
internal void Track(Activity activity, object arg, IServiceProvider provider, IList<TrackingDataItem> items)
{
foreach (TrackingExtract extract in this._extracts)
{
extract.GetData(activity, provider, items);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:UserTrackPoint.cs
示例17: RuleValidation
public RuleValidation(Activity activity, ITypeProvider typeProvider, bool checkStaticType)
{
this.errors = new ValidationErrorCollection();
this.typesUsed = new Dictionary<string, Type>(0x10);
this.activeParentNodes = new Stack<CodeExpression>();
this.expressionInfoMap = new Dictionary<CodeExpression, RuleExpressionInfo>();
this.typeRefMap = new Dictionary<CodeTypeReference, Type>();
if (activity == null)
{
throw new ArgumentNullException("activity");
}
if (typeProvider == null)
{
throw new ArgumentNullException("typeProvider");
}
this.thisType = ConditionHelper.GetContextType(typeProvider, activity);
this.typeProvider = typeProvider;
this.checkStaticType = checkStaticType;
if (checkStaticType)
{
this.authorizedTypes = WorkflowCompilationContext.Current.GetAuthorizedTypes();
this.typesUsedAuthorized = new Dictionary<string, Type>();
this.typesUsedAuthorized.Add(voidTypeName, voidType);
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:25,代码来源:RuleValidation.cs
示例18: GetContextType
internal static Type GetContextType(ITypeProvider typeProvider, Activity currentActivity)
{
Type contextType = null;
string className = String.Empty;
Activity rootActivity = null;
if (Helpers.IsActivityLocked(currentActivity))
{
rootActivity = Helpers.GetDeclaringActivity(currentActivity);
}
else
{
rootActivity = Helpers.GetRootActivity(currentActivity);
}
if (rootActivity != null)
{
className = rootActivity.GetValue(WorkflowMarkupSerializer.XClassProperty) as string;
if (!String.IsNullOrEmpty(className))
contextType = typeProvider.GetType(className, false);
if (contextType == null)
contextType = typeProvider.GetType(rootActivity.GetType().FullName);
// If all else fails (likely, we don't have a type provider), it's the root activity type.
if (contextType == null)
contextType = rootActivity.GetType();
}
return contextType;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:31,代码来源:Helpers.cs
示例19: ApplyTo
protected override bool ApplyTo(Activity rootActivity)
{
if (rootActivity == null)
return false;
RuleDefinitions rules = rootActivity.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
if (rules == null)
{
rules = new RuleDefinitions();
((Activity)rootActivity).SetValue(RuleDefinitions.RuleDefinitionsProperty, rules);
}
//
bool setRuntimeMode = false;
if (rules.Conditions.RuntimeMode)
{
rules.Conditions.RuntimeMode = false;
setRuntimeMode = true;
}
try
{
rules.Conditions.Add(this.ConditionDefinition);
}
finally
{
if (setRuntimeMode)
rules.Conditions.RuntimeMode = true;
}
return true;
}
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:30,代码来源:ConditionChanges.cs
示例20: SaveCompletedContextActivity
// Save the completed activity state.
protected override void SaveCompletedContextActivity(Activity activity)
{
Guid contextGuid = (Guid)activity.GetValue(Activity.ActivityContextGuidProperty);
Console.WriteLine("Saving completed activity context: {0}", contextGuid);
SerializeToFile(
WorkflowPersistenceService.GetDefaultSerializedForm(activity), contextGuid);
}
开发者ID:spzenk,项目名称:sfdocsamples,代码行数:8,代码来源:FilePersistenceService.cs
注:本文中的System.Workflow.ComponentModel.Activity类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论