示例#1
0
        static void Main(string[] args)
        {
            AdmAccessToken admToken;
            string         headerValue;
            //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
            //Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx)
            AdmAuthentication admAuth = new AdmAuthentication("clientID", "client secret");

            try
            {
                admToken = admAuth.GetAccessToken();
                // Create a header with the access_token property of the returned token
                headerValue = "Bearer " + admToken.access_token;
                BreakSentencesMethod(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);
            }
        }
        static void Main(string[] args)
        {
            AdmAccessToken admToken;
            string         headerValue;
            //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
            AdmAuthentication admAuth = new AdmAuthentication("clientID", "client secret");

            try
            {
                admToken = admAuth.GetAccessToken();
                // Create a header with the access_token property of the returned token
                headerValue = "Bearer " + admToken.access_token;
                AddTranslationMethod(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);
            }
        }
示例#3
0
 public GetAccessToken()
 {
     AdmAccessToken admToken;
     //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
     //Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx)
     AdmAuthentication admAuth = new AdmAuthentication("EDCFootball", "HFTStYA/5OlI3dA3U5OyzzND9hfpB/8xD4wL7NGT6uI=");
     try
     {
         admToken = admAuth.GetAccessToken();
         // Create a header with the access_token property of the returned token
         this.headerValue = "Bearer " + admToken.access_token;
     }
     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);
     }
 }
        static void Main(string[] args)
        {
            AdmAccessToken admToken;
            string headerValue;
            //Get Client Id and Client Secret from https://datamarket.azure.com/developer/applications/
            //Refer obtaining AccessToken (http://msdn.microsoft.com/en-us/library/hh454950.aspx)
            AdmAuthentication admAuth = new AdmAuthentication("AgapeConnect", "");
            try
            {
                admToken = admAuth.GetAccessToken();
                // Create a header with the access_token property of the returned token
                headerValue = "Bearer " + admToken.access_token;
                DetectMethod(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);
            }
        }