public override void SyncChanges() { EnsureChildControls(); WriteOnWall webPart = WebPartToEdit as WriteOnWall; if (webPart != null) { txtAuthCode.Text = webPart.OAuthCode; txtAuthClientID.Text = webPart.OAuthClientID; txtAuthClientSecret.Text = webPart.OAuthClientSecret; txtAuthRedirectUrl.Text = webPart.OAuthRedirectUrl; if (chkShowUserName.Visible) { chkShowUserName.Checked = webPart.EnableShowUserName; } if (webPart.PostOnProfile) { rdoBtnListPostLocation.Items.FindByValue("postToYourWall").Selected = true; pnlPropertyPostAsWhat.Attributes["style"] = "display:none"; } else if (webPart.PostOnGroupWall) { rdoBtnListPostLocation.Items.FindByValue("postToGroupWall").Selected = true; pnlPropertyPostAsWhat.Attributes["style"] = "display:block"; } else { rdoBtnListPostLocation.Items.FindByValue("postToPageWall").Selected = true; pnlPropertyPostAsWhat.Attributes["style"] = "display:block"; } txtPageID.Text = webPart.OAuthPageID; if (webPart.PostAsPage) { rdoBtnListPostAsWhat.Items.FindByValue("postAsPage").Selected = true; } else { rdoBtnListPostAsWhat.Items.FindByValue("postAsThisUser").Selected = true; } } }
public override bool ApplyChanges() { EnsureChildControls(); WriteOnWall webPart = WebPartToEdit as WriteOnWall; if (webPart != null) { webPart.OAuthCode = txtAuthCode.Text; webPart.OAuthClientID = txtAuthClientID.Text; webPart.OAuthClientSecret = txtAuthClientSecret.Text; webPart.OAuthRedirectUrl = txtAuthRedirectUrl.Text; webPart.UserID = txtUserID.Text.Trim(); webPart.ShowHeader = chkShowHeader.Checked ? true : false; webPart.ShowHeaderImage = chkShowHeaderImage.Checked ? true : false; //checking for sites with anonymous access and setting show user name property if (chkShowUserName.Visible) { webPart.EnableShowUserName = chkShowUserName.Checked; } else { webPart.EnableShowUserName = false; } //check if posting to your wall or page's wall if (rdoBtnListPostLocation.SelectedItem.Value.Equals("postToYourWall")) { webPart.PostOnProfile = true; webPart.PostOnGroupWall = false; pnlPropertyPostAsWhat.Attributes["style"] = "display:none"; } else if (rdoBtnListPostLocation.SelectedItem.Value.Equals("postToGroupWall")) { webPart.PostOnProfile = false; webPart.PostOnGroupWall = true; pnlPropertyPostAsWhat.Attributes["style"] = "display:block"; } else { webPart.PostOnProfile = false; pnlPropertyPostAsWhat.Attributes["style"] = "display:block"; } //setting facebook page id given by the user webPart.OAuthPageID = txtPageID.Text; //Post as Current User if the post is to be posted at the Groups wall if (!webPart.PostOnGroupWall) { //check if posting as this user or as page if (rdoBtnListPostAsWhat.SelectedItem.Value.Equals("postAsPage")) { webPart.PostAsPage = true; } else { webPart.PostAsPage = false; } } else { webPart.PostAsPage = false; } } return(true); }