Facebook.Facebook.Initialize C# (CSharp) Method

Initialize() public method

public Initialize ( System.Windows.Forms.NotifyIcon Tray ) : void
Tray System.Windows.Forms.NotifyIcon
return void
        public void Initialize(NotifyIcon Tray)
        {
            this.Tray = Tray;
            this.settings = new Settings("Addons/Facebook/settings.txt");
            this.bmpIcon = Image.FromFile("Addons/Facebook/Icon.ico");

            this.facebookClient = new FacebookClient() { IsSecureConnection = true };

            LoadSettings();

            if (this.facebookClient.AccessToken != "") {
                try {
                    this.facebookName = (this.facebookClient.Get("/me") as dynamic).name;
                } catch {
                    // If it crashes here, then the user probably doesn't have a working internet connection.
                    // Not sure what else to do here besides turning off the addon itself...
                    this.facebookClient.AccessToken = "";
                }
            }
        }