Ejemplo n.º 1
0
        /// <summary>
        /// Creates a sample frequency based task associated with the specified objective.
        /// </summary>
        public static ActionPlanTaskV2 CreateDailyWeightMeasurementActionPlanTask(string objectiveId, Guid planId = default(Guid))
        {
            var task = new ActionPlanTaskV2
            {
                Name                   = "Measure your weight",
                ShortDescription       = "Measure your weight daily",
                LongDescription        = "Measure your weight daily",
                ImageUrl               = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW680a?ver=b227",
                ThumbnailImageUrl      = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RW6fN6?ver=6479",
                TaskType               = ActionPlanTaskType.Other.ToString(),
                SignupName             = "Measure your weight",
                AssociatedObjectiveIds = new Collection <string> {
                    objectiveId
                },
                AssociatedPlanId = planId.ToString(), // Only needs to be set if adding as task after the plan
                TrackingPolicy   = new ActionPlanTrackingPolicy
                {
                    IsAutoTrackable   = true,
                    OccurrenceMetrics = new ActionPlanTaskOccurrenceMetrics
                    {
                        EvaluateTargets = false
                    },
                    TargetEvents = new Collection <ActionPlanTaskTargetEvent>
                    {
                        new ActionPlanTaskTargetEvent
                        {
                            ElementXPath = "thing/data-xml/weight",
                        }
                    }
                },
                CompletionType = ActionPlanTaskCompletionType.Frequency.ToString(),
                Schedules      = new List <ScheduleV2>
                {
                    new ScheduleV2
                    {
                        ReminderState = ActionPlanReminderState.Off.ToString(),
                        ScheduledDays = new Collection <string> {
                            ActionPlanScheduleDay.Everyday.ToString()
                        }
                    }
                },
                FrequencyTaskCompletionMetrics = new ActionPlanFrequencyTaskCompletionMetricsV2()
                {
                    OccurrenceCount = 1,
                    WindowType      = ActionPlanScheduleRecurrenceType.Daily.ToString()
                }
            };

            return(task);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Creates a sample frequency based task associated with the specified objective.
        /// </summary>
        public static ActionPlanTaskV2 CreateSleepFrequencyActionPlanTask(string objectiveId, Guid planId = default(Guid))
        {
            var task = new ActionPlanTaskV2
            {
                Name                   = "Measure your blood pressure",
                ShortDescription       = "Measure your blood pressure - the goal is to have your systolic between 80-120 and diastolic between 60-80 mmHg",
                LongDescription        = "Measure your blood pressure - the goal is to have your systolic between 80-120 and diastolic between 60-80 mmHg",
                ImageUrl               = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1rXx2?ver=d68e",
                ThumbnailImageUrl      = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1s2KS?ver=0ad8",
                TaskType               = ActionPlanTaskType.BloodPressure.ToString(),
                SignupName             = "Measure your blood pressure",
                AssociatedObjectiveIds = new Collection <string> {
                    objectiveId
                },
                AssociatedPlanId = planId.ToString(), // Only needs to be set if adding as task after the plan
                TrackingPolicy   = new ActionPlanTrackingPolicy
                {
                    IsAutoTrackable   = true,
                    OccurrenceMetrics = new ActionPlanTaskOccurrenceMetrics
                    {
                        EvaluateTargets = false
                    },
                    TargetEvents = new Collection <ActionPlanTaskTargetEvent>
                    {
                        new ActionPlanTaskTargetEvent
                        {
                            ElementXPath = "thing/data-xml/blood-pressure"
                        }
                    }
                },
                CompletionType = ActionPlanTaskCompletionType.Frequency.ToString(),
                Schedules      = new List <ScheduleV2>
                {
                    new ScheduleV2
                    {
                        ReminderState = ActionPlanReminderState.Off.ToString(),
                        ScheduledDays = new Collection <string> {
                            ActionPlanScheduleDay.Everyday.ToString()
                        }
                    }
                },
                FrequencyTaskCompletionMetrics = new ActionPlanFrequencyTaskCompletionMetricsV2()
                {
                    OccurrenceCount = 1,
                    WindowType      = ActionPlanScheduleRecurrenceType.Daily.ToString()
                }
            };

            return(task);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a sample schedule based task associated with the specified objective.
        /// </summary>
        public static ActionPlanTaskV2 CreateSleepScheduledActionPlanTask(string objectiveId, Guid planId = default(Guid))
        {
            var task = new ActionPlanTaskV2
            {
                Name                   = "Time to wake up",
                ShortDescription       = "Set a consistent wake time to help regulate your body's internal clock.",
                LongDescription        = "Studies show that waking up at a consistent time every day, even on weekends, is one of the best ways to ensure a good night's sleep.",
                ImageUrl               = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1rXx2?ver=d68e",
                ThumbnailImageUrl      = "https://img-prod-cms-rt-microsoft-com.akamaized.net/cms/api/am/imageFileData/RE1s2KS?ver=0ad8",
                TaskType               = ActionPlanTaskType.Other.ToString(),
                SignupName             = "Set a consistent wake time",
                AssociatedObjectiveIds = new Collection <string> {
                    objectiveId.ToString()
                },
                AssociatedPlanId = planId.ToString(), // Only needs to be set if adding as task after the plan
                TrackingPolicy   = new ActionPlanTrackingPolicy
                {
                    IsAutoTrackable = false
                },
                CompletionType = ActionPlanTaskCompletionType.Scheduled.ToString(),
                Schedules      = new List <ScheduleV2>
                {
                    new ScheduleV2
                    {
                        ReminderState = ActionPlanReminderState.Off.ToString(),
                        ScheduledDays = new Collection <string> {
                            ActionPlanScheduleDay.Everyday.ToString()
                        },
                        ScheduledTime = new Time()
                        {
                            Hours   = 6,
                            Minutes = 30
                        }
                    }
                }
            };

            return(task);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Post a new action plan task
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='actionPlanTask'>
 /// </param>
 public static object Create(this IActionPlanTasks operations, ActionPlanTaskV2 actionPlanTask)
 {
     return(operations.CreateAsync(actionPlanTask).GetAwaiter().GetResult());
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Post a new action plan task
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='actionPlanTask'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <object> CreateAsync(this IActionPlanTasks operations, ActionPlanTaskV2 actionPlanTask, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(actionPlanTask, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }