示例#1
0
        //Query the database via the databaseService and update the activities ListView and activityStatusList
        // based on the currently selected workflow instance
        private void UpdateActivities()
        {
            if (listViewWorkflows.SelectedItems.Count == 0)
            {
                listViewActivities.Items.Clear();
                activityStatusListValue.Clear();
                return;
            }

            ListViewItem currentWorkflow = listViewWorkflows.SelectedItems[0];

            if (currentWorkflow != null)
            {
                Guid workflowInstanceId = workflowStatusList[(currentWorkflow.SubItems[0]).Text].InstanceId;

                SqlTrackingWorkflowInstance sqlTrackingWorkflowInstance = null;
                if (true == monitorDatabaseServiceValue.TryGetWorkflow(workflowInstanceId, out sqlTrackingWorkflowInstance))
                {
                    listViewActivities.Items.Clear();
                    activityStatusListValue.Clear();

                    //ActivityEvents list received contain all events for activities in orders in event order
                    //Walking down-up on the ActivityEvents list and keeping the last entry

                    for (int index = sqlTrackingWorkflowInstance.ActivityEvents.Count; index >= 1; index--)
                    {
                        ActivityTrackingRecord activityTrackingRecord = sqlTrackingWorkflowInstance.ActivityEvents[index - 1];
                        if (!activityStatusListValue.ContainsKey(activityTrackingRecord.QualifiedName))
                        {
                            ActivityStatusInfo latestActivityStatus = new ActivityStatusInfo(activityTrackingRecord.QualifiedName, activityTrackingRecord.ExecutionStatus.ToString());
                            activityStatusListValue.Add(activityTrackingRecord.QualifiedName, latestActivityStatus);

                            string[] activitiesListViewItems = new string[] {
                                activityTrackingRecord.EventOrder.ToString(),
                                     activityTrackingRecord.QualifiedName,
                                     activityTrackingRecord.ExecutionStatus.ToString()
                            };
                            ListViewItem li = new ListViewItem(activitiesListViewItems, -1);
                            listViewActivities.Items.Add(li);
                        }
                    }
                    workflowViewHost.Refresh();
                }
            }
        }
示例#2
0
        //Query the database via the databaseService and update the activities ListView and activityStatusList
        // based on the currently selected workflow instance
        private void UpdateActivities()
        {
            if (listViewWorkflows.SelectedItems.Count == 0)
            {
                listViewActivities.Items.Clear();
                activityStatusListValue.Clear();
                return;
            }

            ListViewItem currentWorkflow = listViewWorkflows.SelectedItems[0];
            if (currentWorkflow != null)
            {
                Guid workflowInstanceId = workflowStatusList[(currentWorkflow.SubItems[0]).Text].InstanceId;

                SqlTrackingWorkflowInstance sqlTrackingWorkflowInstance = null;
                if (true == monitorDatabaseServiceValue.TryGetWorkflow(workflowInstanceId, out sqlTrackingWorkflowInstance))
                {
                    listViewActivities.Items.Clear();
                    activityStatusListValue.Clear();

                    //ActivityEvents list received contain all events for activities in orders in event order
                    //Walking down-up on the ActivityEvents list and keeping the last entry

                    for (int index = sqlTrackingWorkflowInstance.ActivityEvents.Count; index >= 1; index--)
                    {
                        ActivityTrackingRecord activityTrackingRecord = sqlTrackingWorkflowInstance.ActivityEvents[index - 1];
                        if (!activityStatusListValue.ContainsKey(activityTrackingRecord.QualifiedName))
                        {
                            ActivityStatusInfo latestActivityStatus = new ActivityStatusInfo(activityTrackingRecord.QualifiedName, activityTrackingRecord.ExecutionStatus.ToString());
                            activityStatusListValue.Add(activityTrackingRecord.QualifiedName, latestActivityStatus);

                            string[] activitiesListViewItems = new string[] {
                        activityTrackingRecord.EventOrder.ToString(),
                        activityTrackingRecord.QualifiedName, 
                        activityTrackingRecord.ExecutionStatus.ToString()};
                            ListViewItem li = new ListViewItem(activitiesListViewItems, -1);
                            listViewActivities.Items.Add(li);
                        }
                    }
                    workflowViewHost.Refresh();
                }
            }
        }