示例#1
0
        internal static void CreateAndInsertTrackingProfile()
        {
            TrackingProfile profile = new TrackingProfile();

            ActivityTrackPoint activityTrack = new ActivityTrackPoint();
            ActivityTrackingLocation activityLocation = new ActivityTrackingLocation(typeof(Activity));
            activityLocation.MatchDerivedTypes = true;
            IEnumerable<ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable<ActivityExecutionStatus>;
            foreach (ActivityExecutionStatus status in statuses)
            {
                activityLocation.ExecutionStatusEvents.Add(status);
            }

            activityTrack.MatchingLocations.Add(activityLocation);
            profile.ActivityTrackPoints.Add(activityTrack);
            profile.Version = version;

            WorkflowTrackPoint workflowTrack = new WorkflowTrackPoint();
            WorkflowTrackingLocation workflowLocation = new WorkflowTrackingLocation();
            IEnumerable<TrackingWorkflowEvent> eventStatuses = Enum.GetValues(typeof(TrackingWorkflowEvent)) as IEnumerable<TrackingWorkflowEvent>;
            foreach (TrackingWorkflowEvent status in eventStatuses)
            {
                workflowLocation.Events.Add(status);
            }

            workflowTrack.MatchingLocation = workflowLocation;
            profile.WorkflowTrackPoints.Add(workflowTrack);

            TrackingProfileSerializer serializer = new TrackingProfileSerializer();
            StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
            serializer.Serialize(writer, profile);
            String trackingprofile = writer.ToString();
            InsertTrackingProfile(trackingprofile);
        }
示例#2
0
        /// <summary>
        /// Creates and saves a default tracking profile
        /// </summary>
        /// <returns></returns>
        private TrackingProfile BuildDefaultProfile()
        {
            //return a default profile that tracks all possible
            //workflow events and activity status values
            TrackingProfile profile = new TrackingProfile();

            //
            //create a workflow track point and location
            //
            WorkflowTrackPoint workflowPoint
                = new WorkflowTrackPoint();
            //add all possible workflow events
            List <TrackingWorkflowEvent> workflowEvents
                = new List <TrackingWorkflowEvent>();

            workflowEvents.AddRange(
                Enum.GetValues(typeof(TrackingWorkflowEvent))
                as IEnumerable <TrackingWorkflowEvent>);
            WorkflowTrackingLocation workflowLocation
                = new WorkflowTrackingLocation(workflowEvents);

            workflowPoint.MatchingLocation = workflowLocation;
            profile.WorkflowTrackPoints.Add(workflowPoint);

            //
            //create an activity track point and location
            //
            ActivityTrackPoint activityPoint
                = new ActivityTrackPoint();
            //add all possible activity execution status values
            List <ActivityExecutionStatus> activityStatus
                = new List <ActivityExecutionStatus>();

            activityStatus.AddRange(
                Enum.GetValues(typeof(ActivityExecutionStatus))
                as IEnumerable <ActivityExecutionStatus>);
            ActivityTrackingLocation activityLocation
                = new ActivityTrackingLocation(
                      typeof(Activity), true, activityStatus);

            activityPoint.MatchingLocations.Add(activityLocation);
            profile.ActivityTrackPoints.Add(activityPoint);

            //
            //create a user track point and location
            //
            UserTrackPoint       userPoint = new UserTrackPoint();
            UserTrackingLocation userLocation
                = new UserTrackingLocation(
                      typeof(Object), typeof(Activity));

            userLocation.MatchDerivedActivityTypes = true;
            userLocation.MatchDerivedArgumentTypes = true;
            userPoint.MatchingLocations.Add(userLocation);
            profile.UserTrackPoints.Add(userPoint);

            //set the profile version
            profile.Version = new Version(1, 0, 0);
            return(profile);
        }
 private void RefreshWorkflowEvents()
 {
     if (profileManager.WorkflowTrackPoint != null)
     {
         WorkflowTrackingLocation wtl = profileManager.WorkflowTrackPoint.MatchingLocation;
         foreach (TrackingWorkflowEvent we in wtl.Events)
         {
             if (this.eventsDropDown.DropDownItems.ContainsKey(we.ToString()))
             {
                 ((ToolStripButton)this.eventsDropDown.DropDownItems[we.ToString()]).Checked = true;
             }
         }
     }
 }
        // Profile creation
        private static TrackingProfile GetProfile()
        {
            // Create a Tracking Profile
            TrackingProfile profile = new TrackingProfile();

            profile.Version = new Version("3.0.0");

            // Add a TrackPoint to cover all activity status events
            ActivityTrackPoint       activityTrackPoint = new ActivityTrackPoint();
            ActivityTrackingLocation activityLocation   = new ActivityTrackingLocation(typeof(Activity));

            activityLocation.MatchDerivedTypes = true;
            WorkflowTrackingLocation wLocation = new WorkflowTrackingLocation();

            IEnumerable <ActivityExecutionStatus> statuses = Enum.GetValues(typeof(ActivityExecutionStatus)) as IEnumerable <ActivityExecutionStatus>;

            foreach (ActivityExecutionStatus status in statuses)
            {
                activityLocation.ExecutionStatusEvents.Add(status);
            }

            activityTrackPoint.MatchingLocations.Add(activityLocation);
            profile.ActivityTrackPoints.Add(activityTrackPoint);

            // Add a TrackPoint to cover all workflow status events
            WorkflowTrackPoint workflowTrackPoint = new WorkflowTrackPoint();

            workflowTrackPoint.MatchingLocation = new WorkflowTrackingLocation();
            foreach (TrackingWorkflowEvent workflowEvent in Enum.GetValues(typeof(TrackingWorkflowEvent)))
            {
                workflowTrackPoint.MatchingLocation.Events.Add(workflowEvent);
            }
            profile.WorkflowTrackPoints.Add(workflowTrackPoint);

            // Add a TrackPoint to cover all user track points
            UserTrackPoint       userTrackPoint = new UserTrackPoint();
            UserTrackingLocation userLocation   = new UserTrackingLocation();

            userLocation.ActivityType = typeof(Activity);
            userLocation.MatchDerivedActivityTypes = true;
            userLocation.ArgumentType = typeof(object);
            userLocation.MatchDerivedArgumentTypes = true;
            userTrackPoint.MatchingLocations.Add(userLocation);
            profile.UserTrackPoints.Add(userTrackPoint);

            return(profile);
        }