public void QueryListener(object sender, QueryAskedEventArgs e) { try { UriYoutubeBase uri = e.uri; IQueryUIObject obj = uri.GetUINavigatorObject(); IFactory fac = uri.GetFactory(); if (obj == null) throw new Exception("No UI object."); if (fac == null) throw new Exception("No factory."); obj.Inject(fac); obj.LinkClicked += new DelegateLinkClicked(QueryListener); Control ctrl = (Control)obj; ctrl.Dock = DockStyle.Fill; TabPage pg = null; if (e.newWindow || tabControl1.SelectedTab == null) { pg = new TabPage(); pg.Text = ""; tabControl1.TabPages.Add(pg); tabControl1.SelectedTab = pg; } else { pg = tabControl1.SelectedTab; } pg.Controls.Clear(); pg.Controls.Add(ctrl); } catch (Exception ex) { MessageBox.Show(ex.Message, ex.GetType().FullName); } }
void FeedControl_LinkClicked(object sender, QueryAskedEventArgs e) { if (LinkClicked != null) LinkClicked(sender, e); }