Exemplo n.º 1
0
 /// <summary>
 /// Loads the albums for the Facebook User.
 /// </summary>
 public void LoadAlbums(FacebookService fb, string userId)
 {
     FacebookService = fb;
     UserId = userId;
     LoadAlbums();
 }
Exemplo n.º 2
0
 private void SettingsPage_Load(object sender, EventArgs e)
 {
     Settings.Default.PropertyChanged += new PropertyChangedEventHandler(Default_PropertyChanged);
     pathTextBox.TextChanged += pathTextBox_TextChanged;
     processNameComboBox.DataSource = GetProcesseList();
     try
     {
         //if (Settings.Default.FacebookService != null)
         //{
         service = Settings.Default.FacebookService;
             if (Settings.Default.FacebookUser != null)
             {
                 me = Settings.Default.FacebookUser;
                 userNameTextBox.Text = me.Name;
                 ProfilePictureBox.Image = me.Picture;
                 ProfilePictureBox.BorderStyle = BorderStyle.FixedSingle;
                 statusLabel.Text = "Authorized.";
                 statusLabel.Visible = true;
             }
        // }
     }
     catch (Exception ex) { MessageBox.Show(ex.Message+"\n\n"+ex.StackTrace, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); }
 }
Exemplo n.º 3
0
        private void postToolStripButton_Click(object sender, EventArgs e)
        {
            try
            {
                if (Settings.Default.FacebookService == null || Settings.Default.FacebookUser == null)
                {
                    try
                    {
                        FacebookService service = new FacebookService();
                        service.IsDesktopApplication = true;
                        service.ApplicationKey = "00d36cfe480479a5982206e2c5b1cfb7";
                        service.Secret = "d9a50c892615569bf5e24d3aeeef38d5";
                        Settings.Default.FacebookService = service;

                        User me = service.GetUserInfo();
                        if (me != null)
                            Settings.Default.FacebookUser = me;
                        else
                            throw new UnauthorizedAccessException("Authorization faild.. please try again.");
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message, "Error");
                        Settings.Default.FacebookUser = null;
                        Settings.Default.FacebookService = null;
                        return;
                    }
                    Settings.Default.Save();
                }

                int[] imageIDs = new int[snapsDataGridView.SelectedRows.Count];
                for (int i = 0; i < imageIDs.Length; i++)
                    imageIDs[i] = (int)snapsDataGridView.SelectedRows[i].Cells[0].Value;

                new FacebookUploader(Snap.byteArrayToImage((byte[])snapsTableAdapter.GetSnap((int)snapsDataGridView.CurrentRow.Cells[0].Value)), imageIDs).ShowDialog();
            }
            catch (Exception ex) { MessageBox.Show(ex.Message+"\n\n"+ex.StackTrace); }
        }
Exemplo n.º 4
0
        private void authorizeButton_Click(object sender, EventArgs e)
        {
            userNameTextBox.Enabled = false;
            authorizeButton.Enabled = false;
            facebookProgressBarEx.MarqueeStart();
            facebookProgressBarEx.Visible = true;

            try
            {
                //if (service == null)
                //{
                    service = new FacebookService();
                    service.IsDesktopApplication = true;
                    service.ApplicationKey = "00d36cfe480479a5982206e2c5b1cfb7";
                    service.Secret = "d9a50c892615569bf5e24d3aeeef38d5";
                //}
                me = service.GetUserInfo();
                //if (me != null)
                //{

                    Settings.Default.FacebookService = service;
                    Settings.Default.FacebookUser = me;
                    userNameTextBox.Text = me.Name;
                    ProfilePictureBox.Image = me.Picture;
                    ProfilePictureBox.BorderStyle = BorderStyle.FixedSingle;
                    statusLabel.Text = "Authorized.";
                    statusLabel.Visible = true;
                    saveAll = true;
                //}
                //else
                //{
                //    statusLabel.Text = "Authorization faild.. please try again.";
                //    statusLabel.Visible = true;
                //    Settings.Default.FacebookUser = null;
                //    Settings.Default.FacebookService = null;
                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
                statusLabel.Text = "Authorization faild.. please try again.";
                statusLabel.Visible = true;
                Settings.Default.FacebookUser = null;
                Settings.Default.FacebookService = null;
            }

            facebookProgressBarEx.MarqueeStop();
            facebookProgressBarEx.Visible = false;
            userNameTextBox.Enabled = true;
            authorizeButton.Enabled = true;
        }