/// <summary>
    /// Method that calls SpeechToText method of RequestFactory when user clicked on submit button
    /// </summary>
    /// <param name="sender">sender that invoked this event</param>
    /// <param name="e">eventargs of the button</param>
    protected void SpeechToTextButton_Click(object sender, EventArgs e)
    {
        try
        {
            resultsPanel.Visible = false;
            this.Initialize();

            TextToSpeechResponse response = this.requestFactory.TextToSpeech(txtTextToConvert.Text, ddlContentType.Text, ddlContentLanguage.Text, "audio/wav", xArgData);
            if (null != response)
            {
                resultsPanel.Visible = true;
                this.DisplayResult(response);
            }
        }
        catch (InvalidScopeException invalidscope)
        {
            this.DrawPanelForFailure(statusPanel, invalidscope.Message);
        }
        catch (ArgumentException argex)
        {
            this.DrawPanelForFailure(statusPanel, argex.Message);
        }
        catch (InvalidResponseException ie)
        {
            this.DrawPanelForFailure(statusPanel, ie.Body);
        }
        catch (Exception ex)
        {
            this.DrawPanelForFailure(statusPanel, ex.Message);
        }
    }
 /// <summary>
 /// Displays the result onto the page
 /// </summary>
 /// <param name="speechResponse">SpeechResponse received from api</param>
 private void DisplayResult(TextToSpeechResponse speechResponse)
 {
     if (null != speechResponse)
     {
         lblContentLength.Text = speechResponse.ContentLength.ToString();
         lblContentType.Text   = speechResponse.ContentType;
         if (null != speechResponse.SpeechContent)
         {
             try
             {
                 audioPlay.Attributes.Add("src", "data:audio/wav;base64," + Convert.ToBase64String(speechResponse.SpeechContent, Base64FormattingOptions.None));
             }
             catch (Exception ex)
             {
                 this.DrawPanelForFailure(resultsPanel, ex.Message);
             }
         }
     }
 }
 /// <summary>
 /// Displays the result onto the page
 /// </summary>
 /// <param name="speechResponse">SpeechResponse received from api</param>
 private void DisplayResult(TextToSpeechResponse speechResponse)
 {
     if (null != speechResponse)
     {
         lblContentLength.Text = speechResponse.ContentLength.ToString();
         lblContentType.Text = speechResponse.ContentType;
         if (null != speechResponse.SpeechContent)
         {
             try
             {
                 audioPlay.Attributes.Add("src", "data:audio/wav;base64," + Convert.ToBase64String(speechResponse.SpeechContent, Base64FormattingOptions.None));
             }
             catch (Exception ex)
             {
                 this.DrawPanelForFailure(resultsPanel, ex.Message);
             }
         }
     }
 }