/// <summary>
        /// Event handler when download state is changed.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments including download state</param>
        private void OnStateChanged(object sender, DownloadStateChangedEventArgs e)
        {
            if (e.stateMsg.Length > 0)
            {
                DependencyService.Get <IDownload>().DownloadLog("State: " + e.stateMsg);

                if (e.stateMsg == "Failed")
                {
                    downloadButton.Text = e.stateMsg + "! Please start download again.";
                    // If download is failed, dispose a request
                    DependencyService.Get <IDownload>().Dispose();
                    // Enable a donwload button
                    downloadButton.IsEnabled = true;
                }
                else if (e.stateMsg != downloadButton.Text)
                {
                    // Update a download state
                    downloadButton.Text = e.stateMsg;
                }
            }
        }
 /// <summary>
 /// Event handler when download state is changed.
 /// </summary>
 /// <param name="sender">Event sender</param>
 /// <param name="e">Event arguments including download state</param>
 private void OnStateChanged(object sender, DownloadStateChangedEventArgs e)
 {
     if (e.stateMsg.Length > 0)
     {
         DependencyService.Get <IDownload>().DownloadLog("State: " + e.stateMsg);
         Device.BeginInvokeOnMainThread(() =>
         {
             if (e.stateMsg == "Failed" || e.stateMsg == "Completed")
             {
                 downloadButton.Text = e.stateMsg;
                 // Enable a donwload button
                 downloadButton.IsEnable = true;
             }
             else if (e.stateMsg != downloadButton.Text)
             {
                 // Update a download state
                 downloadButton.Text = e.stateMsg;
             }
         });
     }
 }
        /// <summary>
        /// Event handler when download state is changed.
        /// </summary>
        /// <param name="sender">Event sender</param>
        /// <param name="e">Event arguments including download state</param>
        private void OnStateChanged(object sender, DownloadStateChangedEventArgs e)
        {
            if (e.stateMsg.Length <= 0)
            {
                return;
            }

            DependencyService.Get <IDownload>().DownloadLog("State: " + e.stateMsg);
            Device.BeginInvokeOnMainThread(() =>
            {
                if (e.stateMsg == "Failed")
                {
                    downloadButton.Text = e.stateMsg + "! Please start download again.";
                    // If download is failed, dispose a request
                    DependencyService.Get <IDownload>().Dispose();
                    // Enable a donwload button
                    downloadButton.IsEnabled = true;
                }
                else if (e.stateMsg != downloadButton.Text)
                {
                    downloadButton.Text = e.stateMsg;
                }
            });
        }