protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HealthClientApplication.Create(
                Guid.NewGuid(), HVPowerShellGuid, HVShell, HVPlatform);

            // Verify the application instance.
            //   Create a new instance if necessary.

            if (clientApp.GetApplicationInfo() == null)
            {
                // Create a new client instance.
                clientApp.StartApplicationCreationProcess();

                // A new client instance always requests authorization from the
                //   current user using the default browser.

                // Wait for the user to return from the shell.
                if (ShouldContinue("Is Auth done - (Y)?", "Is auth done?",
                                   ref _yesToAll, ref _noToAll))
                {
                    // Store the SODA client details
                    StringBuilder data = new StringBuilder();
                    data.Append(clientApp.ApplicationId.ToString());
                    using (StreamWriter sw = new StreamWriter(HvShellUtilities.GetClientAppAuthFileNameFullPath()))
                    {
                        sw.Write((data));
                    }
                    List <PersonInfo> authorizedPeople =
                        new List <PersonInfo>(clientApp.ApplicationConnection.GetAuthorizedPeople());
                    WriteObject(authorizedPeople);
                }
            }
        }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HvShellUtilities.GetClient();
            ServiceInfo             s         = clientApp.ApplicationConnection.GetServiceDefinition();

            WriteObject(s);
        }
    public static HealthClientApplication GetClient()
    {
        HealthClientApplication clientApp = HealthClientApplication.Create(
            HvShellUtilities.GetClientId(), _HVPowerShellGuid, _HVShell, _HVPlatform);

        return(clientApp);
    }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HvShellUtilities.GetClient();

            List <PersonInfo> authorizedPeople = new List <PersonInfo>(clientApp.ApplicationConnection.GetAuthorizedPeople());

            // Create an authorized connection for each person on the
            //   list.
            HealthClientAuthorizedConnection authConnection = clientApp.CreateAuthorizedConnection(
                authorizedPeople[0].PersonId);

            // Use the authorized connection to read the user's default
            //   health record.
            HealthRecordAccessor access = new HealthRecordAccessor(
                authConnection, authConnection.GetPersonInfo().GetSelfRecord().Id);

            // Search the health record for basic demographic
            //   information.
            //   Most user records contain an item of this type.
            HealthRecordSearcher search = access.CreateSearcher();
            HealthRecordFilter   filter = new HealthRecordFilter(
                HvShellUtilities.NameToTypeId(Type));

            search.Filters.Add(filter);

            foreach (Object o in search.GetMatchingItems()[0])
            {
                WriteObject(o);
            }
        }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HvShellUtilities.GetClient();

            if (clientApp.GetApplicationInfo() != null)
            {
                List <PersonInfo> authorizedPeople =
                    new List <PersonInfo>(clientApp.ApplicationConnection.GetAuthorizedPeople());
                WriteObject(authorizedPeople);
            }
        }
 protected override void ProcessRecord()
 {
     if (string.IsNullOrEmpty(ThingType))
     {
         HealthClientApplication clientApp = HvShellUtilities.GetClient();
         WriteObject(clientApp.ApplicationConnection.GetVocabulary("thing-types"));
     }
     else
     {
         WriteObject(
             ItemTypeManager.GetHealthRecordItemTypeDefinition(
                 new Guid(ThingType), HvShellUtilities.GetClient().ApplicationConnection)
             );
     }
 }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp        = HvShellUtilities.GetClient();
            List <PersonInfo>       authorizedPeople = new List <PersonInfo>
                                                           (clientApp.ApplicationConnection.GetAuthorizedPeople());
            // Create an authorized connection for each person on the
            //   list.
            HealthClientAuthorizedConnection authConnection = clientApp.CreateAuthorizedConnection(
                authorizedPeople[0].PersonId);

            // Use the authorized connection to read the user's default
            //   health record.
            HealthRecordAccessor access = new HealthRecordAccessor(
                authConnection, authConnection.GetPersonInfo().GetSelfRecord().Id);

            Weight weight = new Weight();

            weight.Value = new WeightValue(Value / 2.2,
                                           new DisplayValue(Value, "pounds"));

            access.NewItem(weight);
        }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp        = HvShellUtilities.GetClient();
            List <PersonInfo>       authorizedPeople = new List <PersonInfo>
                                                           (clientApp.ApplicationConnection.GetAuthorizedPeople());

            // Create an authorized connection for each person on the
            //   list.
            HealthClientAuthorizedConnection authConnection = clientApp.CreateAuthorizedConnection(
                authorizedPeople[0].PersonId);

            // Use the authorized connection to read the user's default
            //   health record.
            HealthRecordAccessor accessor = new HealthRecordAccessor(
                authConnection, authConnection.GetPersonInfo().GetSelfRecord().Id);

            HealthServiceRequest request =
                new HealthServiceRequest(accessor.Connection, "PutThings", 2, accessor);

            // Read the input file
            request.Parameters = System.IO.File.ReadAllText(Path.GetFullPath(FileName));
            request.Execute();
        }
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HvShellUtilities.GetClient();

            WriteObject(clientApp.ApplicationConnection.GetVocabularyKeys());
        }