private void EditAction(Note note)
        {

            System.Diagnostics.Debug.WriteLine("Here we need to navigate the select note to NoteEditPage...");
            System.Diagnostics.Debug.WriteLine("the Note ID to NoteEditPage = " + note.ID);
            _navigationService.Navigate<NoteEditPage>(note);          
        }
Beispiel #2
0
        /// <summary>
        /// The delete note async.
        /// </summary>
        /// <param name="note object">
        /// The note object.
        /// </param>

        public async void DeleteNote(Note note)
        {
            _notes.Remove(note);
            for (int i = 0; i < _notes.Count; i++)
            {
                _notes[i].ID = i;
            }
            await SaveNoteDataAsync();
        }
Beispiel #3
0
        /// <summary>
        /// The add note async.
        /// </summary>
        /// <param name="note object">
        /// The note object.
        /// </param>

        public async void AddNote(Note note)
        {
            _notes.Add(note);
            await SaveNoteDataAsync();

            for (int i = 0; i < _notes.Count; i++)
            {
                System.Diagnostics.Debug.WriteLine("_notes" + i + "Title = " + _notes[i].NoteTitle);
                System.Diagnostics.Debug.WriteLine("_notes" + i + "Content = " + _notes[i].NoteContent);
            }

        }
 private void EmailAction(Note note)
 {
     System.Diagnostics.Debug.WriteLine("Here we need to pass select note to send email...");
 }
 private void ViewAction(Note note)
 {
     System.Diagnostics.Debug.WriteLine("Here we need to pass select note to view page...");
     System.Diagnostics.Debug.WriteLine("Passed note = " + note.NoteTitle);
     System.Diagnostics.Debug.WriteLine("ID = " + note.ID);
     _navigationService.Navigate<NoteViewPage>(note);
     
 }
        private void DeleteAction(Note note)
        {
            
            _noteSessionService.DeleteNote(note);

            GetRuiNoteList();
        }
Beispiel #7
0
        /// <summary>
        /// The replace note async.
        /// </summary>
        /// <param name="note object">
        /// The note object.
        /// </param>

        public async void ReplaceNote(Note note)
        {

            _notes[note.ID] = note;
            await SaveNoteDataAsync();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NewNotePageViewModel"/> class.
        /// </summary>
        /// <param name="navigationService">
        /// The navigation service.
        /// </param>
        /// <param name="noteCompositionSessionService">
        /// The note composition session service.
        /// </param>
        /// <param name="messageBox">
        /// The message box.
        /// </param>
        /// <param name="logManager">
        /// The log manager.
        /// </param>

        public NewNotePageViewModel(INavigationService navigationService,
            INoteSessionService noteSessionService,
            IMessageBoxService messageBox,
            ILogManager logManager)
        {
            _navigationService = navigationService;
            _noteSessionService = noteSessionService;
            _messageBox = messageBox;
            _logManager = logManager;
            
            AddCommand = new RelayCommand(
                () =>
                {
                    // here we need to save the new added note, 
                    // including title, cotent and time
                    AddNoteAction();

                });

            CancelCommand = new RelayCommand(
                () =>
                {
                   CancelAction();
                });

            _note = new Note();
            
            Messenger.Default.Register<NotificationMessage>(this, (message) =>
            {
                // We need to get the note list count right after the NewNotePage is navigated to
                // We can't get the note list count when back button is pressed
                // Because, we don't get the instance of navigation service is already been destroyed when back button is fired.
                if (message.Notification == "GetNoteListCount")
                {
                    id = (int)_navigationService.CurrentParameter;
                }

                if (message.Notification == "NewNotePageBackButtonPressed")
                {

                    if (_note.NoteTitle == null && _note.NoteContent == null)
                    {
                        // we don't save the empty note.
                        System.Diagnostics.Debug.WriteLine("note is empty we don't save...");
                    }
                    else
                    {
                        AddNoteAction();
                    }
                    
                }
                
            });

        }