Ejemplo n.º 1
0
        private bool HandleUnauthenticatedDeployAppx(string outputAppx, string outputCer, ReadOnlyCollection <FileStreamInfo> dependencies, string dependencyFolder, string identityName)
        {
            var deployResult = DeployAppx(outputAppx, outputCer, dependencies, dependencyFolder, identityName);

            if (deployResult == HttpStatusCode.Unauthorized)
            {
                OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_UnauthorizedDeployment, credentials.UserName, credentials.Password));

                CustomCredentialsForm customCredentialsForm = new CustomCredentialsForm(credentials.UserName, credentials.Password);
                var result = customCredentialsForm.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    credentials.UserName = customCredentialsForm.Username;
                    credentials.Password = customCredentialsForm.Password;
                }
                else
                {
                    return(false);
                }

                deployResult = DeployAppx(outputAppx, outputCer, dependencies, dependencyFolder, identityName);
                if (deployResult == HttpStatusCode.Unauthorized)
                {
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_UnauthorizedDeployment, credentials.UserName, credentials.Password));
                }
            }

            return(deployResult == HttpStatusCode.OK || deployResult == HttpStatusCode.Accepted);
        }
Ejemplo n.º 2
0
        private bool HandleUnauthenticatedDeployAppx(string outputAppx, string outputCer, ReadOnlyCollection<FileStreamInfo> dependencies, string dependencyFolder, string identityName)
        {
            var deployResult = DeployAppx(outputAppx, outputCer, dependencies, dependencyFolder, identityName);
            if (deployResult == HttpStatusCode.Unauthorized)
            {
                OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_UnauthorizedDeployment, credentials.UserName, credentials.Password));

                CustomCredentialsForm customCredentialsForm = new CustomCredentialsForm(credentials.UserName, credentials.Password);
                var result = customCredentialsForm.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    credentials.UserName = customCredentialsForm.Username;
                    credentials.Password = customCredentialsForm.Password;
                }
                else
                {
                    return false;
                }

                deployResult = DeployAppx(outputAppx, outputCer, dependencies, dependencyFolder, identityName);
                if (deployResult == HttpStatusCode.Unauthorized)
                {
                    OutputMessage(string.Format(CultureInfo.InvariantCulture, Resource.DeploymentWorker_UnauthorizedDeployment, credentials.UserName, credentials.Password));
                }
            }

            return deployResult == HttpStatusCode.OK || deployResult == HttpStatusCode.Accepted;
        }