Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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();
        }