Esempio n. 1
0
        /// <summary>
        /// Remove all notes
        /// </summary>
        private async void ClearAllNotes()
        {
            ServiceManager noteGetServiceManager =
                new ServiceManager(new Uri(note_base_uri));

            var notes = await noteGetServiceManager.CallService<Note[]>();

            int numDeleted = 0;

            foreach (var note in notes)
            {
                NoteRequest noteReq = new NoteRequest() { Id = note.Id, NoteText = note.NoteText };
                ServiceManager noteServiceManager = new ServiceManager(new Uri(note_base_uri + "/" + noteReq.Id));

                if (await noteServiceManager.CallDeleteService<NoteRequest>(noteReq))
                    numDeleted++;
            };
            ShowPopupMessage(string.Format("Deleted {0} notes from the DB!", numDeleted));

            UpdateCurrentNoteDisplay();
        }
Esempio n. 2
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="noteText"></param>
        private async void WriteNote(string noteText)
        {
            NoteRequest noteReq = new NoteRequest()
            {
                Id = 2,
                NoteText = noteText
            };//"{\"Id\": 3,\"NoteText\": \"" + noteText + "\"}";

            ServiceManager noteManager = new ServiceManager(new Uri(note_base_uri));
            bool successfulCall = await noteManager.CallPOSTService<NoteRequest>(noteReq);

            if (successfulCall)
                ShowPopupMessage(string.Format("Note successfully updated!\rSet to: {0}", noteText), "Note Update");
            else
                ShowPopupMessage("Note was not able to be updated at this time.", "Note Update");

            UpdateCurrentNoteDisplay();
            NewNoteTextBox.Text = "";

            //Remind the user to set a note every day! <3
            NotificationManager.ScheduleNotification("Don't forget to update your daily Note!", DateTime.Now.AddDays(1), NotificationType.Toast);
            //TODO: Pull schedule info from config
        }