/// <summary> /// Initializes inner controls. Post data are loaded when editing post. /// </summary> private void InitializeControls() { chkPostAfterDocumentPublish.Checked = false; string content = String.Empty; if (mBackCompatibilityValue.HasValue) { // Pre fill form with old data chkPostAfterDocumentPublish.Checked = mBackCompatibilityValue.Value.AutoPostAfterPublishing; content = mBackCompatibilityValue.Value.Template; } else if (!String.IsNullOrWhiteSpace(mDefaultValue)) { // Default content given as control's string Value content = mDefaultValue; } else if ((FieldInfo != null) && !String.IsNullOrWhiteSpace(FieldInfo.DefaultValue)) { // Default content from field info content = FieldInfo.DefaultValue; } tweetContent.Text = content; if (!chkPostAfterDocumentPublish.Checked) { publishDateTime.Value = DateTime.Now; } channelSelector.ObjectSiteName = SiteIdentifier; TwitterAccountInfo defaultAccountInfo = TwitterAccountInfoProvider.GetDefaultTwitterAccount(SiteIdentifier); if (defaultAccountInfo != null) { channelSelector.Value = defaultAccountInfo.TwitterAccountID; } ClearPostState(); urlShortenerSelector.SiteID = SiteIdentifier; urlShortenerSelector.Value = URLShortenerHelper.GetDefaultURLShortenerForSocialNetwork(SocialNetworkTypeEnum.Twitter, SiteIdentifier); chkPostAfterDocumentPublish.Visible = (Document != null); campaingSelector.Value = null; campaingSelector.ObjectSiteName = SiteIdentifier; if ((FieldInfo != null) && !FieldInfo.AllowEmpty) { // Post must be created because field doesn't allow an empty value chkPostToTwitter.Enabled = false; DisplayForm = true; } else { // Form is displayed if it is pre filled with old data DisplayForm = mBackCompatibilityValue.HasValue; } }
private void InitializeDropDownList() { UrlShortenerDropDownList.Items.Add(CreateDropDownListItem(URLShortenerTypeEnum.None)); foreach (URLShortenerTypeEnum shortener in URLShortenerHelper.GetAvailableURLShorteners(SiteID)) { UrlShortenerDropDownList.Items.Add(CreateDropDownListItem(shortener)); } if (SocialNetworkName != SocialNetworkTypeEnum.None) { URLShortenerTypeEnum defaultShortener = URLShortenerHelper.GetDefaultURLShortenerForSocialNetwork(SocialNetworkName, SiteID); UrlShortenerDropDownList.SelectedValue = Enum.GetName(typeof(URLShortenerTypeEnum), defaultShortener); } }
/// <summary> /// Initializes inner controls to its default state. /// </summary> private void InitializeControls() { chkPostAfterDocumentPublish.Checked = false; string content = String.Empty; if (!String.IsNullOrWhiteSpace(mDefaultValue)) { // Default content given as control's string Value content = mDefaultValue; } else if ((FieldInfo != null) && !String.IsNullOrWhiteSpace(FieldInfo.DefaultValue)) { // Default content from field info content = FieldInfo.DefaultValue; } txtPost.Text = content; txtPost.MaxLength = (int)LinkedInHelper.COMPANY_SHARE_COMMENT_MAX_LENGTH; if (!chkPostAfterDocumentPublish.Checked) { publishDateTime.Value = DateTime.Now; } companySelector.ObjectSiteName = SiteIdentifier; LinkedInAccountInfo defaultAccountInfo = LinkedInAccountInfoProvider.GetDefaultLinkedInAccount(SiteIdentifier); if (defaultAccountInfo != null) { companySelector.Value = defaultAccountInfo.LinkedInAccountID; } ClearPostState(); urlShortenerSelector.SiteID = SiteIdentifier; urlShortenerSelector.Value = URLShortenerHelper.GetDefaultURLShortenerForSocialNetwork(SocialNetworkTypeEnum.LinkedIn, SiteIdentifier); chkPostAfterDocumentPublish.Visible = (Document != null); campaingSelector.Value = null; campaingSelector.ObjectSiteName = SiteIdentifier; if ((FieldInfo != null) && !FieldInfo.AllowEmpty) { // Post must be created because field doesn't allow an empty value chkPostToLinkedIn.Enabled = false; DisplayForm = true; } }