Beispiel #1
0
        public override async Task Initialize(NavigationParams navParams)
        {
            _connection = navParams.Connection as IHealthVaultConnection;
            Context     = navParams.Context as ActionPlanInstanceV2;

            OnPropertyChanged("Context");
        }
        public ActionPlanDetailsViewModel(ActionPlanInstanceV2 actionPlanInstance, IHealthVaultSodaConnection connection, INavigationService navigationService)
            : base(navigationService)
        {
            _connection         = connection;
            ItemSelectedCommand = new Command <ActionPlanTaskInstanceV2>(async o => await HandleTaskSelectedAsync(o));

            Plan = actionPlanInstance;
        }
 private async Task GoToActionPlanDetailsPageAsync(ActionPlanInstanceV2 actionPlan)
 {
     var actionPlanDetailsPage = new ActionPlanDetailsPage
     {
         BindingContext = new ActionPlanDetailsViewModel(actionPlan, _connection, NavigationService),
     };
     await NavigationService.NavigateAsync(actionPlanDetailsPage);
 }
        public async Task SimpleActionPlans()
        {
            IHealthVaultSodaConnection connection = HealthVaultConnectionFactory.Current.GetOrCreateSodaConnection(Constants.Configuration);
            PersonInfo personInfo = await connection.GetPersonInfoAsync();

            HealthRecordInfo record = personInfo.SelectedRecord;

            var restClient = connection.CreateMicrosoftHealthVaultRestApi(record.Id);

            await RemoveAllActionPlansAsync(restClient);

            Guid objectiveId = Guid.NewGuid();
            await restClient.ActionPlans.CreateAsync(CreateWeightActionPlan(objectiveId));

            ActionPlansResponseActionPlanInstanceV2 plans = await restClient.ActionPlans.GetAsync();

            Assert.AreEqual(1, plans.Plans.Count);

            ActionPlanInstanceV2 planInstance = plans.Plans[0];

            Assert.AreEqual(objectiveId.ToString(), planInstance.Objectives[0].Id);
            Assert.AreEqual(ObjectiveName, planInstance.Objectives[0].Name);
            Assert.AreEqual(PlanName, planInstance.Name);
        }
 /// <summary>
 /// Update/Replace a complete action plan instance with no merge.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='actionPlan'>
 /// The instance of the plan to update. The entire plan will be replaced with
 /// this version.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ActionPlansResponseActionPlanInstanceV2> ReplaceAsync(this IActionPlans operations, ActionPlanInstanceV2 actionPlan, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
 {
     using (var _result = await operations.ReplaceWithHttpMessagesAsync(actionPlan, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
 /// <summary>
 /// Update/Replace a complete action plan instance with no merge.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='actionPlan'>
 /// The instance of the plan to update. The entire plan will be replaced with
 /// this version.
 /// </param>
 public static ActionPlansResponseActionPlanInstanceV2 Replace(this IActionPlans operations, ActionPlanInstanceV2 actionPlan)
 {
     return(operations.ReplaceAsync(actionPlan).GetAwaiter().GetResult());
 }
        public async Task <ActionResult> Plan(Guid id, ActionPlanInstanceV2 plan, Guid personId, Guid recordId)
        {
            await ExecuteMicrosoftHealthVaultRestApiAsync(api => api.ActionPlans.UpdateAsync(plan), personId, recordId);

            return(RedirectToAction("Plan", new { id, personId, recordId }));
        }