简体   繁体   中英

How to save,access and delete Writable Bitmap in Windows.Storage Local Folder?

Coming from windows 7 background I am well informed with Isolated Storage but it does not support in winRT projects. So saving bitmap in isostore does not display the image on live tile when used in winRT component. How can I save this newly writeable bitmap to Local Folder and then access it in winRT component.And delete the image after its job finished. Thank you.

      var bitmap2 = new WriteableBitmap(691, 336);

        //Set the background
        Rectangle r2 = new Rectangle();
        r2.Height = 336;
        r2.Width = 691;
        r2.Fill = new SolidColorBrush(currentAccentColorHex);
        bitmap2.Render(r2, null);

        bitmap2.Render(ww, null);
        bitmap2.Invalidate();

        widefilename = "/Shared/ShellContent/large.jpg";

        var isf = IsolatedStorageFile.GetUserStoreForApplication();

        //save the medium image
        using (var stream = isf.OpenFile(mediumfilename, System.IO.FileMode.OpenOrCreate))
        {
            bitmap1.SaveJpeg(stream, 336, 366, 0, 100);

        } // Replacing Isolated Storage with Local Folder Storage

In Windows Runtime use StorageFile instead of IsolatedStorageFile. To get the local folder use ApplicationData.Current.LocalFolder (and consider using RoamingFolder instead).

See Accessing app data with the Windows Runtime on MSDN for an overview of options and Quickstart: Local app data (C#/VB/C++) and the Application data sample for sample code.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM