コード例 #1
0
        private void createOrUpdateCredentialAsset(string credentialAssetName, AutomationCredential credToEdit)
        {
            var dialog = new NewOrEditCredentialDialog(credToEdit);

            if (dialog.ShowDialog() == true)
            {
                var assetsToSave = new List <AutomationAsset>();

                var newCred = new AutomationCredential(credentialAssetName, dialog.username, dialog.password);
                assetsToSave.Add(newCred);

                AutomationAssetManager.SaveLocally(iseClient.currWorkspace, assetsToSave, getEncryptionCertificateThumbprint());
                refreshAssets();
            }
        }
        public NewOrEditCredentialDialog(AutomationCredential cred)
        {
            InitializeComponent();

            if (cred != null)
            {
                UsernameTextbox.Text     = cred.getUsername();
                PasswordTextbox.Password = cred.getPassword();

                this.Title = "Edit Credential Asset";
            }
            else
            {
                this.Title = "New Credential Asset";
            }
        }