コード例 #1
0
        async void CheckForSavedInfo()
        {
            if (await FileHelper.ExistsAsync(App.TransientFilename))
            {
                // Read the file.
                string str = await FileHelper.ReadTextAsync(App.TransientFilename);

                // Delete the file.
                await FileHelper.DeleteFileAsync(App.TransientFilename);

                // Break down the file contents.
                string[] contents = str.Split('\x1F');
                string filename = contents[0];
                bool isNoteEdit = Boolean.Parse(contents[1]);
                string entryText = contents[2];
                string editorText = contents[3];

                // Create the Note object and initialize it with saved data.
                Note note = new Note(filename);
                note.Title = entryText;
                note.Text = editorText;

                // Navigate to NotePage.
                NotePage notePage = new NotePage(note, isNoteEdit);
                await this.Navigation.PushAsync(notePage);
            }
        }