Not able to access Application.DefaultWorkItem

Topics: CAB & Smart Client Software Factory
Aug 30, 2005 at 7:34 PM
originally posted by: Raju_Saltriver

Dear All,

Please help me.
I have four different modules in my application. And one Shell application loads all that modules. I want to store some objects in application state. So all four modules can access that objects and can chagne the value of that objects. Right now I am trying to store it in the State of Application.DefualtWorkItem. But I am not able to access the Application.DefaultWorkItem from the other workitem or controller. Can anybody helps me how can i access the State of DefaultWorkItem or is there any other way to share the state of the object in differenent applications.

Please Please Please help me.................

Thanks in advance
Rajul Patel
Aug 31, 2005 at 7:05 AM
originally posted by: DLorenz

Well, in the Program.cs, make sure you have:

Host.AddService(typeof(IStatePersistenceService), new IsolatedStorageStatePersistenceService());

Then in the workitems you want to have access to the storage, add these lines at the top under the workitem class:

private IStatePersistenceService persistenceService = null;

I am not sure if this is what you want, but then in the methods you want to use it, you can call:

State temp = persistenceService.Load(new Guid("SomeGuid"));

Hopefully, you can get what you are looking for from that State. Though, you if you make changes, you will probably have to call:


Let me know if this works! :)