private void TakeLoggedInAction(Facebook.FacebookOAuthResult facebookOAuthResult) { if (facebookOAuthResult == null) { // the user closed the FacebookLoginDialog, so do nothing. MessageBox.Show("Cancelled!"); return; } // Even though facebookOAuthResult is not null, it could had been an // OAuth 2.0 error, so make sure to check IsSuccess property always. if (facebookOAuthResult.IsSuccess) { // since our respone_type in FacebookLoginDialog was token, // we got the access_token // The user now has successfully granted permission to our app. var dlg = new FacebookInfoDialog(facebookOAuthResult.AccessToken); dlg.ShowDialog(); } else { // for some reason we failed to get the access token. // most likely the user clicked don't allow. MessageBox.Show(facebookOAuthResult.ErrorDescription); } }
private void OnSessionStateChanged(object sender, Facebook.Client.Controls.SessionStateChangedEventArgs e) { this.ContentPanel.Visibility = (e.SessionState == Facebook.Client.Controls.FacebookSessionState.Opened) ? Visibility.Visible : Visibility.Collapsed; }
public FacebookLoginController(Facebook facebook, MainView mainView) { _facebook = facebook; _mainView = mainView; _sessionDelegate = new SessionDelegate(this); _userDelegate = new GetUserRequestDelegate(this); }
/// <summary> /// AddCampaign - Use 'AddCampaignParams' to pass parameters into this method. /// </summary> public void AddCampaign(Facebook.UITestFramework.Object.Campaign addCampaign) { #region Variable Declarations WinButton uIAddCampaignButton = this.UIAdSageforPerformanceWindow.UIRibbonToolBar1.UIAddCampaignButton; WinEdit uITxtCamNameEdit = this.UIAdSageforPerformanceWindow.UITxtCamNameWindow.UITxtCamNameEdit; WinComboBox uICbBudgetTypeComboBox = this.UIAdSageforPerformanceWindow.UICbBudgetTypeWindow.UICbBudgetTypeComboBox; WinEdit uITxtBudgetEdit = this.UIAdSageforPerformanceWindow.UITxtBudgetWindow.UITxtBudgetEdit; WinComboBox uICbStatusComboBox = this.UIAdSageforPerformanceWindow.UICbStatusWindow.UICbStatusComboBox; WinDateTimePicker uIDtpFromDateTimePicker =this.UIAdSageforPerformanceWindow.UIDtpFromWindow.UIDtpFromDateTimePicker; #endregion // Click 'Add Campaign' button Mouse.Click(uIAddCampaignButton, new Point(36, 32)); // Type 'AutomationCampaignName' in 'txtCamName' text box uITxtCamNameEdit.Text = addCampaign.Name; // Select 'Daily' in 'cbBudgetType' combo box uICbBudgetTypeComboBox.SelectedItem = addCampaign.BudgetType; // Click 'txtBudget' text box Mouse.Click(uITxtBudgetEdit, new Point(40, 6)); // Type '12' in 'txtBudget' text box uITxtBudgetEdit.Text = addCampaign.Budget; // Select 'Active' in 'cbStatus' combo box uICbStatusComboBox.SelectedItem = addCampaign.RunStatus; //uIDtpFromDateTimePicker.DateTimeAsString = addCampaign.StartTime; }
private void OnSessionStateChanged(object sender, Facebook.Client.Controls.SessionStateChangedEventArgs e) { if (e.SessionState == Facebook.Client.Controls.FacebookSessionState.Opened) { this.home.Visibility = Visibility.Visible; isi.DefaultItem = home; this.login.Visibility = Visibility.Collapsed; this.post.Visibility = Visibility.Visible; this.rule.Visibility = Visibility.Visible; this.reward.Visibility = Visibility.Visible; this.LayoutRoot.Background = new SolidColorBrush(Colors.White); isi.Foreground = new SolidColorBrush(Colors.Black); this.loginButton.Visibility = Visibility.Collapsed; ApplicationBar.IsVisible = true; this.profilePicture.Visibility = Visibility.Visible; } else { this.profilePicture.Visibility = Visibility.Collapsed; this.home.Visibility = Visibility.Collapsed; this.post.Visibility = Visibility.Collapsed; this.rule.Visibility = Visibility.Collapsed; this.reward.Visibility = Visibility.Collapsed; this.LayoutRoot.Background = new SolidColorBrush(Colors.Blue); this.login.Visibility = Visibility.Visible; opening.Text = "Welcome to KP Facebook Monitor Application. To use you must login first by clicking the button below."; login.Header = "login first"; isi.Foreground = new SolidColorBrush(Colors.White); isi.DefaultItem = login; this.loginButton.Visibility = Visibility.Visible; this.profilePicture.Visibility = Visibility.Collapsed; } }
public FaceBookApplication (UIViewController parentViewController) { _parentViewController = parentViewController; _facebook = new Facebook(_appId); _sessionDelegate = new SessionDelegate(this); _requestDelegate = new RequestDelegate(this); _loginDialogDelegate = new LoginDialogDelegate(this); _dialogDelegate = new DialogDelegate(this); }
public FacebookController(Facebook facebook, FacebookLoginController loginController, MainView mainView) { _facebook = facebook; _mainView = mainView; _loginController = loginController; _photoDelegate = new UploadPhotoRequestDelegate(this); _fqlDelegate = new FqlRequestDelegate(this); _uploadNextDelegate = new UploadNextRequestDelegate(this); _queuedUploads = new Queue<QueuedUpload>(); }
void CreateDirectServices() { // create direct services to social networks _twitter = new Twitter(); _sinaWeibo = new SinaWeibo(); //TODO: init facebook with your app ID and an array of permissions _facebook = new Facebook(); _facebook.Init("1234567890", new string[] {"read_stream", "email", "publish_stream"}); }
private void OnSessionStateChanged(object sender, Facebook.Client.Controls.SessionStateChangedEventArgs e) { if(e.SessionState == Facebook.Client.Controls.FacebookSessionState.Opened) { NavigationService.Navigate(new Uri("/Content.xaml", UriKind.Relative)); } else { NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative)); } }
private void OnSessionStateChanged(object sender, Facebook.Client.Controls.SessionStateChangedEventArgs e) { if (e.SessionState == Facebook.Client.Controls.FacebookSessionState.Opened) { this.queryButton.Visibility = Visibility.Visible; } else if (e.SessionState == Facebook.Client.Controls.FacebookSessionState.Closed) { this.queryButton.Visibility = Visibility.Collapsed; } }
public static void AppRequest( string message, string[] to = null, string filters = "", string[] excludeIds = null, int? maxRecipients = null, string data = "", string title = "", Facebook.APIDelegate callback = null) { FacebookImpl.AppRequest(message, to, filters, excludeIds, maxRecipients, data, title, callback); }
public static void GetProfileFullName(Facebook.FacebookDelegate userCallback = null) { if(isJobPending) { Debug.Log("Still waiting for response from another Facebook call. Skipping GetProfileFullName command."); return; } apiQuery = "me?fields=id,name,name_format,first_name,last_name"; FBAPIQuery(apiQuery, userCallback, Facebook.HttpMethod.GET); }
//public delegate void FacebookDelegate (FBResult result); public static void GetProfilePicture(Facebook.FacebookDelegate userCallback = null, int width = 128, int height = 128) { if(isJobPending) { Debug.Log("Still waiting for response from another Facebook call. Skipping GetProfilePicture command."); return; } apiQuery = "me/picture?width=" + width.ToString() + "&height=" + height.ToString() + "&redirect=false"; FBAPIQuery(apiQuery, userCallback, Facebook.HttpMethod.GET); }
void AuthCallback(Facebook.Unity.IResult result) { if(Facebook.Unity.FB.IsLoggedIn) { FBMenus(true); Debug.Log("LOGGED IN WORKED"); } else { FBMenus(false); Debug.Log("LOGGIN FAILED"); } }
/// <summary> /// Facebookインスタンスを取得する. /// </summary> public static Facebook GetFacebook() { if (_instance == null) { #if (USE_FACEBOOK_PLUGIN && UNITY_EDITOR) _instance = new Facebook(); #elif (USE_FACEBOOK_PLUGIN && UNITY_ANDROID) _instance = new FacebookAndroid(); #elif (USE_FACEBOOK_PLUGIN && UNITY_IPHONE) _instance = new FacebookIPhone(); #else _instance = new Facebook(); #endif } return _instance; }
// This method is invoked when the application has loaded its UI and its ready to run public override bool FinishedLaunching(UIApplication app, NSDictionary options) { _facebook = new FacebookSdk.Facebook(kAppId); mainView = new MainView(_facebook); controller = new UINavigationController(mainView); controller.SetNavigationBarHidden(true, false); controller.NavigationBar.TintColor = mainView.FacebookBlue; window.AddSubview(controller.View); window.MakeKeyAndVisible(); return true; }
public FqlExecuteResult(Facebook.JsonArray responseJson, Type resultType, Type tableRowType, QueryOptions options) { ResponseJson = responseJson; TableRowType = tableRowType; ResultType = resultType; QueryOptions = options; if (options.Select != null) { //Select = options.Select; TableRowType = (options.Select as LambdaExpression).Parameters[0].Type; } //var funcType = typeof(Func<>).MakeGenericType(tableRowType, resultType); //Activator.CreateInstance(typeof(Expression).MakeGenericType(funcType)); //Expression<Func<tableRowType, resultType>> e =new Expression<Func<object,object>>( }
public static void InitializeFacebook(Facebook.InitDelegate userCallback) { // Another safety check if(isFBAvailable == false) { Debug.Log("Something went wrong, Facebook should be available for use before calling Init()"); return; } if(isFBInit) { Debug.LogWarning("Facebook's Init() has already been called before!"); return; } userCallback += OnFBInit; FB.Init(userCallback); }
void CreateDirectServices() { // create direct services to social networks _twitter = new Twitter(); _twitter.InitializationCompleted += OnDirectServiceInit; _twitter.InitializationFailed += OnDirectServiceInitFailed; _twitter.Init(); _sinaWeibo = new SinaWeibo(); _sinaWeibo.InitializationCompleted += OnDirectServiceInit; _sinaWeibo.InitializationFailed += OnDirectServiceInitFailed; _sinaWeibo.Init(); // init facebook with your app ID and an array of permissions _facebook = new Facebook(); _facebook.InitializationCompleted += OnDirectServiceInit; _facebook.InitializationFailed += OnDirectServiceInitFailed; _facebook.Init(facebookAppID, new string[] {"read_stream", "email", "publish_stream"}); }
public ActionResult Callback(string type) { IOauthClient client; switch (type) { case "tw": client = new Twitter(); break; case "fb": client = new Facebook(); break; default: return ErrorOut("No valid Oauth orchestration was found for current callback."); } var userInfo = client.Verify(); return CompleteSignIn(userInfo); }
public RMShare(UIViewController viewC) { //this._canSendTweets = TWTweetComposeViewController.CanSendTweet; // FB - change appid this._fbAppId = "435387349843657"; var sessionDelegate = new SessionDelegate (this); this._facebook = new Facebook (this._fbAppId, sessionDelegate); var defaults = NSUserDefaults.StandardUserDefaults; if (defaults ["FBAccessTokenKey"] != null && defaults ["FBExpirationDateKey"] != null){ this._facebook.AccessToken = defaults ["FBAccessTokenKey"] as NSString; this._facebook.ExpirationDate = defaults ["FBExpirationDateKey"] as NSDate; } this._vc = viewC; this._socialMessage = ""; ValidateSetup(); }
void SetupUI () { var sessionDelegate = new SessionDelegate (this); facebook = new Facebook (AppId, sessionDelegate); var defaults = NSUserDefaults.StandardUserDefaults; if (defaults ["FBAccessTokenKey"] != null && defaults ["FBExpirationDateKey"] != null){ facebook.AccessToken = defaults ["FBAccessTokenKey"] as NSString; facebook.ExpirationDate = defaults ["FBExpirationDateKey"] as NSDate; } dvc = new DialogViewController (null); nav = new UINavigationController (dvc); if (facebook.IsSessionValid) ShowLoggedIn (); else ShowLoggedOut (); window = new UIWindow (UIScreen.MainScreen.Bounds); window.MakeKeyAndVisible (); window.RootViewController = nav; }
public UserJSON(Facebook.Entity.User u) { this.AboutMe = u.AboutMe; this.Activities = u.Activities; this.Birthday = u.Birthday; this.Books = u.Books; this.FirstName = u.FirstName; this.Interests = u.Interests; this.LastName = u.LastName; this.Movies = u.Movies; this.Music = u.Music; this.Name = u.Name; this.NotesCount = u.NotesCount; this.Picture = u.Picture; this.PictureUrl = u.PictureUrl; this.ProfileUpdateDate = u.ProfileUpdateDate; this.Quotes = u.Quotes; this.Religion = u.Religion; this.SignificantOtherId = u.SignificantOtherId; this.TVShows = u.TVShows; this.UserId = u.UserId; this.WallCount = u.WallCount; }
private Task<FacebookUser> getUserData(Facebook.CoreKit.AccessToken token) { var fbUser = new FacebookUser() { Token = token.TokenString, ExpiryDate = token.ExpirationDate.ToDateTime() }; var completion = new TaskCompletionSource<FacebookUser>(); var request = new GraphRequest("me", NSDictionary.FromObjectAndKey(new NSString("id, first_name, last_name, email, location"), new NSString("fields")), "GET"); request.Start((connection, result, error) => { if(error != null) { Mvx.Trace(MvxTraceLevel.Error, error.ToString()); } else { var data = NSJsonSerialization.Serialize(result as NSDictionary, 0, out error); if(error != null) { Mvx.Trace(MvxTraceLevel.Error, error.ToString()); } else { var json = new NSString(data, NSStringEncoding.UTF8).ToString(); fbUser.User = JsonConvert.DeserializeObject<User>(json); fbUser.User.ProfilePictureUrl = string.Format("https://graph.facebook.com/{0}/picture?width={1}&height={1}", fbUser.User.ID, Constants.FBProfilePicSize); } completion.TrySetResult(fbUser); } }); return completion.Task; }
public void Init (Activity activity, Facebook fb) { Init (activity, fb, new String[] { }); }
/// <summary> /// Handles the Loaded event of the Window control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param> private void WindowLoaded(object sender, RoutedEventArgs e) { if (AeroGlassCompositionEnabled) { SetAeroGlassTransparency(); } // Twitter _twitter = new Twitter { Tokens = Settings.Get("Twitter OAuth", new List <string>()) }; postToTwitter.IsChecked = Settings.Get <bool>("Post to Twitter"); if (_twitter.Tokens.Count == 4) { twitterUserName.Text = _twitter.Tokens[1]; twitterUserLink.NavigateUri = new Uri("http://twitter.com/" + _twitter.Tokens[1]); twitterNoAuthMsg.Visibility = Visibility.Collapsed; twitterOkAuthMsg.Visibility = Visibility.Visible; twitterAuthStackPanel.Effect = new BlurEffect(); twitterAuthStackPanel.IsHitTestVisible = twitterPinTextBox.IsTabStop = twitterFinishAuthButton.IsTabStop = false; } twitterStatusFormat.Text = Settings.Get("Twitter Status Format", _twitter.DefaultStatusFormat); // Identi.ca _identica = new Identica { Tokens = Settings.Get("Identi.ca OAuth", new List <string>()) }; postToIdentica.IsChecked = Settings.Get <bool>("Post to Identi.ca"); if (_identica.Tokens.Count == 4) { identicaUserName.Text = _identica.Tokens[1]; identicaUserLink.NavigateUri = new Uri("http://identi.ca/" + _identica.Tokens[1]); identicaNoAuthMsg.Visibility = Visibility.Collapsed; identicaOkAuthMsg.Visibility = Visibility.Visible; identicaAuthStackPanel.Effect = new BlurEffect(); identicaAuthStackPanel.IsHitTestVisible = identicaPinTextBox.IsTabStop = identicaFinishAuthButton.IsTabStop = false; } identicaStatusFormat.Text = Settings.Get("Identi.ca Status Format", _identica.DefaultStatusFormat); // Facebook _facebook = new Facebook { Tokens = Settings.Get("Facebook OAuth", new List <string>()) }; postToFacebook.IsChecked = Settings.Get <bool>("Post to Facebook"); if (_facebook.Tokens.Count == 4) { facebookUserName.Text = _facebook.Tokens[1]; facebookUserLink.NavigateUri = new Uri("http://facebook.com/profile.php?id=" + _facebook.Tokens[0]); facebookNoAuthMsg.Visibility = Visibility.Collapsed; facebookOkAuthMsg.Visibility = Visibility.Visible; } facebookStatusFormat.Text = Settings.Get("Facebook Status Format", _facebook.DefaultStatusFormat); // Settings onlyNew.IsChecked = Settings.Get("Post only recent", true); switch (Settings.Get("Post restrictions list type", "black")) { case "black": blackListRadioButton.IsChecked = true; listTypeText.Text = "Specify TV shows to block from being posted:"; break; case "white": whiteListRadioButton.IsChecked = true; listTypeText.Text = "Specify TV shows to allow to be posted:"; break; } foreach (var show in Settings.Get("Post restrictions list", new List <int>())) { if (Database.TVShows.ContainsKey(show)) { listBox.Items.Add(Database.TVShows[show].Title); } else { listBox.Items.Add("Unknown show #" + show); } } _loaded = true; ListBoxSelectionChanged(); foreach (var show in Database.TVShows.Values.OrderBy(x => x.Title)) { listComboBox.Items.Add(show.Title); } ListComboBoxSelectionChanged(); }
static void Main(string[] args) { //args = new string[] { "servico"}; if (args.Length > 0) { switch (args[0]) { case "servico": Console.WriteLine("Iniciando serviço..."); var servico = new Servico(); servico.InitAsync().Wait(); break; default: break; } return; } bool loop = true; while (loop) { Console.WriteLine("F1 - Inserir Cidade"); Console.WriteLine("F2 - Buscar Logradouros do Bairro/Cidade pelo Crawler dos Correios"); Console.WriteLine("F3 - Obter Coordenadas do logradouro"); Console.WriteLine("===================================="); Console.WriteLine("F4 - Adicionar página de facebook"); Console.WriteLine("F6 - Adicionar posts página de facebook"); Console.WriteLine("F7 - Adicionar comentarios de posts da página de facebook"); Console.WriteLine("===================================="); Console.WriteLine("F8 - Procurar locais em posts"); Console.WriteLine("F9 - Procurar locais em comentarios"); Console.WriteLine("F12 - Tokenize bairro x post"); Console.WriteLine("===================================="); Console.WriteLine("Espaço - Novo Menu"); Console.WriteLine("\n\nESC - SAIR"); var key = Console.ReadKey(); switch (key.Key) { case ConsoleKey.F1: InserirCidade(); break; case ConsoleKey.F2: BuscarLogradouros(); break; case ConsoleKey.F3: break; case ConsoleKey.F4: Facebook.AdicionarPagina().Wait(); break; case ConsoleKey.F6: Facebook.AdicionarPosts().Wait(); break; case ConsoleKey.F7: Facebook.AdicionarComentarios().Wait(); break; case ConsoleKey.F8: var postsDao = PostFacebookDAO.BuscarTodosPosts(); var posts = new List <Nucleo.Model.Facebook.Post>(); foreach (var post in postsDao) { var p = new Nucleo.Model.Facebook.Post(); p = post; posts.Add(p); } Analisador.ContaLocalNoPost(posts, new Status()); break; case ConsoleKey.F9: //List<Nucleo.Model.Facebook.Comment> comentarios = ComentarioFacebookDAO.BuscarTodosComentarios(); //Analisador.ContaLocalNosComentarios(comentarios, new Status()); break; case ConsoleKey.F12: Model.Analise.AnalisarLogradourosEmPosts(); break; case ConsoleKey.Escape: loop = false; break; case ConsoleKey.Spacebar: //var cidade = "rio das ostras"; //Analise.EntidadeRelacionada.ReconhecerEntididadesRelacionadas(cidade); MenuSettings.Menu(); break; default: break; } } }
/// <summary> /// Get the feeds for the specified facebook id (application ,event, group, page or user). /// </summary> /// <param name="facebook"></param> /// <param name="id"></param> /// <param name="limit"></param> /// <param name="offset"></param> /// <param name="until"></param> /// <param name="parameters"></param> /// <returns>Returns PostCollection.</returns> /// <remarks> /// type of id | returns /// ------------|------------------- /// Application| The application's wall. /// Event | The event's wall. /// Group | The group's wall. /// Page | The page's wall. /// User | The user's wall. Requires the read_stream permission to see non-public posts. /// </remarks> public static PostCollection GetFeeds(this Facebook facebook, string id, int?limit, int?offset, string until, IDictionary <string, string> parameters) { parameters = AppendPagingParameters(parameters, limit, offset, until); return(facebook.GetFeeds(id, parameters)); }
public void Init(Activity activity, Facebook fb) { Init(activity, fb, new String[] { }); }
/// <summary> /// Gets list of comments for the specified facebook id (album,link,note,photo,post,status message and video). /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="objectId">Id of the Facebook Graph Object.</param> /// <param name="parameters">The parameters.</param> /// <returns>Returns list of comments</returns> /// <remarks> /// type of id | returns /// ----------------|-------------------------------------- /// Album | The comments made on this album. /// Link | All of the comments on this link. /// Note | All of the comments on this note /// Photo | All of the comments on this photo. /// Post | All of the comments on this post. /// Status Message | All of the comments on this message. /// Video | All of the comments on this video. /// </remarks> public static CommentCollection GetComments(this Facebook facebook, string objectId, IDictionary <string, string> parameters) { return(facebook.GetConnections <CommentCollection>(objectId, "comments", parameters)); }
public static string[] UserLikes(this Facebook facebook, string userId, string[] objectIds) { AssertRequireAccessToken(facebook); if (objectIds == null) { throw new ArgumentNullException("userIds"); } if (userId.Equals("me()", StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("User ID cannot be me()", "userId"); } if (objectIds.Length == 0) { return new string[] { } } ; // return empty array of string. no need to query facebook. var query = new StringBuilder(); query.AppendFormat("SELECT object_id FROM like WHERE user_id={0} and (", userId); var i = 0; foreach (var objectId in objectIds) { if (i != 0) { query.Append(" OR "); } if (objectId.Equals("me()", StringComparison.OrdinalIgnoreCase)) { throw new ArgumentException("Object ID cannot contain me()", "objectIds"); } query.AppendFormat("object_id={0}", objectId); ++i; } query.Append(")"); var result = facebook.Query(query.ToString()); // json returned by fb in not a valid json, so we need to do some ugly hack before can use FacebookUtils.FromJson if (result.StartsWith("[")) { result = result.Substring(1, result.Length - 2); var objects = result.Split(','); var likedObjects = new List <string>(objectIds.Length); foreach (var obj in objects) { var jsonObj = FacebookUtils.FromJson(obj); likedObjects.Add(jsonObj["object_id"].ToString()); } return(likedObjects.ToArray()); } return(new string[] { }); }
void OnGUI() { switch (tipo) { case tipoGui.step1: if (GUI.Button(new Rect(10, 10, Screen.width - 20, Screen.height - 20), "Enter")) { Facebook.login("email,publish_actions,publish_stream"); tipo = tipoGui.step2; } break; case tipoGui.step3: GUI.Label(new Rect(Screen.width * 0.82F, Screen.height * 0.12F, 125, 125), "", foto); if (GUI.Button(new Rect(Screen.width - 190, Screen.height / 2 - 100, 170, 30), "User Information")) { Facebook.graphRequest("/me"); } if (GUI.Button(new Rect(Screen.width - 190, Screen.height / 2 - 60, 170, 30), "Get Status")) { Facebook.getLoginStatusdos(); } if (GUI.Button(new Rect(770, 385, 170, 30), "Send invitations")) { Facebook.uiAppRequest("Title Request", "I invite you to try this application"); } if (GUI.Button(new Rect(770, 385 + 35, 170, 30), "Post with Pop Up")) { Facebook.uiFeedRequest("http://www.google.com", "http://www.google.com/logos/2012/tsiolkovsky12-hp.jpg", "Resaltado - ..........", "Facebook desde la Web", "Descripcion..... ... ..... .... ... ....... ."); } if (GUI.Button(new Rect(770, 385 + 70, 170, 30), "Post without Pop Up")) { //string to, string message, string name, string description, string picture, string caption, string link Facebook.postear("me", "Post Message", "Name...", "Des", "http://www.google.com/logos/2012/tsiolkovsky12-hp.jpg", "Facebook Web Cap", "http://www.google.com"); } if (GUI.Button(new Rect(770, 385 + 105, 170, 30), "Post Video")) { Facebook.postearv("me", "Post Message", "Name...", "Des", "http://img.youtube.com/vi/9bZkp7q19f0/0.jpg", "Facebook Web Cap", "http://www.youtube.com/e/9bZkp7q19f0", "http://www.youtube.com/watch?v=9bZkp7q19f0"); } if (GUI.Button(new Rect(770, 385 + 140, 170, 30), "Friends")) { StartCoroutine(getInfoFriends(Facebook.getInfo("/me/friends?fields=id,name,gender,picture"))); } if (GUI.Button(new Rect(770, 384 + 175, 170, 30), "Post Photo")) { Facebook.photo("Message...", "http://a.lyecorp.com/marcador.jpg"); } break; } }
public static bool AmIAdminOfPage(this Facebook facebook, string pageId) { return(facebook.IsAdminOfPage(string.Empty, pageId)); }
/// <summary> /// Initializes a new instance of the <see cref="FacebookAuthWindow"/> class. /// </summary> /// <param name="facebook">The Facebook engine instance.</param> public FacebookAuthWindow(Facebook facebook) { InitializeComponent(); _facebook = facebook; }
static IProfile InitService(String serviceName) { CloudRail.AppKey = "[Your CloudRail Key]"; int port = 8082; String redirectUri = "http://localhost:" + port + "/"; IProfile service = null; switch (serviceName.ToLower()) { case "facebook": service = new Facebook( new LocalReceiver(port), "[Facebook Client Identifier]", "[Facebook Client Secret]", redirectUri, "someState" ); break; case "github": service = new GitHub( new LocalReceiver(port), "[GitHub Client Identifier]", "[GitHub Client Secret]", redirectUri, "someState" ); break; case "googleplus": service = new GooglePlus( new LocalReceiver(port), "[Google Plus Client Identifier]", "[Google Plus Client Secret]", redirectUri, "someState" ); break; case "heroku": service = new Heroku( new LocalReceiver(port), "[Heroku Client Identifier]", "[Heroku Client Secret]", redirectUri, "someState" ); break; case "instagram": service = new Instagram( new LocalReceiver(port), "[Instagram Client Identifier]", "[Instagram Client Secret]", redirectUri, "someState" ); break; case "linkedin": service = new LinkedIn( new LocalReceiver(port), "[LinkedIn Client Identifier]", "[LinkedIn Client Secret]", redirectUri, "someState" ); break; case "producthunt": service = new ProductHunt( new LocalReceiver(port), "[Product Hunt Client Identifier]", "[Product Hunt Client Secret]", redirectUri, "someState" ); break; case "slack": service = new Slack( new LocalReceiver(port), "[Slack Client Identifier]", "[Slack Client Secret]", redirectUri, "someState" ); break; case "twitter": service = new Twitter( new LocalReceiver(port), "[Twitter Client Identifier]", "[Twitter Client Secret]", redirectUri ); break; case "microsoftlive": service = new MicrosoftLive( new LocalReceiver(port), "[Windows Live Client Identifier]", "[Windows Live Client Secret]", redirectUri, "someState" ); break; case "yahoo": service = new Yahoo( new LocalReceiver(port), "[Yahoo Client Identifier]", "[Yahoo Client Secret]", redirectUri, "someState" ); break; } return(service); }
/// <summary> /// Gets the specified event. /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="eventId">The event id.</param> /// <param name="parameters">The parameters.</param> /// <returns> /// Returns the facebook event. /// </returns> public static Event GetEvent(this Facebook facebook, string eventId, IDictionary <string, string> parameters) { return(facebook.GetObject <Event>(eventId, parameters)); }
public void FacebookLogin() { #if UNITY_WEBPLAYER Facebook.login("user_about_me,publish_actions,publish_stream"); #endif }
private void btnGetMyInfo_Click(object sender, EventArgs e) { Facebook fb = new Facebook(txtAccessToken.Text); // using async method fb.GetAsync("/me", result => { // incase you are using async, // always check if it was successful. if (result.IsSuccessful) { // this prints out the raw json MessageBox.Show(result.RawResponse); // this mite be preferable - the generic version of the result var user = result.GetResponseAs <User>(); MessageBox.Show("Hi " + user.Name); } else { // exception is stored in result.Exception // u can extract the message using result.Exception.Message // or u can get raw facebook json exception using result.Response. MessageBox.Show("Error: " + Environment.NewLine + result.Exception.Message); } }); // you can also use synchronous version like below // Methods not containing Async are treated as synchronous. // you can either use generic version or non generic version //var user = fb.Get<User>("/me"); //MessageBox.Show("Hi " + user.Name); // non-generic version returns raw JSON string given by Facebook. //MessageBox.Show(fb.Get("/me")); // example for posting on the wall: //string resultPost = fb.Post("/me/feed", new Dictionary<string, string> // { // {"message", "testing from FacebookSharp."} // }); //MessageBox.Show(resultPost); // this result is the id of the new post // example for deleting //string resultDelete = fb.Delete("/id"); //MessageBox.Show(resultDelete); // you can also use Parameter Extensions // (make sure you add -> using FacebookSharp.Extensions; ) // https://graph.facebook.com/?fields=id,picture&ids=123741737666932,100001241534829&oauth_token=your_oauth_token. // var result = fb.Get(string.Empty, // new Dictionary<string, string>() // .SelectFields(new[] { "picture" }) // .SelectIds(new[] { "123741737666932", "100001241534829" }) // .SelectField("id")); // You can also do things like .Offset(2).LimitTo(3) and much more. // checkout ParameterExtensions.cs file // You can also use the old RestApi by calling GetUsingRestApi or GetUsingRestApiAsync fb.GetUsingRestApiAsync("status.get", new Dictionary <string, string>().LimitTo(1), callback => { if (callback.IsSuccessful) { MessageBox.Show(callback.RawResponse); } }); // You can also use the Facebook Query Language by calling Query or QueryAsync methods. fb.QueryAsync("SELECT name FROM user WHERE uid = me()", result => { if (result.IsSuccessful) { MessageBox.Show("Response using FQL: " + result.RawResponse); } }); }
public ActionResult FBcallback() { string email = Facebook.GetUserEmail(Request.QueryString["code"]); return(CallBack(email)); }
private static void FacebookGetInfo() { Facebook.graphRequest("/me/?fields=id,name,installed"); }
public void Parse(int id) { var lFeed = FeedService.GetFeed(id); if (lFeed == null) { return; } var rFeed = FeedService.GetRemoteFeed(lFeed.Url); if (rFeed == null) { lFeed.Updated = DateTime.Now; FeedService.UpdateFeed(lFeed); return; } lFeed.Articles = FeedService.GetArticles(lFeed.Id); var lTags = CacheClient.Default.GetOrAdd <List <Tag> > ("parsingLocalTags", CachePeriod.ForMinutes(15), () => FeedService.GetTagsByArticlesCount(100)); foreach (var rArticle in rFeed.Articles) { rArticle.Tags = GetArticleTags(rArticle, lTags); try { var lArticle = lFeed.Articles.Find(le => le.Name == rArticle.Name); if (lArticle == null) { rArticle.FeedId = lFeed.Id; rArticle.LikesCount = Facebook.GetNumberOfLikes(rArticle.Url) + Twitter.GetNumberOfTweets(rArticle.Url) + LinkedIn.GetNumberOfShares(rArticle.Url) + Google.GetNumberOfShares(rArticle.Url) + Reddit.GetNumberOfVotes(rArticle.Url); rArticle.Tags = GetArticleTags(rArticle, lTags); rArticle.Id = FeedService.InsertArticle(rArticle); rArticle.Feed = lFeed; LuceneSearch.AddUpdateIndex(rArticle); } } catch (Exception ex) { Mail.SendMeAnEmail("Error in insert article", "FeedId: " + lFeed.Id + " " + ex.ToString()); } } //validation not to import single article more than once var lArticles = FeedService.GetArticles(lFeed.Id); foreach (var rArticle in rFeed.Articles) { var lArticle = lArticles.Find(le => le.Name == rArticle.Name); if (lArticle == null) { //we have a problem Mail.SendMeAnEmail("Parse feed multiple articles will be inserted", "Local feedId: " + lFeed.Id); } } lFeed.Updated = DateTime.Now; FeedService.UpdateFeed(lFeed); }
private void OnSessionStateChanged(object sender, Facebook.Client.Controls.SessionStateChangedEventArgs e) { this.welcomeText.Opacity = (e.SessionState == FacebookSessionState.Opened) ? 0 : 100; this.contentPanel.Opacity = (e.SessionState == FacebookSessionState.Opened) ? 100 : 0; }
// Use this for initialization void Start() { Facebook.CreateListener(); FacebookListener.onSessionStatusChanged += OnFbSessionStatusChanged; hasSession = false; }
public FacebookIterator(Facebook social, Guid profileId, string type) { _facebook = social; _profileId = profileId; _type = type; }
/// <summary> /// Gets list of comments for the specified facebook id (album,link,note,photo,post,status message and video). /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="objectId">Id of the Facebook Graph Object.</param> /// <param name="limit">The limit.</param> /// <param name="offset">The offset.</param> /// <param name="until">The until.</param> /// <param name="parameters">The parameters.</param> /// <returns>Returns list of comments</returns> /// <remarks> /// type of id | returns /// ----------------|-------------------------------------- /// Album | The comments made on this album. /// Link | All of the comments on this link. /// Note | All of the comments on this note /// Photo | All of the comments on this photo. /// Post | All of the comments on this post. /// Status Message | All of the comments on this message. /// Video | All of the comments on this video. /// </remarks> public static CommentCollection GetComments(this Facebook facebook, string objectId, int?limit, int?offset, string until, IDictionary <string, string> parameters) { parameters = AppendPagingParameters(parameters, limit, offset, until); return(facebook.GetComments(objectId, parameters)); }
/// <summary> /// Writes the given comment on the given post. /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="objectId">Id of the object.</param> /// <param name="message">Comment Message.</param> /// <returns>Returns the id of the newly posted comment.</returns> public static string PostComment(this Facebook facebook, string objectId, string message) { return(facebook.PostComment(objectId, new Dictionary <string, string> { { "message", message } })); }
/// <summary> /// Writes the given comment on the given post. /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="objectId">Id of the object.</param> /// <param name="parameters">The parameters.</param> /// <returns>Returns the id of the newly posted comment.</returns> public static string PostComment(this Facebook facebook, string objectId, IDictionary <string, string> parameters) { var result = facebook.PutObject(objectId, "comments", parameters); return(FacebookUtils.FromJson(result)["id"].ToString()); }
/** Called when the activity is first created. */ protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); if (APP_ID == null) { Util.ShowAlert(this, "Warning", "Facebook Applicaton ID must be " + "specified before running this example: see Example.java"); } SetContentView(Resource.Layout.main); mLoginButton = (LoginButton)FindViewById(Resource.Id.login); mText = (TextView)FindViewById(Resource.Id.txt); mRequestButton = (Button)FindViewById(Resource.Id.requestButton); mPostButton = (Button)FindViewById(Resource.Id.postButton); mDeleteButton = (Button)FindViewById(Resource.Id.deletePostButton); mUploadButton = (Button)FindViewById(Resource.Id.uploadButton); mFacebook = new Facebook(APP_ID); mAsyncRunner = new AsyncFacebookRunner(mFacebook); SessionStore.Restore(mFacebook, this); SessionEvents.AddAuthListener(new SampleAuthListener(this)); SessionEvents.AddLogoutListener(new SampleLogoutListener(this)); mLoginButton.Init(this, mFacebook); mRequestButton.Click += delegate { mAsyncRunner.Request("me", new SampleRequestListener(this)); }; mRequestButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; mUploadButton.Click += async delegate { Bundle parameters = new Bundle(); parameters.PutString("method", "photos.upload"); URL uploadFileUrl = null; try { uploadFileUrl = new URL( "http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"); } catch (MalformedURLException e) { e.PrintStackTrace(); } try { HttpURLConnection conn = (HttpURLConnection)uploadFileUrl.OpenConnection(); conn.DoInput = true; await conn.ConnectAsync(); int length = conn.ContentLength; byte[] imgData = new byte[length]; var ins = conn.InputStream; await ins.ReadAsync(imgData, 0, imgData.Length); parameters.PutByteArray("picture", imgData); } catch (IOException e) { e.PrintStackTrace(); } mAsyncRunner.Request(null, parameters, "POST", new SampleUploadListener(this), null); }; mUploadButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; mPostButton.Click += delegate { mFacebook.Dialog(this, "feed", new SampleDialogListener(this)); }; mPostButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; }
/// <summary> /// Gets the specified event. /// </summary> /// <param name="facebook">The facebook.</param> /// <param name="eventId">The event id.</param> /// <returns> /// Returns the facebook event. /// </returns> public static Event GetEvent(this Facebook facebook, string eventId) { return(facebook.GetEvent(eventId, null)); }
/// <summary> /// Get the feeds for the specified facebook id (application ,event, group, page or user). /// </summary> /// <param name="facebook"></param> /// <param name="id"></param> /// <param name="parameters"></param> /// <returns>Returns Json string.</returns> /// <remarks> /// type of id | returns /// ------------|------------------------ /// Application| The application's wall. /// Event | The event's wall. /// Group | The group's wall. /// Page | The page's wall. /// User | The user's wall. Requires the read_stream permission to see non-public posts. /// </remarks> public static string GetFeedsAsJson(this Facebook facebook, string id, IDictionary <string, string> parameters) { return(facebook.GetConnections(id, "feed", parameters)); }
/// <summary> /// Handles the facebook return. /// </summary> private void HandleFacebookReturn() { var facebookAuth = new Facebook(); if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault(paramName: "code") != null) { var authorizationCode = YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault(paramName: "code"); var accessToken = facebookAuth.GetAccessToken(authorizationCode: authorizationCode, request: this.Request); if (accessToken.IsNotSet()) { this.Response.Write( s: string.Format( format: "{2} alert('{0}');window.location.href = '{1}'; {3}", YafContext.Current.Get <ILocalization>().GetText(text: "AUTH_NO_ACCESS_TOKEN"), YafBuildLink.GetLink(page: ForumPages.login).Replace(oldValue: "auth.aspx", newValue: "default.aspx"), ScriptBeginTag, ScriptEndTag)); return; } if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault(paramName: "state") != null && YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault(paramName: "state") == "connectCurrent") { string message; try { facebookAuth.ConnectUser(request: this.Request, parameters: accessToken, message: out message); } catch (Exception ex) { YafContext.Current.Get <ILogger>().Error(ex: ex, format: "Error while trying to connect the facebook user"); message = ex.Message; } if (message.IsSet()) { this.Response.Write( s: string.Format( format: "{2} alert('{0}');window.location.href = '{1}'; {3}", message, YafBuildLink.GetLink(page: ForumPages.forum).Replace(oldValue: "auth.aspx", newValue: "default.aspx"), ScriptBeginTag, ScriptEndTag)); } else { YafBuildLink.Redirect(page: ForumPages.forum); } } else { string message; try { facebookAuth.LoginOrCreateUser(request: this.Request, parameters: accessToken, message: out message); } catch (Exception ex) { YafContext.Current.Get <ILogger>() .Error(ex: ex, format: "Error while trying to login or register the facebook user"); message = ex.Message; } this.Response.Clear(); if (message.IsSet()) { this.Response.Write( s: string.Format( format: "{2} alert('{0}');window.location.href = '{1}';window.close(); {3}", message, YafBuildLink.GetLink(page: ForumPages.login).Replace(oldValue: "auth.aspx", newValue: "default.aspx"), ScriptBeginTag, ScriptEndTag)); } else { this.Response.Write( s: string.Format( format: "{1} window.location.href = '{0}';window.close(); {2}", arg0: YafBuildLink.GetLink(page: ForumPages.forum).Replace(oldValue: "auth.aspx", newValue: "default.aspx"), arg1: ScriptBeginTag, arg2: ScriptEndTag)); } } } else if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault(paramName: "error") != null) { // Return to login page if user cancels social login this.Response.Redirect(url: YafBuildLink.GetLink(page: ForumPages.login, fullUrl: true)); } else { // Authorize first this.Response.Redirect(url: facebookAuth.GetAuthorizeUrl(request: this.Request), endResponse: true); } }
protected void Page_Load(object sender, EventArgs e) { if (Facebook.EnableFacebookLogin) { if (Request.Cookies[Facebook.CookieID] != null) { if (Membership.GetUser() == null) { string accessToken = Request.Cookies[Facebook.CookieID].Value; //valider if (Facebook.GetUserInfo(accessToken) == null) { //Response.Write("Atoken invalid valid. Removing cookie.<br/>"); accessToken = null; Facebook.DeleteFacebookCookie(HttpContext.Current); } else { //Response.Write("Atoken valid, Logging in.<br/>"); //log ind long fbUID = Facebook.GetFacebookUserId(accessToken); object yafUID = Facebook.GetYafUser(fbUID); MembershipUser user = Membership.GetUser(yafUID); //Response.Write("fbuid: " + fbUID.ToString() + ", yafuid: " + yafUID + ".<br/>"); if (user != null) { FormsAuthentication.SetAuthCookie(user.UserName, false); Response.Redirect("default.aspx"); } else { //Response.Write("User not found.<br/>"); } } } else { /* * if (Request.Cookies[Facebook.CookieID] != null) * { * Response.Write(Request.Cookies[Facebook.CookieID].Value); * } */ } } else { //Response.Write("No cookie<br/>"); } } Control UserLanguage = LoadControl("newUserLanguage.ascx"); UserLanguagePlaceholder.Controls.Add(UserLanguage); if (Membership.GetUser() != null) { Control UserStartGame = LoadControl("newUserStartGame.ascx"); UserLeftPlaceholder.Controls.Add(UserStartGame); } else { Control UserRegister = LoadControl("newUserRegister.ascx"); UserLeftPlaceholder.Controls.Add(UserRegister); Control UserLogin = LoadControl("newUserLogin.ascx"); UserLeftPlaceholder.Controls.Add(UserLogin); } }
/** Called when the activity is first created. */ protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); if (APP_ID == null) { Util.ShowAlert (this, "Warning", "Facebook Applicaton ID must be " + "specified before running this example: see Example.java"); } SetContentView (Resource.Layout.main); mLoginButton = (LoginButton)FindViewById (Resource.Id.login); mText = (TextView)FindViewById (Resource.Id.txt); mRequestButton = (Button)FindViewById (Resource.Id.requestButton); mPostButton = (Button)FindViewById (Resource.Id.postButton); mDeleteButton = (Button)FindViewById (Resource.Id.deletePostButton); mUploadButton = (Button)FindViewById (Resource.Id.uploadButton); mFacebook = new Facebook (APP_ID); mAsyncRunner = new AsyncFacebookRunner (mFacebook); SessionStore.Restore (mFacebook, this); SessionEvents.AddAuthListener (new SampleAuthListener (this)); SessionEvents.AddLogoutListener (new SampleLogoutListener (this)); mLoginButton.Init (this, mFacebook); mRequestButton.Click += delegate { mAsyncRunner.Request ("me", new SampleRequestListener (this)); }; mRequestButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; mUploadButton.Click += async delegate { Bundle parameters = new Bundle (); parameters.PutString ("method", "photos.upload"); URL uploadFileUrl = null; try { uploadFileUrl = new URL ( "http://www.facebook.com/images/devsite/iphone_connect_btn.jpg"); } catch (MalformedURLException e) { e.PrintStackTrace (); } try { HttpURLConnection conn = (HttpURLConnection)uploadFileUrl.OpenConnection (); conn.DoInput = true; await conn.ConnectAsync (); int length = conn.ContentLength; byte[] imgData = new byte[length]; var ins = conn.InputStream; await ins.ReadAsync (imgData, 0, imgData.Length); parameters.PutByteArray ("picture", imgData); } catch (IOException e) { e.PrintStackTrace (); } mAsyncRunner.Request (null, parameters, "POST", new SampleUploadListener (this), null); }; mUploadButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; mPostButton.Click += delegate { mFacebook.Dialog (this, "feed", new SampleDialogListener (this)); }; mPostButton.Visibility = mFacebook.IsSessionValid ? ViewStates.Visible : ViewStates.Invisible; }
public DemoAppViewController(Facebook facebook) : base("DemoAppViewController", null) { _facebook = facebook; Initialize(); }
public static string GetAppAccessToken(Facebook.FacebookClient fbClient = null) { // TODO: Cache in DB via site settings rather than fetching every time? if (fbClient == null) { fbClient = new Facebook.FacebookClient(); } string appId = JPPConstants.SiteSettings.GetValue(JPPConstants.SiteSettings.FacebookAppId); string appSecret = JPPConstants.SiteSettings.GetValue(JPPConstants.SiteSettings.FacebookAppSecret); object appAccessTokenParams = new { client_id = appId, client_secret = appSecret, grant_type = "client_credentials" }; dynamic appAccessTokenObject = fbClient.Get("/oauth/access_token", appAccessTokenParams); string appAccessToken = appAccessTokenObject.access_token; return appAccessToken; }
public FacebookIterator(Facebook facebook, String type, String email) { this.facebook = facebook; this.type = type; this.email = email; }
private void OnPlacePickerLoadFailed(object sender, Facebook.Client.Controls.LoadFailedEventArgs e) { MessageBox.Show(e.Description, e.Reason, MessageBoxButton.OK); }
/// <summary> /// Handles the facebook return. /// </summary> private void HandleFacebookReturn() { var facebookAuth = new Facebook(); if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("code") != null) { var authorizationCode = YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("code"); var accessToken = facebookAuth.GetAccessToken(authorizationCode, this.Request); if (accessToken.IsNotSet()) { this.Response.Write( "{2} alert('{0}');window.location.href = '{1}'; {3}".FormatWith( YafContext.Current.Get <ILocalization>().GetText("AUTH_NO_ACCESS_TOKEN"), YafBuildLink.GetLink(ForumPages.login).Replace("auth.aspx", "default.aspx"), SCRIPTBEGINTAG, SCRIPTENDTAG)); return; } if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("state") != null && YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("state") == "connectCurrent") { string message; try { facebookAuth.ConnectUser(this.Request, accessToken, out message); } catch (Exception ex) { YafContext.Current.Get <ILogger>().Error(ex, "Error while trying to connect the facebook user"); message = ex.Message; } if (message.IsSet()) { this.Response.Write( "{2} alert('{0}');window.location.href = '{1}'; {3}".FormatWith( message, YafBuildLink.GetLink(ForumPages.forum).Replace("auth.aspx", "default.aspx"), SCRIPTBEGINTAG, SCRIPTENDTAG)); } else { YafBuildLink.Redirect(ForumPages.forum); } } else { string message; try { facebookAuth.LoginOrCreateUser(this.Request, accessToken, out message); } catch (Exception ex) { YafContext.Current.Get <ILogger>() .Error(ex, "Error while trying to login or register the facebook user"); message = ex.Message; } this.Response.Clear(); if (message.IsSet()) { this.Response.Write( "{2} alert('{0}');window.location.href = '{1}';window.close(); {3}".FormatWith( message, YafBuildLink.GetLink(ForumPages.login).Replace("auth.aspx", "default.aspx"), SCRIPTBEGINTAG, SCRIPTENDTAG)); } else { this.Response.Write( "{1} window.location.href = '{0}';window.close(); {2}".FormatWith( YafBuildLink.GetLink(ForumPages.forum).Replace("auth.aspx", "default.aspx"), SCRIPTBEGINTAG, SCRIPTENDTAG)); } } } else if (YafContext.Current.Get <HttpRequestBase>().QueryString.GetFirstOrDefault("error") != null) { // Return to login page if user cancels social login this.Response.Redirect(YafBuildLink.GetLink(ForumPages.login, true)); } else { // Authorize first this.Response.Redirect(facebookAuth.GetAuthorizeUrl(this.Request), true); } }
/// <summary> /// Post a message to the Facebook wall /// </summary> /// <param name="account">Wall account to post to</param> /// <param name="message">Message title to post</param> /// <param name="description">Message description to post</param> /// <param name="caption">Message caption to post</param> public void Facebook( Facebook.Account account, string message, string description, string caption) { PostFeed feed = new PostFeed(); feed.Message = message; // "I just released a new track!"; feed.Description = description; feed.Link = "http://www.trackprotect.com"; feed.Caption = caption; // "This track is protected by Trackprotect.com"; Facebook.PostService postService = new PostService(account); postService.Post(feed); }
void OnMouseDown() { Facebook.uiAppRequest("Flappity Duck!!", "I invite you to try this application"); }