Hi,
I have a windows workflow state machine that was working okay. To inform the user of their possible options when working with the workflow I call StateMachineWorkflowInstance.PossibleStateTransistions which would return all the possible transitions. I then added a StateInitializationActivity to each of the states. Now when I call StateMachineWorkflowInstance.PossibleStateTransistions only some of the transitions are returned.
Any ideas on what might cause this behavior?
Edit: It is not just that I added a StateInitializationActivity, but within the StateInitializationActivity I have a custom Activity to initialize the state. If I change this custom activity to a codeActivity and do the initialization there, then .PossibleStateTranisitions works correctly. This is what my custom activity looks like
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Workflow.ComponentModel;
using GroupBookingCommon;
namespace GroupBookingWorkflows
{
public class InitializeGroupBookingActivity: Activity
{
public static DependencyProperty GroupBookingProperty = System.Workflow.ComponentModel.DependencyProperty.Register("GroupBooking", typeof(GroupBooking), typeof(InitializeGroupBookingActivity));
public GroupBooking GroupBooking
{
get { return ((GroupBooking)(base.GetValue(InitializeGroupBookingActivity.GroupBookingProperty))); }
set { base.SetValue(InitializeGroupBookingActivity.GroupBookingProperty, value); }
}
public static DependencyProperty TimeUntilDueProperty = System.Workflow.ComponentModel.DependencyProperty.Register("TimeUntilDue", typeof(TimeSpan), typeof(InitializeGroupBookingActivity));
public TimeSpan TimeUntilDue
{
get { return ((TimeSpan)(base.GetValue(InitializeGroupBookingActivity.TimeUntilDueProperty))); }
set { base.SetValue(InitializeGroupBookingActivity.TimeUntilDueProperty, value); }
}
public static DependencyProperty DueDateMeasuredFromProperty = DependencyProperty.Register("DueDateMeasuredFrom", typeof(String), typeof(InitializeGroupBookingActivity));
public String DueDateMeasuredFrom
{
get { return ((String)(base.GetValue(InitializeGroupBookingActivity.DueDateMeasuredFromProperty)));}
set { base.SetValue(InitializeGroupBookingActivity.DueDateMeasuredFromProperty, value); }
}
protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext)
{
if (GroupBooking != null)
{
if (TimeUntilDue.TotalDays != 0)
{
if (DueDateMeasuredFrom == "BookingDate")
GroupBooking.NextDueDate = GroupBooking.BookingDate.Add(TimeUntilDue);
else
GroupBooking.NextDueDate = (GroupBooking.Departure.Add(TimeUntilDue) > DateTime.Now.Date) ? GroupBooking.Departure.Add(TimeUntilDue) : DateTime.Now;
}
IGroupBookingTransactionService txnService = executionContext.GetService<IGroupBookingTransactionService>();
txnService.UpdateGroupBooking(GroupBooking);
}
return ActivityExecutionStatus.Executing;
}
}
}