locked
Store User Input from Medication Reminder App

    Question

  • What would be the best method for storing a set of medications that the user enters in my Metro App?
    Sunday, January 22, 2012 7:56 PM

Answers

  • Yes and yes!

    You could do something like this:

                    return WinJS.Application.local.writeText(fileName, JSON.stringify( theJsonObject )).then(
                        function (data) {
                            try {
                                return data;
                            }
                            catch (e) { 
                                return 0;
                            }
                        });
                


    Jeff Sanders (MSFT)
    Tuesday, January 24, 2012 4:45 PM
    Moderator

All replies

  • Hi W,

    Is there something unique about the fact that you would be storing a list of medications verses a list of any other data?

    You could store using the ApplicationData class: http://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.aspx

    If you choose roaming, then it would follow the user to different devices.

    -Jeff


    Jeff Sanders (MSFT)
    Monday, January 23, 2012 1:49 PM
    Moderator
  • There is nothing special about the purpose of the data, no. I just wondered because the only thing that I could find spoke of storing files in user libraries. I didn't want to polute their libraries with application information. The link that you provided is definitely along the lines of what I want. Would it let me create a .json file and store the data in there? I figured that serializing the data as JSON was the best (most efficient) choice. Would that assumption be correct?
    Tuesday, January 24, 2012 1:28 AM
  • Yes and yes!

    You could do something like this:

                    return WinJS.Application.local.writeText(fileName, JSON.stringify( theJsonObject )).then(
                        function (data) {
                            try {
                                return data;
                            }
                            catch (e) { 
                                return 0;
                            }
                        });
                


    Jeff Sanders (MSFT)
    Tuesday, January 24, 2012 4:45 PM
    Moderator
  • Awesome! Thank you! This is just what I was looking for!
    Wednesday, January 25, 2012 11:15 AM