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

  • Home
  • SEARCH
  • 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 1094099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T23:55:28+00:00 2026-05-16T23:55:28+00:00

A Windows Phone application referencing a dll(another class library project). There is an asynchronous

  • 0

A Windows Phone application referencing a dll(another class library project). There is an asynchronous webrequest in the dll to request a server and parse the response.

Click event of a button in the main page of WinPhone application calls the asynchronous method of referenced dll.The callback method raises an event when the response is received and parsed. Now when event raises I have the parsed object till HTTPcommunication layer. Simply how to show a message box with this result in the UI when HTTPcommunication module is done with its work.

public class HTTPRequester
{
    public delegate void ResponseReceievedAndParsedDelegate(HTTPRequester eventRaiser, object result);
    public event ResponseReceievedAndParsedDelegate ResponseReceivedAndParsed;

    public void GetUserInformation(string userid)
    {

        HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;
        request.Credentials = new NetworkCredential("uid", "pwd");
        request.Method = "GET";
        request.Accept = "application/json";
        object data = new object();
        RequestState state = new RequestState(request, data);
        IAsyncResult asr = request.BeginGetResponse(new AsyncCallback(RequesterCallback), state);


    }

    void RequesterCallback(IAsyncResult result)
    {
        RequestState state = (RequestState)result.AsyncState;
        WebRequest request = (WebRequest)state.Request;
        HttpWebResponse response =(HttpWebResponse)request.EndGetResponse(result);

        Stream s = response.GetResponseStream();
        StreamReader readStream = new StreamReader(s);
        string dataString = readStream.ReadToEnd();

        response.Close();
        s.Close();
        readStream.Close();



        HTTPResponseParser grp = new HTTPResponseParser();
        UserInfo ui = grp.ParseUserInformation(dataString );
        state.Response = ui;

        if (ResponseReceivedAndParsed != null)
        {
            ResponseReceivedAndParsed(this, ui);
        }
    }
}



      (asynchronous)

MainUI——>HTTCommunicator———>Server

MainUI HTTPCommunicator<——–Server

My problem is how to make the missing link to pass the response from HTTPCommunicator back to Main UI.

Hope I didn’t confuse you guys.
Could anyone point to some code sample,if this can be done with Dispatcher.

  • 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-16T23:55:29+00:00Added an answer on May 16, 2026 at 11:55 pm

    In UI cerate method:

    private void HandleMessage(HTTPRequester eventRaiser, object result)
    {
       UserInfo ui = (UserInfo)result;
       //show message
    }
    

    After creating HttpRequester attach to its event:

    HttpRequester xxx = new ...
    xxx.ResponseReceivedAndParsed += new ResponseReceievedAndParsedDelegate(HandleMessage);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need Windows Phone application to upload files to a web server using the
I'm developing a Windows Phone application. Is there anyway to animate transition between phone
I've cobbled together a Windows Class Library (Called MPC_Core) using .NET 4, I'm referencing
I've Started developing Windows Phone application. Creating a new project causes the exception below
I have a Windows Phone application which gets data from a SQL server with
I have a Windows Phone 7 application (Silverlight-based) that sends a web request and
I am creating a windows phone application, which need to store some data in
In my Windows Phone application I need to accept an untrusted certificate by default
I am developing a windows phone application. The webclient does not fire as I
I have a windows phone application and I need to add a user control

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.