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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:14:48+00:00 2026-06-13T07:14:48+00:00

I think this is a common and typical question from novices but I still

  • 0

I think this is a common and typical question from novices but I still don’t fully understand the given solutions.
I am writing a Windows Phone 7 application and I want to perform several HttpWebRequest where I submit POST data and set some headers. The response should be deserialized and then processed by the logic and/or UI layer.

Yes, Web communication is done in a asynchronous way for Silverlight apps. I got that. It works fine.

BUT: I want to decouple the communication handling from the UI resp. xaml.cs code.
I need to do the communication with HttpWebRequest because I need to modify headers etc.

What I want to do is the following:

  1. A button is clicked. Login/Username is provided to let’s say my communication layer. For example: LoginRequest(string username, string pwd)
  2. The comm. layer will execute the request and obtain the answer asynchronously, i.e. calling the callback LoginResponseCallback(IAsyncResult res)
  3. Okay, now I can handle the response, deserialize my retrieved JSON string into an object
  4. The object should be handed back to the UI to update the data. I know that I should use the Dispatcher.BeginInvoke method because the callback is not running on the UI thread.

But I still don’t know how I can pass the object from my communication layer to the UI.
I think the solution is very straightforward, like passing a delegate from the btnLogin_onClick(object sender, RoutedEventArgs e) to the LoginRequestmethod. Or maybe I need to work with lambdas?

I have a SendBasicRequest method in my communication layer, which sets the appropriate headers (e.g. ClientOS, LoginKey, VersionBuild etc.)
I want to call this method from several pages, so I want it to be decoupled in the communication layer.

Thanks in advance

  • 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-13T07:14:49+00:00Added an answer on June 13, 2026 at 7:14 am

    MVVM Light Toolkit provides a solid framework to use MVVM easily for WP7 apps.

    But just be aware, it requires some prereading to be able to fully understand the principles of the MVVM pattern and the frameworks based on MVVM.

    Some useful information which may guide you through the complexity. It helped me to decouple a lot of logic from the XAML and the code-behind file with Commands. To use ViewModels to handle the logic and also to run tasks easily async with the Async CTP (fully available in VS2012).

    WPF Apps With The Model-View-ViewModel Design Pattern helps you understand MVVM & DataBinding

    Getting Started with the MVVM Pattern in Silverlight Applications uses IoC to inject an intermediary service agent, who fetches the data async

    Windows Phone Mango: Getting Started with MVVM in 10 Minutes nice and easy to understand how to use MVVM and Commands

    Commands in MVVM (Apex framework) features Asynchronous Commands etc.

    Async / Await

    Helps you a lot to do asynchronous operations in the background and getting notified when tasks are done. You use async/await keywords (new in VS2012 or the Async CTP).

    Asynchronous Programming with Async and Await (C# and Visual Basic)

    Async CTP – Task based asynchronous programming for Windows Phone

    MVVMLight and Async

    I hope this information may help you. MVVM wasn’t simple for me, especially because I was not much into .NET and DataBinding. So the curve at the beginning was very steep. But once you understand the principles it REALLY makes your life easier 😉

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

Sidebar

Related Questions

well, i think this is a very common question but my question will focus
I think this is a fairly common question: how to put my business logic
this question is about style, because i think this is a very common problem
I think this could be a very easy question for you. But I have
(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a rather common question. So I have used twitter bootstrap
I think this is possible in Common Lisp (through overloading setf ), but not
I think this is probably a fairly common but I haven't found a match
I think this is going to be a vague question because I don't know
I think this is a simple and a silly question. I have included a

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.