Get .net webbrowser full screen event - c#

I have a windows form application,there is a webbrowser control on the middle of the form. that navigates to a Youtube video, the full screen button of the video doesn't work.
How can i get the fullscreen event (when triggered using html or flash)?

void MainFormLoad(object sender, EventArgs e){
this.KeyDown+= new KeyEventHandler(MainForm_KeyDown);}
void MainForm_KeyDown(object sender, KeyEventArgs e){
if( e.KeyCode == Keys.ControlKey)
MessageBox.Show("What is the Ctrl?");}

I am still shocked by how bad IE 11 shows web pages. So I strongly recommend using another engine like Chromium. View this post in order to know about library options.
I went with CefSharp and there is a great How To Guide in here But the browser lakes just full screens to form boundaries, so be noted in case using this option you might need to implement it yourself.

Related

How can I create a form that allows only URL input?

I am developing a web browser using C# and XAML.
I want to make system that when users enter texts or numbers other than the URL in a URL display form, the screen display remains the same, but only the inside of the form is automatically blanked out and ready to be reentered.
I know that I need to add something to the code below, but I don't know how.
Please help.
private void txtUrl_KeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
wbSample.Navigate(txtUrl.Text);
}

WebKit.NET component not working correctly

I'm trying to make basic webbrowser in C# in Visual Studio, but I won't use built-in webbrowser component with IE rendering engine. So I downloaded WebKit.NET and added to my project. But it can load only one page - google.com. So when I put google.com to textbox and then press button, it works. But if I put to textbox else adress (toutube.com, facebook.com,...) it does nothing. With buit-in webbrowser everything works fine, but still on IE engine. Where can be mistake? The code is:
private void button1_Click(object sender, EventArgs e)
{
webkitBrowser1.Navigate(textBox1.Text);
}

Calling Play() on C# ShockWave component doesn't start YouTube video playback?

I have a simple WinForms C# application that embeds a ShockWave COM component on a form. I have a Test button that when clicked, calls the Play() method on the component. When I click the button nothing happens. The YouTube player is plainly visible in the ShockWave component with a video still and the player chrome in the frame, with a big Play button on it. But it doesn't start playing.
Sample code:
private void button1_Click(object sender, EventArgs e)
{
axShockwaveFlash1.Play();
}
Does anyone know how to fix this? I'm wondering if it's because the ShockWave component might need to have "requires click to play" or some other registry/system setting cleared before the Play() method works? If that happens to be the case, then how can I do that programmatically so a new install works perfectly without putting the user through some kind of a pre-setup hassle?
With Youtube videos and AxShockwaveFlash objects the Play() method doesn't function, however, there is a nice workaround for this.
The secret is adding ?autoplay=1 to the end of the URL containing the video you wish to play.
Something like this will provide the desired effect:
private void button1_Click(object sender, EventArgs e)
{
string path = #"http://www.youtube.com/v/Q-h4ulFK2Ek?autoplay=1";
axShockwaveFlash1.Load(0, path);
}

Detect whether user has clicked on a specific link inside a Browser Control?

I'm not using the in-built browser control (ie wrapper) but i'm using Webkit.Net instead
When i click on button1, the WebkitBrowser will navigate to the link typed on textBox1
private void Button1_Click(object sender, EventArgs e)
{
backgroundWorker1.Navigate("https://www.facebook.com/cocacola");
}
Can i detect when user click on the Like button ? For example when the user likes the page, a MessageBox appears and says that the page has been successfully liked !
Anyhelp would be highly appreciated

C#, Windows Phone 7, Using if-else statement to check which page is displayed

Now I'm developing a Windows Phone 7 app, my app has three buttons located at the applicaton bar. Here is the event handler for these three buttons:
//app bar page navigation
private void ApplicationBarIconButton_Click1(object sender, EventArgs e)
{
if(//check if the current displayed page is mainpage)
{
//do nothing
}
else
{
NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
}
}
private void ApplicationBarIconButton_Click2(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/Audios.xaml", UriKind.RelativeOrAbsolute));
}
private void ApplicationBarIconButton_Click3(object sender, EventArgs e)
{
NavigationService.Navigate(new Uri("/Statistics.xaml", UriKind.RelativeOrAbsolute));
}
The button navigation works well except the first one (Button_Click1) because when I first access the main page and click the first button the app will automatically go back to app list.
So I want to use if-else statement to check which page is currently displayed and then decide whether to navigate or stay in the current page.
It looks like you are using the ApplicationBar like you would use a TabBar within iPhone (or similar in Android, Bada, etc too)
In WP7, the Metro style is typpically to use a Pivot or Panorama rather than a "Tab Bar" for this type of navigation.
If you do want to use the ApplicationBar like this:
then you can (the WP7 Marketplace will allow it) but users might feel it's not very Metro.
then you might want to consider disabling the appropriate button rather than just stubbing out the action.
then you can detect the currently shown page using CurrentSource on the NavigationService
Also, please do note that if you try to navigate from MainPage.xaml to the same url MainPage.xaml then you will see an exception - as I recall, the navigation service complains about url fragments not being supported.
Button click1 should be removed from the main page. It makes no sense to have that button there.
Other pages should use the back button to return to the main page. Otherwise you mess up your back stack.

Categories

Resources