Silverlight and application status

I have a Silverlight application that should always know which client (domain object) is currently loaded. Only one can be loaded at a time. If the Client is NULL, the Client is not currently loading. Or you left the Client. I will have 3 more states of type Customer. So...

What is the best way to store application state in a Silverlight application?

1) add public properties to the App class (App.xaml.cs)
2) there is a state object that you can update as a singleton device through your IoC container. add public objects to this object 3) any other ideas?

+4
source share
3 answers

My vote will be for your second option to have a Single Single Single object. If you use MVVM and the Silverlight Toolkit, then you have one built right into your MainViewModel, which is statically and statically initialized in the ViewModelLocator. This would be an ideal place to achieve the desired result.

+1
source

I would choose the second option.

He is currently working on a Silverlight application that stores the state data of domain objects.

We have what was called the ApplicationManager, which is allowed through the IoC to store reference data and domain data. There may be a better term than ApplicationManager, but to date no standard naming convention has been found.

The concept works well, all of our view models have access to the ApplicationManager, so everything we pass is the identifier of the object when another part of the application needs to take action.

If you have asynchronous operations that update data, you need to remember to maintain compatibility with the user interface and data warehouse

+1
source

I had a similar problem. When I use MEF, I created a service that stores data. You can import the service where you need it and have access to the specified objects. (So ​​it looks like 2)

+1
source

All Articles