views:

12

answers:

0

A wcf service accessing an SQL database:

    private void GetImagesDataFromDB(int imageIndex, int **extraParam**)
    {
        ServiceReference1.DbServiceClient webService =
            new ServiceReference1.DbServiceClient();
        webService.GetSeriesImagesCompleted += new EventHandler<ServiceReference1.GetSeriesImagesCompletedEventArgs>(webService_GetSeriesImagesCompleted);
        webService.GetSeriesImagesAsync(imageIndex);
    }

the GetImageSeriesCompleted EventHandler is here:

    void webService_GetSeriesImagesCompleted(object sender,
        TheApp.ServiceReference1.GetSeriesImagesCompletedEventArgs e)
    {
        if (e.Result != null)
        {
            if (**extraParam** == 1)
            {
                lstImages = e.Result.ToList();

            }
            else 
            {
                // do something else
            }
        }
    }

The service itself is like this:

   public List<Image> GetSeriesImages(int SeriesId)
    {
        DataClassDataContext db = new DataClassDataContext();
        var images = from s in db.Images
                     where s.SeriesID == SeriesId
                     select s;
        return images.ToList();
    }

What is the best way to pass the extraParam to the service completed EventHandler? I need this to direct my service return to a proper UI control.

Thanks.