Hi,
I am not sure what is your problem here. Tweetinvi provides 2 set of methods, async and synchronous.
Now I have to admit that some of the methods does not have their async equivalent.
But if you need an operation to be run another why don't you just simply do so?
Now you need to understand the credentials system between threads.
As you are probably aware each thread uses a distinct Credentials object.
It means that invoking
Though when a thread is created, Tweetinvi will initialize the ThreadCredentials to the value stored in
Tweetinvi async methods are ThreadSafe. Now if you want to execute your code and ensure that your credentials are ThreadSafe it is a good idea to set the credentials at each start of a new Thread.
If you need more help concerning Multi-Threading I will need some piece of code.
Cheers,
Linvi
I am not sure what is your problem here. Tweetinvi provides 2 set of methods, async and synchronous.
Now I have to admit that some of the methods does not have their async equivalent.
But if you need an operation to be run another why don't you just simply do so?
Task.Factory.StartNew(() =>
{
var user = User.GetLoggedUser();
Console.WriteLine(user);
});
As you are probably aware each thread uses a distinct Credentials object.
It means that invoking
TwitterCredentials.SetCredentials
in one thread will not affect the other threads.Though when a thread is created, Tweetinvi will initialize the ThreadCredentials to the value stored in
TwitterCredentials.ApplicationCredentials
.Tweetinvi async methods are ThreadSafe. Now if you want to execute your code and ensure that your credentials are ThreadSafe it is a good idea to set the credentials at each start of a new Thread.
Task.Factory.StartNew(() => { // Ensuring the credentials information of the Thread TwitterCredentials.SetCredentials("", "", "", ""); var user = User.GetLoggedUser(); Console.WriteLine(user); });
Cheers,
Linvi