protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.Main);

            var downloadButton = FindViewById<Button>(Resource.Id.downloadButton);
            FindViewById<Button>(Resource.Id.backButton).Click += (sender, args) => { if (_webView.CanGoBack()) _webView.GoBack(); };
            FindViewById<Button>(Resource.Id.forwardButton).Click += (sender, args) => { if (_webView.CanGoForward()) _webView.GoForward(); };
            _webView = FindViewById<WebView>(Resource.Id.webView1);
            var progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar1);
            var title = FindViewById<TextView>(Resource.Id.textView1);
            var frame = FindViewById(Resource.Id.frameDownload);
            frame.Visibility = ViewStates.Gone;
            var viewControls = new ViewControls {
                DownloadButton = downloadButton,
                ProgressBar = progressBar,
                Title = title,
                DownloadFrame = frame,
                Activity = this
            };
            _webView.Settings.JavaScriptEnabled = true;
            _webView.SetWebViewClient(new YoutubeWebViewClient(viewControls));
            _webView.LoadUrl("http://www.youtube.com/");
        }
 public YoutubeWebViewClient(ViewControls controls)
 {
     Controls = controls; 
     Controls.DownloadButton.Enabled = false;
     Controls.DownloadButton.Click += DownloadButtonOnClick;
     Controls.DownloadFrame.Click += DownloadFrame_Click;
     _settings = new Settings();
     _lists = new DownloadLists(_settings, OnDownloadStatusChange, null); //, OnDownloadAvailable);
     var receiver = new DownloadBroadcastReceiver(this);
     Controls.Activity.RegisterReceiver(receiver, new IntentFilter(DownloadManager.ActionDownloadComplete));
 }