コード例 #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("");
        }
コード例 #2
0
ファイル: Translator.cs プロジェクト: miguelahc/MyApiMovie
        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 "";
        }