private void button_send_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(autoCompeteTextbox_post.textBoxContent.Text)) { Account account = combobox_accounts.SelectedItem as Account; if (account != null) { AppNetDotNet.Model.Entities entities = null; string toBePostedText = autoCompeteTextbox_post.textBoxContent.Text; if (autoCompeteTextbox_post.MarkdownLinksInText.Count() > 0) { entities = new AppNetDotNet.Model.Entities(); entities.links = new List <AppNetDotNet.Model.Entities.Link>(); entities.hashtags = null; entities.mentions = null; foreach (KeyValuePair <string, string> link in autoCompeteTextbox_post.MarkdownLinksInText) { AppNetDotNet.Model.Entities.Link linkEntity = new AppNetDotNet.Model.Entities.Link(); linkEntity.text = link.Value; linkEntity.url = link.Key; int startPosition = toBePostedText.IndexOf(string.Format("[{0}]({1})", linkEntity.text, linkEntity.url)); linkEntity.pos = startPosition; linkEntity.len = linkEntity.text.Length; toBePostedText = toBePostedText.Replace(string.Format("[{0}]({1})", linkEntity.text, linkEntity.url), linkEntity.text); entities.links.Add(linkEntity); } } if (account.send_post(toBePostedText, path_to_be_uploaded_image, entities: entities)) { AppController.last_used_account = account; Close(); } } } }
private void button_send_Click(object sender, RoutedEventArgs e) { if (!string.IsNullOrEmpty(autoCompeteTextbox_post.textBoxContent.Text)) { Account account = combobox_accounts.SelectedItem as Account; if (account != null) { AppNetDotNet.Model.Entities entities = null; string toBePostedText = autoCompeteTextbox_post.textBoxContent.Text; if (autoCompeteTextbox_post.MarkdownLinksInText.Count() > 0) { entities = new AppNetDotNet.Model.Entities(); entities.links = new List<AppNetDotNet.Model.Entities.Link>(); entities.hashtags = null; entities.mentions = null; foreach (KeyValuePair<string, string> link in autoCompeteTextbox_post.MarkdownLinksInText) { AppNetDotNet.Model.Entities.Link linkEntity = new AppNetDotNet.Model.Entities.Link(); linkEntity.text = link.Value; linkEntity.url = link.Key; int startPosition = toBePostedText.IndexOf(string.Format("[{0}]({1})",linkEntity.text, linkEntity.url)); linkEntity.pos = startPosition; linkEntity.len = linkEntity.text.Length; toBePostedText = toBePostedText.Replace(string.Format("[{0}]({1})", linkEntity.text, linkEntity.url), linkEntity.text); entities.links.Add(linkEntity); } } if (account.send_post(toBePostedText, path_to_be_uploaded_image, entities:entities)) { AppController.last_used_account = account; Close(); } } } }