Exemple #1
0
        public string Translate()
        {
            TokenAccess.AdmAccessToken admToken;
            string headerValue;

            TokenAccess.AdmAuthentication admAuth = new TokenAccess.AdmAuthentication(Configuration.TranslatorUserId, Configuration.TranslatorUserKey);
            try
            {
                admToken    = admAuth.GetAccessToken();
                headerValue = "Bearer " + admToken.access_token;
                return(Translate(headerValue));
            }
            catch (WebException e)
            {
                ProcessWebException(e);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
            return("");
        }
Exemple #2
0
        public string Translate()
        {
            TokenAccess.AdmAccessToken admToken;
            string headerValue;
            TokenAccess.AdmAuthentication admAuth = new TokenAccess.AdmAuthentication(Configuration.TranslatorUserId, Configuration.TranslatorUserKey);
            try
            {
                admToken = admAuth.GetAccessToken();
                headerValue = "Bearer " + admToken.access_token;
                return Translate(headerValue);
            }
            catch (WebException e)
            {
                ProcessWebException(e);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
            catch (Exception ex)
            {

                Console.WriteLine(ex.Message);
                Console.WriteLine("Press any key to continue...");
                Console.ReadKey(true);
            }
            return "";
        }