I have this small code on c# .NET which publish tweets and shows timeline of twitter using tweetinvi . And I'd like to autoupdate timeline whenever the tweet is sent. Can anyone advice how to do it with event? Thanks for answers.
private void button1click(object sender, EventArgs e)
{
if (richTextBox1.Text != "")
{
Tweet.PublishTweet(richTextBox1.Text);
MessageBox.Show("Your tweet was sent!", "Important Message");
}
else
{
MessageBox.Show("You need to write something!", "Important Message");
}
}
private void Timeline_GetHomeTimeline(object sender, EventArgs e)
{
var loggedUser = User.GetLoggedUser();
string x = "";
var homeTimelineTweets = loggedUser.GetHomeTimeline();
foreach (var tweet in homeTimelineTweets)
{
x += tweet.Text + Environment.NewLine;
}
richTextBox2.Text = x;
}