Possibility to clear settings

6 posts, 2 answers
  1. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 29 Jul 2011 Link to this post

    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.

  2. Answer
    Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 29 Jul 2011 Link to this post

    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!

  3. UI for WPF is Visual Studio 2017 Ready
  4. Alex Fidanov
    Admin
    Alex Fidanov avatar
    636 posts

    Posted 29 Jul 2011 Link to this post

    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!

  5. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 29 Jul 2011 Link to this post

    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?
  6. Answer
    Tina Stancheva
    Admin
    Tina Stancheva avatar
    3298 posts

    Posted 03 Aug 2011 Link to this post

    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 >>

  7. Tau Sick
    Tau Sick avatar
    14 posts
    Member since:
    Jul 2009

    Posted 04 Aug 2011 Link to this post

    ok, sorry - I guess I don't need to restart, I can just reload settings.
Back to Top
UI for WPF is Visual Studio 2017 Ready