2

Closed

AppSettingsStorageMechanism.Delete should not delete entry in isolated storage

description

The current realization of AppSettingsStorageMechanism.Delete method deletes entry by the key. Probably body of this method should be empty. The isolated storage entry should live forever.
For instance you have a SecondViewModel that could be opened from MainViewModel and corresponding SecondViewModelStorage : StorageHandler<SecondViewModel>. In Configure method you specify that Comment property should be stored in application settings:
public override void Configure()
    {
        Property(aModel => aModel.Comment).InAppSettings();
    }
First scenario:
  1. Navigate to SecondPageView from MainPageView and set some value to Comment field.
  2. Navigate back to MainPageView and then navigate out of application (press back button again).
  3. Open application one more time and navigate ro SecondPageView.
  4. Notice Comment field has value.
Second scenario:
  1. Navigate to SecondPageView from MainPageView and set some value to Comment field.
  2. Navigate back to MainPageView.
  3. Navigate to SecondPageView again.
  4. Notice Comment field is blank.
If a value survive application restart it should survive navigation during same application session.
Closed Jan 10 at 8:36 PM by tibel
It depends on what scenario you want ot have in your application. Caliburn.Micro is possible to help you with both cases, but it isn't done automatically.

You still have to do some coding to get what you want.

comments

tibel wrote Jan 7 at 6:58 PM

Save() is only called when the application is Paused, Deactivated or Closed.
In the second scenario nothing of them happened, so Save() was never called.

If you register SecondViewModel as singleton the behaviour of second scenario will be the same as first scenario.

tibel wrote Jan 10 at 8:34 PM

In the first scenario SecondPageView wasn't garbage collected (this may take some time; but you can force it).
That is why also the SecondViewModel wasn't garbage collected and it was saved on leaving the application!!!