/// <summary>
        /// The on state machine state.
        /// </summary>
        /// <param name="smr">
        /// The smr.
        /// </param>
        private void OnStateMachineState(StateMachineStateRecord smr)
        {
            lock (this.stateActions)
            {
                List<Action<StateMachineStateRecord>> actions;

                if (this.stateActions.TryGetValue(smr.StateName, out actions))
                {
                    foreach (var action in actions)
                    {
                        action(smr);
                    }
                }
            }
        }
 private StateMachineStateRecord(StateMachineStateRecord record) : base(record)
 {
 }
 private StateMachineStateRecord(StateMachineStateRecord record)
     : base(record)
 {
 }
示例#4
0
 /// <summary>
 /// The get key.
 /// </summary>
 /// <param name="record">
 /// The record. 
 /// </param>
 /// <returns>
 /// The System.String. 
 /// </returns>
 private string GetKey(StateMachineStateRecord record)
 {
     return record.InstanceId + record.StateMachineName;
 }
示例#5
0
 /// <summary>
 /// Adds or Updates a state machine
 /// </summary>
 /// <param name="record">
 /// The tracking record 
 /// </param>
 /// <remarks>
 /// In cases where the workflow is loaded, the StateMachineStateRecord may be the first tracking record
 /// </remarks>
 private void AddOrUpdateStateMachine(StateMachineStateRecord record)
 {
     var history = this.maxHistory;
     this.currentStateMachine = this.stateMachines.AddOrUpdate(
         GetKey(record),
         s =>
             {
                 var info = new StateMachineInfo(history)
                     {
                         Name = record.Activity.Name,
                         InstanceState = ActivityInstanceState.Executing,
                         InstanceId = record.InstanceId
                     };
                 info.UpdateState(record);
                 return info;
             },
         (s, info) =>
             {
                 info.InstanceState = ActivityInstanceState.Executing;
                 info.UpdateState(record);
                 return info;
             });
 }
示例#6
0
 /// <summary>
 /// The track.
 /// </summary>
 /// <param name="record">
 /// The record. 
 /// </param>
 /// <param name="timeout">
 /// The timeout. 
 /// </param>
 protected override void Track(StateMachineStateRecord record, TimeSpan timeout)
 {
     this.AddOrUpdateStateMachine(record);
 }
 /// <summary>
 /// Update the state from a state machine record
 /// </summary>
 /// <param name="record">
 /// The record 
 /// </param>
 public void UpdateState(StateMachineStateRecord record)
 {
     this.CurrentState = record.StateName;
     this.possibleTransitions =
         record.GetTransitions().Select(
             transition =>
             string.IsNullOrWhiteSpace(transition.DisplayName)
                 ? transition.GetType().Name
                 : transition.DisplayName).ToList();
 }
 /// <summary>
 /// When implemented in a derived class, used to synchronously process the tracking record.
 /// </summary>
 /// <param name="record">
 /// The generated tracking record. 
 /// </param>
 /// <param name="timeout">
 /// The time period after which the provider aborts the attempt. 
 /// </param>
 protected virtual void Track(StateMachineStateRecord record, TimeSpan timeout)
 {
     // Do nothing
 }