xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
Title="TestFacebookLogin" Height="1050" Width="1680">
CS File
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Forms;
namespace Nasrullah.WPF
{
///
/// Interaction logic for TestFacebookLogin.xaml
///
public partial class TestFacebookLogin : Window
{
public TestFacebookLogin()
{
InitializeComponent();
LoginFacebook.Enabled = false;
}
private void LoadFacebook_Click(object sender, EventArgs e)
{
WebBrowser1.Navigate("https://login.facebook.com/login.php?login_attempt=1");
WebBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(webBrowser1_DocumentCompleted);
}
void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
string s = WebBrowser1.DocumentText;
LoginFacebook.Enabled = true;
}
private void LoginFacebook_Click(object sender, EventArgs e)
{
HtmlElement ele = WebBrowser1.Document.GetElementById("email"); if (ele != null)
ele.InnerText = "nasrullah.mahar@gmail.com";
ele = WebBrowser1.Document.GetElementById("pass"); if (ele != null)
ele.InnerText = "password";
ele = WebBrowser1.Document.GetElementById("Login"); if (ele != null)
ele.InvokeMember("click");
}
}
}
Subscribe by Email
Follow Updates Articles from This Blog via Email
No Comments
comments