alfah
alfah

Reputation: 2085

How to reset application data in Windows 8/WinRT

I have a user setting, which asks the user if he wants to reset the app. When the user hits Reset, I need to clear all the data in the local folder? My local folders have many sub folders. I have been searching for a remove function which removes the contents of local folder without any hassle? DeleteAsync?

Thanks

Upvotes: 0

Views: 2945

Answers (2)

alfah
alfah

Reputation: 2085

I have used DeleteAsync to remove the folder and its contents.

private async Task<bool> DeleteFolder() 
    {
       var folderlist = await m_localFolder.GetFoldersAsync();
       foreach (StorageFolder folder in folderlist)
       {
           await folder.DeleteAsync(StorageDeleteOption.PermanentDelete);
       }           

       return true;
    }

Upvotes: 1

MBZ
MBZ

Reputation: 27592

You can use the helper class suggested here.

It is very useful for managing LocalFolder and LocalSettings.

Upvotes: 0

Related Questions