public void Initialize(TP2007ServerBasedDialogSerializationHelper helper)
        {
            if (helper.Servers == null)
            {
                return;
            }

            List <Trados2007ServerAccount> accounts = new List <Trados2007ServerAccount>(helper.Servers.Length);

            foreach (var serverString in helper.Servers)
            {
                Uri serverUri;
                try
                {
                    serverUri = new Uri(string.Format("{0}://{1}", "http", serverString));
                }
                catch (UriFormatException)
                {
                    continue;
                }

                TranslationProviderCredential credential = this.CredentialStore.GetCredential(serverUri);

                string username;
                string password;
                if (CredentialsUtility.TryParse(credential, out username, out password))
                {
                    Trados2007ServerAccount account = new Trados2007ServerAccount(serverString, username, password);
                    accounts.Add(account);
                }
            }

            this.Servers = accounts;
        }
Esempio n. 2
0
        private void UpdateCredentials(Trados2007ServerAccount account)
        {
            var credentials =
                CredentialsUtility.CreateTranslationProviderCredential(account.Login, account.Password);

            this.credentialStore.AddCredential(account.ConnectionPointUri, credentials);
        }