문제

I am able to save it in isolated storage and retrieve it. But how to delete?

private void Deleting(object sender, RoutedEventArgs e)
    {
        MessageBoxResult message = MessageBox.Show("The Files will be permanently deleted.","Continue?", MessageBoxButton.OKCancel);

        if (message == MessageBoxResult.OK)
        {
            IsolatedStorageFile isofile = IsolatedStorageFile.GetUserStoreForApplication();
            isofile.DeleteFile("//What to do here?");

        }

        else if (message == MessageBoxResult.Cancel)            

        NavigationService.Navigate(new Uri("/MyRecordings.xaml", UriKind.RelativeOrAbsolute));
    }

올바른 솔루션이 없습니다

다른 팁

If you are using the Windows Phone Toolkit context menu, you should be able to get the data you need from the sender object, e.g.

var selected = sender as MenuItem;

See here: http://blogs.msdn.com/b/msgulfcommunity/archive/2013/05/19/windows-phone-toolkit-context-menu-getting-selected-item-within-a-long-list-selector.aspx

Pass the file path to the DeleteFile method to delete a file. You should really check if the file exists first and dispose of the isoFile object when finished with it:

using (var isofile = IsolatedStorageFile.GetUserStoreForApplication())
 {
     if (isofile.FileExists("foo.txt"))
     {
          isofile.DeleteFile("foo.txt");
     }
 }
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top