Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:25:04+00:00 2026-05-16T15:25:04+00:00

I have Silverlight application that retrieves data from the database through a WCF Service.

  • 0

I have Silverlight application that retrieves data from the database through a WCF Service. What my application have to do is to display the referent data anytime a button gets MouseOvered. I did it in a way that that when a button gets MouseOvered, I called my service and retrieved the data, but it generetad a big delay. Now, I think that another way should be making a list of all objects from the table, and just searching the id in the list when the action is triggered. I started coding, but it resulted in fail (and such an ugly piece of code).

My Working Code

private void MouseOverHarbor(object sender, RoutedEventArgs e)
{
    Ellipse thisPath = (Ellipse)sender;
    DataRetrieverReference.DataRetrieverClient webService = new DataRetrieverReference.DataRetrieverClient();
    webService.GetDataCompleted += new EventHandler<DataRetrieverReference.GetDataCompletedEventArgs>(webService_GetDataCompleted);
    webService.GetDataAsync(Convert.ToInt32(thisPath.DataContext));
}

void webService_GetDataCompleted(object sender, WebPortos.DataRetrieverReference.GetDataCompletedEventArgs e)
{
    NameField.Text = e.Result.Name;
    CityField.Text = e.Result.City;
    StateField.Text = e.Result.State;
    CompanyField.Text = e.Result.Company;
}

What I tried to do

private List<vwPortos_SEP> harborList;
private int counter;

public Brasil()
{
    InitializeComponent();
    this.harborList = new List<vwPortos_SEP>();

    DataRetrieverClient webService = new DataRetrieverClient();
    webService.GetCounterCompleted += new EventHandler<GetCounterCompletedEventArgs>(webService_GetCounterCompleted);
    webService.GetCounterAsync();
    webService.GetDataCompleted += new EventHandler<DataRetrieverReference.GetDataCompletedEventArgs>(webService_GetDataCompleted);

    for (int i = 0; i < counter; i++)
    {                                
        webService.GetDataAsync(i);
    }               

}

void webService_GetDataCompleted(object sender, WebPortos.DataRetrieverReference.GetDataCompletedEventArgs e)
{
    MessageBox.Show("It works!");//It doesn't work!
    try
    {
        this.harborList.Add(e.Result);
    }
    catch (Exception exc)//It doesn't even throw ecxpetions, this method is never reached.
    {
        MessageBox.Show(exc.Message);
        MessageBox.Show(exc.InnerException.Message);
    }
}

Maybe I’m missing something really big, but my webService_GetDataCompleted method is never reached.

Thanks in advance folks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:25:05+00:00Added an answer on May 16, 2026 at 3:25 pm

    Is this call:

    webService.GetCounterAsync();
    

    used to set counter?

    If so you’re not letting it finish before looping with counter as the termination value. It’s highly likely that counter is still 0 so your GetDataAsync calls aren’t happening.

    for (int i = 0; i < counter; i++)
    {                                
        webService.GetDataAsync(i);
    }
    

    Move this code into your webService_GetCounterCompleted method, so your code becomes:

    public Brasil()
    {
        InitializeComponent();
        this.harborList = new List<vwPortos_SEP>();
    
        DataRetrieverClient webService = new DataRetrieverClient();
        webService.GetCounterCompleted +=
            new EventHandler<GetCounterCompletedEventArgs>(webService_GetCounterCompleted);
        webService.GetCounterAsync();
    }
    
    void webService_GetCounterCompleted(object sender,
             WebPortos.DataRetrieverReference.GetCounterCompletedEventArgs e)
    {
        webService.GetDataCompleted +=
         new EventHandler<DataRetrieverReference.GetDataCompletedEventArgs>(webService_GetDataCompleted);
    
        for (int i = 0; i < counter; i++)
        {                                
            webService.GetDataAsync(i);
        }
    }
    

    Plus your existing webService_GetDataCompleted method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Silverlight application that needs to retrieve some data from my database.
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I have a Silverlight 2 application that is consuming a WCF service. As such,
I have a silverlight 2 beta 2 application that accesses a WCF web service.
I have a Silverlight application that is built from a set of Silverlight class
I have an application that uses Silverlight and ASP.NET as a front-end. It retrieves
my WCF service it's used by a Silverlight application to retrieve data. I've no
I have a Silverlight application which has on it a Canvas. On that Canvas,
I have written a WPF application that I want to port to Silverlight 2.
I have an MVC application that among other things contains a small Silverlight menu

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.