예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        protected override void ProcessRecord()
        {
            HealthClientApplication clientApp = HvShellUtilities.GetClient();

            if (clientApp.GetApplicationInfo() != null)
            {
                List <PersonInfo> authorizedPeople =
                    new List <PersonInfo>(clientApp.ApplicationConnection.GetAuthorizedPeople());
                WriteObject(authorizedPeople);
            }
        }