Answer the question
In order to leave comments, you need to log in
Best Practice for Handling Post Requests in windows phone (silverlight)
I want to ask how you usually implement the architecture of Post request processing in your mobile applications (everything is almost the same in normal silverlite applications). Because we are forced to make all calls “very” multi-threaded, questions arise about building an infrastructure for data exchange.
A. Application UI
B. Creating an HttpWebRequest
C. Method for BeginGetRequestStream
D. Method for BeginGetResponse
There are several cases that I want to discuss:
1. Passing additional parameters from B to C and D
2. Updating A from D
3. Removing work B, C, G into a separate dll and organization of data exchange with A
As I have now:
1. I use IAsyncResult.State to pass a structure into which I pack everything I need
2. use this.Dispatcher.BeginInvoke(delegate{...});
3. I planned to make a ViewModel for the page, which I would update from G. The question is how to tell the UI that it's time to reload and take all the data from the ViewModel.
I would be grateful for your recipes for making this porridge. And then my version does not seem to me quite beautiful and convenient)
Answer the question
In order to leave comments, you need to log in
I prepare like this:
There is a page (View) and a model (ViewModel), a client is used for requests with methods of approximately the following signature:
void LoadSomeData<T>(object request, Action<Response, T> onLoad, Action<ErrorEventArgs<T>> onError = null, T userState = null)
we are forced to make all calls "very" multi-threaded
Good point. Everything would be much easier if MS were allowed to decide for themselves where to apply multithreading ... And since they went down this path, then they need to complicate further, namely, use Reactive Extensions.
That is, if you want everything to be architecturally correct, as MS intended, then study Rx. But I warn you - it will take at least a week to study them + get ready to change the paradigm of thinking.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question