Solved

how do i centralize service calls in another class and get the result back ?

Posted on 2010-09-01
6
357 Views
Last Modified: 2012-05-10
Hi,
I have a silverlight application that has to call services (WCF). Now I don't want to fill up my code-behind with stuff like this, but i want to centralize all my service calls in another class.
I know how to call a method in that other class that does the async call of the webservice. The webservice call completed event is also put in that class. But now I don't know how to get that info (result of the service call) back in my code behind file.
Can somebody show me an example ?
0
Comment
Question by:ippeter
  • 4
  • 2
6 Comments
 
LVL 9

Expert Comment

by:puru1981
ID: 33575595
make a service layer which consist of proxies of the WCF services.

then use them in your code behind.
0
 

Author Comment

by:ippeter
ID: 33575963
Hi pure1981,
what is a service layer ? And how to make it ?
Maybe an example or a link to more info on this ?

thanks,
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33576315
i mean that is a central place where all the service related configuration will sit. It is parallel to your BAL.

this will be a new project which will handle all the service related activities.
0
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:ippeter
ID: 33577022
I understand what you explain, but there is still one more thing i don't know how to do it.
When i call the other project who does the service stuff, how do i know when the service is completed.
Now i do the service calls in my code behind and i can handle the result immediately in the UI.
ex of how i do it now:
private void GetStatus()
{
            Max200Client proxi = new Max200Client();
             // Attach an event handler to the completed event
             proxi.GetStatusCompleted += new EventHandler<GetStatusCompletedEventArgs>(proxi_GetStatusCompleted);
                 // Start the web service call
                proxi.GetStatusAsync(statusLijstUniversal, statusLijstAudio, statusLijstTemp);
}

void proxi_GetStatusCompleted(object sender, GetStatusCompletedEventArgs e)
{
       // in here i can handle the result and fill in the UI.
}

But how do i know when the GetStatusCompleted event is done when i put this stuff in another project ? My webpage has to continue working, but when the Status is arrived sereral things has to update.
Hope you understand my issue here.
0
 
LVL 9

Expert Comment

by:puru1981
ID: 33577103
in that case i don't think you have choice.

0
 
LVL 9

Accepted Solution

by:
puru1981 earned 125 total points
ID: 33577111
because event should be always handled through controller and notified to view.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# HTTP GET method sample code 3 55
Eagerly loading related objects in entity framework 5 29
SqlDataBase 7 46
transaction in asp.net, sql server 6 30
Here I am going to explain creating proxies at runtime for WCF Service. So basically we use to generate proxies using Add Service Reference and then giving the Url of the WCF service then generate proxy files at client side. Ok, what if something ge…
To properly understand GitHub, let’s divide it into two words ‘Git’ and ‘Hub’. Git is basically a ‘Distribution Version Control’ (DVC) and ‘Source Code Management’ (SCM) system widely used by software programmers while Hub means the efficient centre…
The purpose of this video is to demonstrate how to set up the WordPress backend so that each page automatically generates a Mailchimp signup form in the sidebar. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now