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 8775831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:54:10+00:00 2026-06-13T18:54:10+00:00

In my silverlight mvvm application i am using wcf service to fill listbox which

  • 0

In my silverlight mvvm application i am using wcf service to fill listbox which is taking time to load so i need to use async and await in that. how can i use it in the bellow code.

my code in view model:

    private void GetLanguage()
    {
        ServiceAgent.GetLanguage((s, e) =>Language = e.Result);
    }

my code in service agent

    public void GetLanguage(EventHandler<languageCompletedEventArgs> callback)
    {
        _Proxy.languageCompleted += callback;
        _Proxy.languageAsync();
    }

Can anyone help me

  • 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-06-13T18:54:11+00:00Added an answer on June 13, 2026 at 6:54 pm

    You must use TaskCompletionSource to convert EAP (event asynchronous model) to TAP (task asynchronous model). First, add new method to your ServiceAgent (you can create this even as an extension method):

    public Task<string> GetLanguageAsync(EventHandler<languageCompletedEventArgs> callback)
    {
        var tcs = new TaskCompletionSource<string>();
        EventHandler<languageCompletedEventArgs> callback;
        callback = (sender, e) =>
        {
            _Proxy.languageCompleted -= callback;
            tcs.TrySetResult(e.Result);
        };
    
        _Proxy.languageCompleted += callback;
        _Proxy.languageAsync();
    
        return tcs.Task;
    }
    

    TCS will create a task which you can await then. By using the existing model, it will bridge the gap and make it consumable with async/await. You can now consume it in the view model:

    private void GetLanguage()
    {
        Language = await ServiceAgent.GetLanguageAsync();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have application have been written in Silverlight using MVVM pattern. We need to
I'm Using SIlverlight 4.0 application with MVVM Architecture using RIA Service I'm Calling Multiple
we have developed an intranet application with Silverlight 4 using MVVM with PRISM. Up
I'm using mvvm light to build a Silverlight application. Is there a code snippet
I've got this Silverlight Prism application that is using MVVM. The model calls a
I'm building Silverlight applicaitions using Prism and MVVM. When calling WCF services on your
I'm creating a Silverlight 3.0 MVVM application using Silverlight.FX but my View is actually
I have a question on using MVVM within a Silverlight application I am developing.
I'm developing a Silverlight WP7 app using MVVM Light Toolkit which initially works properly.
Hi I have a silverlight MVVM application using MVVM light. When I open the

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.