コード例 #1
0
        public App()
        {
            // This loads all the existing .note files.
            NoteFolder = new NoteFolder();

            // Make call to method in MultiPageRestorableApp.
            Startup(typeof(NoteTakerHomePage));
        }
コード例 #2
0
        public App()
        {
            // This loads all the existing .note files.
            NoteFolder = new NoteFolder();

            // Make call to method in MultiPageRestorableApp.
            Startup(typeof(NoteTakerHomePage));
        }
コード例 #3
0
ファイル: App.cs プロジェクト: areestlc/xamarin
        public App()
        {
            Xamarin.FormsBook.Platform.Toolkit.Init();

            // This loads all the existing .note files.
            NoteFolder = new NoteFolder();

            // Make call to method in MultiPageRestorableApp.
            Startup(typeof(NoteTakerHomePage));
        }
コード例 #4
0
        async protected override void OnDisappearing()
        {
            base.OnDisappearing();

            // Special code for iOS:
            //      Do not save note when program is terminating.
            if (isInSleepState)
            {
                return;
            }

            // Only save the note if there's some text somewhere.
            if (!String.IsNullOrWhiteSpace(Note.Title) ||
                !String.IsNullOrWhiteSpace(Note.Text))
            {
                // Save the note to a file.
                await Note.SaveAsync();

                // Add it to the collection if it's a new note.
                NoteFolder noteFolder = ((App)App.Current).NoteFolder;

                // IndexOf method finds match based on Filename property
                //      based on implementation of IEquatable in Note.
                int index = noteFolder.Notes.IndexOf(note);
                if (index == -1)
                {
                    // No match -- add it.
                    noteFolder.Notes.Add(note);
                }
                else
                {
                    // Match -- replace it.
                    noteFolder.Notes[index] = note;
                }
            }
        }