This is a migrated thread and some comments may be shown as answers.

Possibility to clear settings

5 Answers 233 Views
PersistenceFramework
This is a migrated thread and some comments may be shown as answers.
Tau Sick
Top achievements
Rank 1
Tau Sick asked on 29 Jul 2011, 10:37 AM

Sometimes the users paint themselves into a corner and set up the UI in an unwanted way. I would like a way to clear settings (all would be fine, but the ability to clear only some would also be better).

Something like

 

           IsolatedStorageProvider isoProvider = new IsolatedStorageProvider();

           isoProvider.ClearStorage();

           isoProvider.ClearStorage(“myGridView”);

This would remove the files from isolated storage and revert controls to default settings.

5 Answers, 1 is accepted

Sort by
0
Accepted
Alex Fidanov
Telerik team
answered on 29 Jul 2011, 11:51 AM
Hi Tau Sick,

If you want to delete a particular file with settings, you can use the following code :

using (var store = IsolatedStorageFile.GetUserStoreForAssembly())
{
    string fileName = "myGridView" + ".bin";
    if (store.FileExists(fileName))
    {
        try
        {
            store.DeleteFile(fileName);
        }
        catch (Exception ex)
        {
        }
    }
}

However, we had already considered this request and had implemented part of it. We added a method for deleting all of the saved settings in the IsolatedStorage for the application - IsolatedStorageProvider.DeleteIsolatedStorageFiles. It will be publicly available with the upcoming internal build.
Please let me know if you have questions on this matter.

Greetings,
Alex Fidanov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Alex Fidanov
Telerik team
answered on 29 Jul 2011, 11:55 AM
Hi Tau Sick,

In case you would like to extend the IsolatedStorageProvider class or create an extension method, you can use the PersistenceManager.GetStorage() method, which will return the registered controls with their storage ids.

Greetings,
Alex Fidanov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Tau Sick
Top achievements
Rank 1
answered on 29 Jul 2011, 12:00 PM
Perfect - that takes care of deleting the files.

But can I revert the settings of my UI to default without having to restart the application?
0
Accepted
Tina Stancheva
Telerik team
answered on 03 Aug 2011, 04:53 PM
Hi Tau Sick,
 
Can you please elaborate on what you mean by restarting the application? Basically you can save the initial state of your user control on loading it for example and then you can load the persisted state using the PersistenceManager.Load method like described in this article.

All the best,
Tina Stancheva
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Tau Sick
Top achievements
Rank 1
answered on 04 Aug 2011, 08:14 AM
ok, sorry - I guess I don't need to restart, I can just reload settings.
Tags
PersistenceFramework
Asked by
Tau Sick
Top achievements
Rank 1
Answers by
Alex Fidanov
Telerik team
Tau Sick
Top achievements
Rank 1
Tina Stancheva
Telerik team
Share this question
or