My projects is an open source project powered by Assembla

Assembla offers free public and private SVN/Git repositories and project hosting with bug/issue tracking and collaboration tools.

/trunkStatusUpdater
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
´╗┐using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace StatusUpdater
{
    public partial class FBLoginForm : Form
    {
        private MainForm mainForm;

        public FBLoginForm(MainForm mainForm)
        {
            InitializeComponent();
            this.mainForm = mainForm;
            this.webBrowser1.DocumentCompleted += new WebBrowserDocumentCompletedEventHandler(this.webBrowser1_DocumentCompleted);
            this.webBrowser1.ScriptErrorsSuppressed = false;
            this.webBrowser1.Dock = DockStyle.Fill;
            base.Controls.Add(this.webBrowser1);
            this.webBrowser1.Navigate(new Uri("http://www.facebook.com/login.php?api_key=cde8bde5557a5f2f933eefb4de1789af&connect_display=popup&v=1.0&next=http://www.facebook.com/connect/login_success.html&cancel_url=http://www.facebook.com/connect/login_failure.html&fbconnect=true&return_session=true&req_perms=read_stream,publish_stream,offline_access"));
        }

        private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {
            if (this.webBrowser1.Url == null)
            {
                MessageBox.Show("Cannot connect to Facebook login page !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
                Close();
            }
            if (this.webBrowser1.Url.Query.Contains("?session="))
            {
                string str2 = "session_key%22%3A%22";
                string str3 = this.webBrowser1.Url.Query.Substring(this.webBrowser1.Url.Query.IndexOf(str2) + str2.Length);
                this.mainForm.SESSION_KEY = str3.Split(new char[] { '%' })[0];
                string str4 = "secret%22%3A%22";
                string str5 = this.webBrowser1.Url.Query.Substring(this.webBrowser1.Url.Query.IndexOf(str4) + str4.Length);
                this.mainForm.SESSION_SECRET = str5.Split(new char[] { '%' })[0];
                Close();
            }
        }


    }
}
Ajax-loader Loading, please wait...