private void OldMain()
        {
            const string toLang = "de";
            //const string toLang = "zh-CHS";
            AdmAccessToken admToken = null;
            string headerValue;
            string fromLang = "en";
            string textToTranslate = "";
            //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("HelloBingTranslator", "WEG1nbJcFpZB/64CmgJv+Zx+EZeIWbUqj23LAf2bEjh=");
            AdmAuthentication admAuth = new AdmAuthentication("HelloBingTranslator", "WEG1nbJcFpZB/64CmgJv+Zx+EZeIWbUqj23LAf2bEjg=");
            try
            {
                admToken = admAuth.GetAccessToken();
                // Create a header with the access_token property of the returned token
                headerValue = "Bearer " + admToken.access_token;
                Console.WriteLine("Enter Text to detect language:");
                textToTranslate = Console.ReadLine();
                fromLang = DetectMethod(headerValue, textToTranslate);
            }
            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);
            }

            //string from = "en";
            string to = "de";

            string uri = "http://api.microsofttranslator.com/v2/Http.svc/Translate?text=" +
                         System.Web.HttpUtility.UrlEncode(textToTranslate) + "&from=" + fromLang + "&to=" + toLang;
            string authToken = "Bearer" + " " + admToken.access_token;

            HttpWebRequest httpWebRequest = (HttpWebRequest) WebRequest.Create(uri);
            httpWebRequest.Headers.Add("Authorization", authToken);

            WebResponse response = null;
            try
            {
                response = httpWebRequest.GetResponse();
                using (Stream stream = response.GetResponseStream())
                {
                    System.Runtime.Serialization.DataContractSerializer dcs =
                        new System.Runtime.Serialization.DataContractSerializer(Type.GetType("System.String"));
                    string translation = (string) dcs.ReadObject(stream);
                    Console.WriteLine("Translation for source text '{0}' from {1} to {2} is", textToTranslate, fromLang,
                        toLang);
                    Console.WriteLine(translation);
                }
            }
            catch (WebException e)
            {
                ProcessWebException(e);
            }
            finally
            {
                if (response != null)
                {
                    response.Close();
                    response = null;
                }
            }
            Console.WriteLine("Enter to exit");
            Console.ReadLine();
        }
 public string GetBingToken()
 {
     AdmAccessToken admToken = null;
     AdmAuthentication admAuth = new AdmAuthentication("HelloBingTranslator",
         "WEG1nbJcFpZB/64CmgJv+Zx+EZeIWbUqj23LAf2bEjg=");
     try
     {
         admToken = admAuth.GetAccessToken();
     }
     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 admToken.access_token;
 }