Esempio n. 1
0
        public void UnlinkFaceBook()
        {
            if (!HasConnection || UserPreference.AccessKey == null)
            {
                return;
            }
            var fb = new FacebookClient(UserPreference.AccessKey)
            {
                AppId = AppId
            };

            fb.DeleteAsync(string.Format("https://graph.facebook.com/{0}/permissions", UserPreference.FbUserId));
            UserPreference.AccessKey = null;
            UserPreference.FbUserId  = null;
            UserPreference.Name      = null;
            SaveSettings();
            NotifyPropertyChanged("AccessKey");
        }
Esempio n. 2
0
        private void btnDeleteLastMessage_Click(object sender, EventArgs args)
        {
            btnDeleteLastMessage.Enabled = false;

            var fb = new FacebookClient(_accessToken);

            // make sure to add event handler for DeleteCompleted.
            fb.DeleteCompleted += (o, e) =>
            {
                // incase you support cancellation, make sure to check
                // e.Cancelled property first even before checking (e.Error!=null).
                if (e.Cancelled)
                {
                    // for this example, we can ignore as we don't allow this
                    // example to be cancelled.

                    // you can check e.Error for reasons behind the cancellation.
                    var cancellationError = e.Error;
                }
                else if (e.Error != null)
                {
                    // error occurred
                    this.BeginInvoke(new MethodInvoker(
                                         () =>
                    {
                        MessageBox.Show(e.Error.Message);
                    }));
                }
                else
                {
                    // the request was completed successfully

                    // make sure to be on the right thread when working with ui.
                    this.BeginInvoke(new MethodInvoker(
                                         () =>
                    {
                        MessageBox.Show("Message deleted successfully");
                        btnDeleteLastMessage.Enabled = false;
                    }));
                }
            };

            fb.DeleteAsync(_lastMessageId);
        }
Esempio n. 3
0
        private void DeleteLastMessage_Click(object sender, RoutedEventArgs e)
        {
            btnDeleteLastMessage.IsEnabled = false;

            var fb = new FacebookClient(_accessToken);

            fb.DeleteCompleted += (o, args) =>
            {
                if (args.Error != null)
                {
                    Dispatcher.BeginInvoke(() => MessageBox.Show(args.Error.Message));
                    return;
                }

                Dispatcher.BeginInvoke(() =>
                {
                    MessageBox.Show("Message deleted successfully");
                    btnDeleteLastMessage.IsEnabled = false;
                });
            };

            fb.DeleteAsync(_lastMessageId);
        }