locked
inkManager.saveAsync problem RRS feed

  • Question

  • I have this code to save the strokes as a .gif file:

    //-------------------------------------------------------

    folder.createFileAsync(name, Windows.Storage.CreationCollisionOption.openIfExists).then(
            function (storageFile)
    {
    storageFile.openAsync(Windows.Storage.FileAccessMode.readWrite).then
    (
    function (stream)
    {
    inkManager.saveAsync(stream).then
    (
    function ()
    {
    stream.flushAsync().then
    (

    //-------------------------------------------------------

    It works pretty well BUT when i erase all strokes it doesn't WORK AT ALL. Doesn't save as an empty .gif and i wanted it to save it as an empty .gif file.  It used to in the developer preview but not anymore with the consumer preview.

    And i know it stops at inkManager.saveAsync when there are no strokes.. If there's at least one stroke it will save normally.

    Is there any way to make it save even when i erase all strokes?

    Wednesday, May 16, 2012 12:10 AM

All replies

  • Hey Alan,

    Sheesh, that seems like a bug to me.  I would want it to create and empty gif.  I can think of some workarounds but let me dig into this further and see if it is already reported as a bug.

    -Jeff


    Jeff Sanders (MSFT)

    Wednesday, May 16, 2012 2:33 PM
    Moderator
  • Hi Jeff

    A workaround is to keep an empty "empty.gif" in the project folder and check when there are no strokes to be saved and you can just make a copy of the "empty.gif" to the destination folder you need with the desired name replacing the existing one.

    Anyway, I have to test if it doesn't crash if you already have a file/stream open waiting to be flushed/closed

    Wednesday, May 16, 2012 10:09 PM
  • well... didn't work very well.. 
    Wednesday, May 16, 2012 10:23 PM
  • When you try to read it it says:

    "The Status is 'error', But getResults did not return an error"

    Because the .gif is empty, so i'll be waiting for a way to save a gif without strokes that doesn't crash the app.

    Wednesday, May 16, 2012 10:30 PM