Hello everyone!
i implemeted
C# Get Only Certian Text From Wiki Page?[
^] to download all the text from a wiki search( i am using the wiki api to do this) now the problem is that i was using the DownloadString method, and when its called the UI thread freezes up until the string is downloaded(and if the net is slow it will sit there for a while). So in order to solve this i need to use the DownloadStringAsync method but i can't figure out how to use it
here is the original code i am currently using:
public void WikiSearchEngine(string SearchInput)
{
var webClient = new WebClient();
string pageSourceCode = webClient.DownloadString("http://en.wikipedia.org/w/api.php?action=opensearch&search=" + SearchInput);
}
here is what i came up with inorder to try to use the Async version of this method:
public void WikiSearchEngine2(string SearchInput)
{
var webClient = new WebClient();
string StringToConvert = "http://en.wikipedia.org/w/api.php?action=opensearch&search=" + SearchInput;
Uri StringToUri = new Uri(StringToConvert);
string pageSourceCode = webClient.DownloadStringAsync(StringToUri);
}
now the problem is that VS gives me an error saying: Cannot implicitly convert type 'void' to 'string'
so what am i doing wrong?
i have already looked at the reference for this method and it didn't really help.
thank you for your help in advance,
MasterCodeon