internal void ReloadProfiles(WorkflowExecutor exec, Guid instanceId, ref TrackingListenerBroker broker, ref List<TrackingChannelWrapper> channels)
 {
     Type workflowType = exec.WorkflowDefinition.GetType();
     foreach (TrackingService service in this._services)
     {
         TrackingProfile profile = null;
         TrackingChannelWrapper wrapper = null;
         if (service.TryReloadProfile(workflowType, instanceId, out profile))
         {
             bool flag = false;
             int index = 0;
             while (index < channels.Count)
             {
                 if (service.GetType() == channels[index].TrackingServiceType)
                 {
                     wrapper = channels[index];
                     flag = true;
                     break;
                 }
                 index++;
             }
             if (profile == null)
             {
                 if (flag)
                 {
                     broker.RemoveService(wrapper.TrackingServiceType);
                     channels.RemoveAt(index);
                 }
             }
             else
             {
                 RTTrackingProfile profile2 = new RTTrackingProfile(profile, exec.WorkflowDefinition, workflowType) {
                     IsPrivate = true
                 };
                 if (!flag)
                 {
                     List<string> callPath = null;
                     Guid empty = Guid.Empty;
                     TrackingCallingState trackingCallingState = exec.TrackingCallingState;
                     IList<string> collection = null;
                     Guid context = this.GetContext(exec.RootActivity);
                     Guid callerContextGuid = Guid.Empty;
                     Guid callerParentContextGuid = Guid.Empty;
                     if (trackingCallingState != null)
                     {
                         collection = trackingCallingState.CallerActivityPathProxy;
                         if ((collection != null) && (collection.Count > 0))
                         {
                             callPath = new List<string>(collection);
                             empty = trackingCallingState.CallerWorkflowInstanceId;
                             callerContextGuid = trackingCallingState.CallerContextGuid;
                             callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
                         }
                     }
                     TrackingParameters parameters = new TrackingParameters(instanceId, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);
                     TrackingChannelWrapper item = new TrackingChannelWrapper(service.GetTrackingChannel(parameters), service.GetType(), workflowType, profile2);
                     channels.Add(item);
                     Type type = service.GetType();
                     broker.AddService(type, profile2.Version);
                     broker.MakeProfileInstance(type);
                 }
                 else
                 {
                     wrapper.SetTrackingProfile(profile2);
                     broker.MakeProfileInstance(wrapper.TrackingServiceType);
                 }
             }
         }
     }
 }
コード例 #2
0
        internal void ReloadProfiles(WorkflowExecutor exec, Guid instanceId, ref TrackingListenerBroker broker, ref List <TrackingChannelWrapper> channels)
        {
            Type workflowType = exec.WorkflowDefinition.GetType();

            foreach (TrackingService service in this._services)
            {
                TrackingProfile        profile = null;
                TrackingChannelWrapper wrapper = null;
                if (service.TryReloadProfile(workflowType, instanceId, out profile))
                {
                    bool flag  = false;
                    int  index = 0;
                    while (index < channels.Count)
                    {
                        if (service.GetType() == channels[index].TrackingServiceType)
                        {
                            wrapper = channels[index];
                            flag    = true;
                            break;
                        }
                        index++;
                    }
                    if (profile == null)
                    {
                        if (flag)
                        {
                            broker.RemoveService(wrapper.TrackingServiceType);
                            channels.RemoveAt(index);
                        }
                    }
                    else
                    {
                        RTTrackingProfile profile2 = new RTTrackingProfile(profile, exec.WorkflowDefinition, workflowType)
                        {
                            IsPrivate = true
                        };
                        if (!flag)
                        {
                            List <string>        callPath                = null;
                            Guid                 empty                   = Guid.Empty;
                            TrackingCallingState trackingCallingState    = exec.TrackingCallingState;
                            IList <string>       collection              = null;
                            Guid                 context                 = this.GetContext(exec.RootActivity);
                            Guid                 callerContextGuid       = Guid.Empty;
                            Guid                 callerParentContextGuid = Guid.Empty;
                            if (trackingCallingState != null)
                            {
                                collection = trackingCallingState.CallerActivityPathProxy;
                                if ((collection != null) && (collection.Count > 0))
                                {
                                    callPath                = new List <string>(collection);
                                    empty                   = trackingCallingState.CallerWorkflowInstanceId;
                                    callerContextGuid       = trackingCallingState.CallerContextGuid;
                                    callerParentContextGuid = trackingCallingState.CallerParentContextGuid;
                                }
                            }
                            TrackingParameters     parameters = new TrackingParameters(instanceId, workflowType, exec.WorkflowDefinition, callPath, empty, context, callerContextGuid, callerParentContextGuid);
                            TrackingChannelWrapper item       = new TrackingChannelWrapper(service.GetTrackingChannel(parameters), service.GetType(), workflowType, profile2);
                            channels.Add(item);
                            Type type = service.GetType();
                            broker.AddService(type, profile2.Version);
                            broker.MakeProfileInstance(type);
                        }
                        else
                        {
                            wrapper.SetTrackingProfile(profile2);
                            broker.MakeProfileInstance(wrapper.TrackingServiceType);
                        }
                    }
                }
            }
        }