문제

I have a reset function in my app which brings the app back to default state. There for I need to remove the four files I created and remove the settings I created in the ApplicationDataContainer. This is how I remove the files

try
{
    StorageFile file = await localfolder.GetFileAsync("HistoryFile");
    if (file != null)
    {
        await file.DeleteAsync();
    }
}
catch
{
    //Catch Process
}

Is there a function which removes all the files together? When I tried the following code

localfolder.DeleteAsync()

It removed the LocalState folder along with the files, I jus need to remove the files not the folder.

And is there anyway in which I jus can remove all the values stored in ApplicationDatacontainer in one go? rather than removing them one by one like this?

localSettings.DeleteContainer("exampleContainer");
도움이 되었습니까?

해결책

If you want to remove application data from its local data store, try this.

await Windows.Storage.ApplicationData.Current.ClearAsync(
     Windows.Storage.ApplicationDataLocality.Local);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top