-1
は私の二つの機能です:誤差はここ
public void SetCompanies()
//set the Companies table from Shret.net DataBase
{
try
{
WebClient webClient = new WebClient();
Uri uri = new Uri("http://api.sherut.net/?method=Company");
webClient.OpenReadCompleted += new OpenReadCompletedEventHandler(webClient_OpenReadCompleted);
try
{
webClient.OpenReadAsync(uri);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
void webClient_OpenReadCompleted(object sender, OpenWriteCompletedEventArgs e)
{
try
{
DataContractJsonSerializer serializer = null;
var companies = (Companies)serializer.ReadObject(e.Result);
foreach (Company c in companies.data)
{
MessageBox.Show(c.Name + " " + c.CompanyID);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
、これは私が取得エラーです:
'webClient_OpenReadCompleted' の「いいえ過負荷が 「System.Net.OpenReadCompletedEventHandlerを委任一致しません'"
なぜこの機能の後にハンドラを書いたのかわかりません...... dvance!
ありがとうございました!私は気づかなかった.... – thechmodmaster