當前位置: 首頁>>代碼示例>>C#>>正文


C# Activity.SetValue方法代碼示例

本文整理匯總了C#中System.Workflow.ComponentModel.Activity.SetValue方法的典型用法代碼示例。如果您正苦於以下問題:C# Activity.SetValue方法的具體用法?C# Activity.SetValue怎麽用?C# Activity.SetValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Workflow.ComponentModel.Activity的用法示例。


在下文中一共展示了Activity.SetValue方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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

示例2: SetWhenCondition

 public void SetWhenCondition(Activity activity, ActivityCondition handler)
 {
     if (activity.Parent is ConditionedActivityGroup)
     {
         activity.SetValue(ConditionedActivityGroup.WhenConditionProperty, handler);
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:7,代碼來源:ConditionPropertyProviderExtender.cs

示例3: TryCompensateLastCompletedChildActivity

 private static bool TryCompensateLastCompletedChildActivity(ActivityExecutionContext context, Activity targetActivity, IActivityEventListener<ActivityExecutionStatusChangedEventArgs> statusChangeHandler, bool isimmediateCompensation)
 {
     SortedDictionary<int, CompensationInfo> sortedListOfCompensatableTargets = new SortedDictionary<int, CompensationInfo>();
     if (targetActivity is CompositeActivity)
     {
         if (CollectCompensatableTargetActivities(targetActivity as CompositeActivity, sortedListOfCompensatableTargets, isimmediateCompensation))
         {
             return true;
         }
         if (CollectCompensatableActiveContexts(context, targetActivity, sortedListOfCompensatableTargets, isimmediateCompensation))
         {
             return true;
         }
         CollectCompensatableCompletedContexts(context, targetActivity, sortedListOfCompensatableTargets, isimmediateCompensation);
         if (sortedListOfCompensatableTargets.Count == 0)
         {
             CompleteRevokedExecutionContext(targetActivity, context);
             return false;
         }
         int? nullable = targetActivity.GetValue(CompensationHandlingFilter.LastCompensatedOrderIdProperty) as int?;
         int num = -1;
         CompensationInfo info = null;
         foreach (int num2 in sortedListOfCompensatableTargets.Keys)
         {
             if (nullable.HasValue)
             {
                 int? nullable2 = nullable;
                 int num3 = num2;
                 if ((nullable2.GetValueOrDefault() < num3) && nullable2.HasValue)
                 {
                     break;
                 }
             }
             info = sortedListOfCompensatableTargets[num2];
             num = num2;
         }
         if (info == null)
         {
             CompleteRevokedExecutionContext(targetActivity, context);
             return false;
         }
         targetActivity.SetValue(CompensationHandlingFilter.LastCompensatedOrderIdProperty, num);
         if ((info.TargetActivity != null) && (info.TargetActivity is ICompensatableActivity))
         {
             info.TargetActivity.RegisterForStatusChange(Activity.StatusChangedEvent, statusChangeHandler);
             context.CompensateActivity(info.TargetActivity);
             return true;
         }
         if ((info.TargetExecutionInfo != null) && (info.TargetExecutionContextManager != null))
         {
             ActivityExecutionContext context2 = info.TargetExecutionContextManager.DiscardPersistedExecutionContext(info.TargetExecutionInfo);
             if (context2.Activity is ICompensatableActivity)
             {
                 context2.Activity.RegisterForStatusChange(Activity.StatusChangedEvent, statusChangeHandler);
                 context2.CompensateActivity(context2.Activity);
                 return true;
             }
             if (context2.Activity is CompositeActivity)
             {
                 Activity lastCompensatableChild = GetLastCompensatableChild(context2.Activity as CompositeActivity);
                 if (lastCompensatableChild != null)
                 {
                     lastCompensatableChild.RegisterForStatusChange(Activity.StatusChangedEvent, statusChangeHandler);
                     context2.CompensateActivity(lastCompensatableChild);
                     return true;
                 }
                 return TryCompensateLastCompletedChildActivity(context2, context2.Activity, statusChangeHandler, false);
             }
         }
         else if ((info.TargetExecutionContext != null) && (info.TargetExecutionContext.Activity is CompositeActivity))
         {
             Activity activity = GetLastCompensatableChild(info.TargetExecutionContext.Activity as CompositeActivity);
             if (activity != null)
             {
                 activity.RegisterForStatusChange(Activity.StatusChangedEvent, statusChangeHandler);
                 info.TargetExecutionContext.CompensateActivity(activity);
                 return true;
             }
             return TryCompensateLastCompletedChildActivity(info.TargetExecutionContext, info.TargetExecutionContext.Activity, statusChangeHandler, false);
         }
     }
     return false;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:83,代碼來源:CompensationUtils.cs

示例4: Load_Rules_RT

 internal static RuleDefinitions Load_Rules_RT(Activity declaringActivity)
 {
     RuleDefinitions rules = declaringActivity.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
     if (rules == null)
     {
         rules = ConditionHelper.GetRuleDefinitionsFromManifest(declaringActivity.GetType());
         if (rules != null)
             declaringActivity.SetValue(RuleDefinitions.RuleDefinitionsProperty, rules);
     }
     return rules;
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:11,代碼來源:Helpers.cs

示例5: CreateTransaction

 private void CreateTransaction(Activity atomicActivity)
 {
     TransactionalProperties properties = new TransactionalProperties();
     TransactionOptions options = new TransactionOptions();
     WorkflowTransactionOptions transactionOptions = TransactedContextFilter.GetTransactionOptions(atomicActivity);
     options.IsolationLevel = transactionOptions.IsolationLevel;
     if (options.IsolationLevel == IsolationLevel.Unspecified)
     {
         options.IsolationLevel = IsolationLevel.Serializable;
     }
     options.Timeout = transactionOptions.TimeoutDuration;
     CommittableTransaction transaction = new CommittableTransaction(options);
     properties.Transaction = transaction;
     WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, string.Concat(new object[] { "Workflow Runtime: WorkflowExecutor: instanceId: ", this.InstanceIdString, " .Created enlistable transaction ", transaction.GetHashCode(), " with timeout ", options.Timeout, ", isolation ", options.IsolationLevel }));
     properties.LocalQueuingService = new WorkflowQueuingService(this.qService);
     atomicActivity.SetValue(TransactionalPropertiesProperty, properties);
     this.currentAtomicActivity = atomicActivity;
     this.atomicActivityEvent = new ManualResetEvent(false);
     WorkflowTrace.Runtime.TraceEvent(TraceEventType.Information, 0, "Workflow Runtime: WorkflowExecutor: instanceId: " + this.InstanceIdString + " .Set CurrentAtomicActivity to " + atomicActivity.Name);
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:20,代碼來源:WorkflowExecutor.cs

示例6: SetWorkflowServiceAttributes

 public void SetWorkflowServiceAttributes(Activity activity, WorkflowServiceAttributes value)
 {
     activity.SetValue(ReceiveActivity.WorkflowServiceAttributesProperty, value);
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:4,代碼來源:WorkflowServiceAttributesPropertyProviderExtender.cs

示例7: ProcessDefTag

 internal static void ProcessDefTag(WorkflowMarkupSerializationManager serializationManager, XmlReader reader, Activity activity, bool newSegment, string fileName)
 {
     ResourceManager manager = new ResourceManager("System.Workflow.ComponentModel.StringResources", typeof(ActivityBind).Assembly);
     if (reader.NodeType == XmlNodeType.Attribute)
     {
         string str;
         if (((str = reader.LocalName) != null) && (str == "Class"))
         {
             activity.SetValue(WorkflowMarkupSerializer.XClassProperty, reader.Value);
         }
         else
         {
             serializationManager.ReportError(new WorkflowMarkupSerializationException(string.Format(CultureInfo.CurrentCulture, manager.GetString("UnknownDefinitionTag"), new object[] { "x", reader.LocalName, "http://schemas.microsoft.com/winfx/2006/xaml" }), (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LineNumber : 1, (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LinePosition : 1));
         }
     }
     else
     {
         bool flag = false;
         bool isEmptyElement = reader.IsEmptyElement;
         int depth = reader.Depth;
         do
         {
             switch (reader.NodeType)
             {
                 case XmlNodeType.Element:
                 {
                     string localName = reader.LocalName;
                     if (localName != null)
                     {
                         if (localName == "Code")
                         {
                             if (isEmptyElement)
                             {
                                 flag = true;
                             }
                             break;
                         }
                         bool flag1 = localName == "Constructor";
                     }
                     serializationManager.ReportError(new WorkflowMarkupSerializationException(string.Format(CultureInfo.CurrentCulture, manager.GetString("UnknownDefinitionTag"), new object[] { "x", reader.LocalName, "http://schemas.microsoft.com/winfx/2006/xaml" }), (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LineNumber : 1, (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LinePosition : 1));
                     return;
                 }
                 case XmlNodeType.Text:
                 case XmlNodeType.CDATA:
                 {
                     int num2 = (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LineNumber : 1;
                     int num3 = (reader is IXmlLineInfo) ? ((IXmlLineInfo) reader).LinePosition : 1;
                     CodeSnippetTypeMember member = new CodeSnippetTypeMember(reader.Value) {
                         LinePragma = new CodeLinePragma(fileName, Math.Max(num2 - 1, 1))
                     };
                     member.UserData[UserDataKeys.CodeSegment_New] = newSegment;
                     member.UserData[UserDataKeys.CodeSegment_ColumnNumber] = (num3 + reader.Name.Length) - 1;
                     CodeTypeMemberCollection members = activity.GetValue(WorkflowMarkupSerializer.XCodeProperty) as CodeTypeMemberCollection;
                     if (members == null)
                     {
                         members = new CodeTypeMemberCollection();
                         activity.SetValue(WorkflowMarkupSerializer.XCodeProperty, members);
                     }
                     members.Add(member);
                     break;
                 }
                 case XmlNodeType.EndElement:
                     if (reader.Depth == depth)
                     {
                         flag = true;
                     }
                     break;
             }
         }
         while (!flag && reader.Read());
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:72,代碼來源:WorkflowMarkupSerializationHelpers.cs

示例8: CheckpointInstanceState

        public void CheckpointInstanceState(Activity atomicActivity)
        {
            // Note that the WF4 runtime does not create checkpoints.  If the transaction aborts, the workflow aborts.  
            // We are following the WF4 behavior and not creating a checkpoint.

            TransactionOptions tranOpts = new TransactionOptions();
            WorkflowTransactionOptions atomicTxn = TransactedContextFilter.GetTransactionOptions(atomicActivity);

            tranOpts.IsolationLevel = atomicTxn.IsolationLevel;
            if (tranOpts.IsolationLevel == IsolationLevel.Unspecified)
            {
                tranOpts.IsolationLevel = IsolationLevel.Serializable;
            }

            tranOpts.Timeout = atomicTxn.TimeoutDuration;

            TransactionalProperties transactionProperties = new TransactionalProperties();
            atomicActivity.SetValue(WorkflowExecutor.TransactionalPropertiesProperty, transactionProperties);
            this.ServiceProvider.CreateTransaction(tranOpts);
            this.currentAtomicActivity = atomicActivity;
            this.scheduler.Pause();
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:22,代碼來源:InteropExecutor.cs

示例9: SerializeToMarkup

        private void SerializeToMarkup(Activity workflow, string fileName)
        {
            workflow.SetValue(WorkflowMarkupSerializer.XClassProperty, null);

            using (XmlWriter xmlWriter = XmlWriter.Create(fileName))
            {
                WorkflowMarkupSerializer markupSerializer = new WorkflowMarkupSerializer();
                markupSerializer.Serialize(xmlWriter, workflow);
            }

            RuleDefinitions ruleDefinitions = workflow.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
            if (ruleDefinitions != null)
            {
                if (ruleDefinitions.Conditions.Count > 0 || ruleDefinitions.RuleSets.Count > 0)
                {
                    String rulesFileName = GetRulesFileName(fileName);
                    using (XmlWriter xmlWriter = XmlWriter.Create(rulesFileName))
                    {
                        WorkflowMarkupSerializer markupSerializer = new WorkflowMarkupSerializer();
                        markupSerializer.Serialize(xmlWriter, ruleDefinitions);
                    }
                }
            }
        }
開發者ID:ssickles,項目名稱:archive,代碼行數:24,代碼來源:WorkflowLoader.cs

示例10: Load_Rules_RT

 internal static RuleDefinitions Load_Rules_RT(Activity declaringActivity)
 {
     RuleDefinitions ruleDefinitionsFromManifest = declaringActivity.GetValue(RuleDefinitions.RuleDefinitionsProperty) as RuleDefinitions;
     if (ruleDefinitionsFromManifest == null)
     {
         ruleDefinitionsFromManifest = GetRuleDefinitionsFromManifest(declaringActivity.GetType());
         if (ruleDefinitionsFromManifest != null)
         {
             declaringActivity.SetValue(RuleDefinitions.RuleDefinitionsProperty, ruleDefinitionsFromManifest);
         }
     }
     return ruleDefinitionsFromManifest;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:13,代碼來源:ConditionHelper.cs


注:本文中的System.Workflow.ComponentModel.Activity.SetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。