0

Silverlightアプリケーションには、2つの関数があります
。1つ目は次のとおりです。

private void LoadData()
        {
            ServiceReference2.Service1Client webService = new ServiceReference2.Service1Client();
            webService.GetContentCompleted += new EventHandler<ServiceReference2.GetContentCompletedEventArgs>(webService_GetContentCompleted);
            webService.GetContentAsync();

        }

2つ目:

private void webService_GetContentCompleted(object sender, ServiceReference2.GetContentCompletedEventArgs e)
        {
            IEnumerable<ServiceReference2.MediaContent> list = e.Result as IEnumerable<ServiceReference2.MediaContent>;
            dataGrid1.ItemsSource = list;
        }

listプロジェクト内の他の機能からどのように取得できますか?

4

1 に答える 1

1

これはあなたが探しているものですか?

    private void LoadData()
    {
        ServiceReference2.Service1Client webService = new ServiceReference2.Service1Client();
        webService.GetContentCompleted += new EventHandler<ServiceReference2.GetContentCompletedEventArgs>(webService_GetContentCompleted);
        webService.GetContentAsync();
    }

    private void webService_GetContentCompleted(object sender, ServiceReference2.GetContentCompletedEventArgs e)
    {
        IEnumerable<ServiceReference2.MediaContent> list = e.Result as IEnumerable<ServiceReference2.MediaContent>;
        dataGrid1.ItemsSource = list;

        ThirdMethod(list);
    }

    private void ThirdMethod(IEnumerable<ServiceReference2.MediaContent> list)
    {
        something = list;
    }
于 2012-06-21T17:35:53.960 に答える