/// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            this.note = (Notes)e.Parameter;
 
            dp.Date = note.date.Date;
            tp.Time = note.date.TimeOfDay;

            _2.DataContext = note.Description;
            _3.DataContext = note.Value;
 
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            if (e.Parameter == null)
                isCreating = true;
            else
                isCreating = false;

            if (isCreating)
            {
                newNote = new Notes();

                tempDate = DateTime.Now;
                Value.Text = "£0.00";
                Negative = true;
            }
            else
            {
                // get the information about the existing input from the database
                newNote = (Notes)e.Parameter;

                // change button content
                ok.Content = "Edit";

                Date2.Date = newNote.date.Date;
                Time.Time = newNote.date.TimeOfDay;

                Description.Text = newNote.Description;

                // set switch position and negative flag
                if (newNote.Value < 0)
                {
                    Value.Text = String.Format("{0:£0.00}", -newNote.Value);
                    Switch.IsOn = false;
                    Negative = true;
                }
                else
                {
                    Value.Text = String.Format("{0:£0.00}", newNote.Value);
                    Switch.IsOn = true;
                    Negative = false;
                }

                 //get information
                tempValue = Math.Abs(newNote.Value);

                DateTimeOffset sourcedate = Date2.Date;
                TimeSpan ts = Time.Time;
                tempDate = sourcedate.Date + ts;

            }
        }
Example #3
0
        public async void EditNote(Notes note)
        {
            var item = _notes.FirstOrDefault(i => i.date == note.date);
            
            if (item != null)
            {
                item.date = note.date;
                item.Description = note.Description;
                item.Value = note.Value;
            }

            await saveNotesDataAsync();
        }
Example #4
0
 public async void DeleteNote(Notes note)
 {
     _notes.Remove(note);
     await saveNotesDataAsync();
 }
Example #5
0
 public async void AddNote (Notes note)
 {
     _notes.Add(note);
     await saveNotesDataAsync();
 }