Exemple #1
0
        /**
         * Refreshing data / loading data before storyboard appears
         */
        public override async void ViewWillAppear(bool animated)
        {
            base.ViewWillAppear(animated);
            // register tableOfNotes tableview component
            listOfAllNotesTable.RegisterClassForCellReuse(typeof(UITableViewCell), notesHistoryCellId);
            listOfAllNotesTable.Source = new NotesHistoryDataSource(this);
            notesService = NotesService.DefaultService;
            await notesService.InitializeStoreAsync();

            // pull the latest data
            await RefreshAsync();
        }
Exemple #2
0
        /**
         * Actions that can occur after storyboard is loaded
         */
        public override async void ViewDidLoad()
        {
            base.ViewDidLoad();
            notesService = NotesService.DefaultService;
            await notesService.InitializeStoreAsync();

            //actions by clicking done button
            doneNotesButton.TouchUpInside += async(object sender, EventArgs e) =>
            {
                if (string.IsNullOrWhiteSpace(notesTextArea.Text))
                {
                    return;
                }

                if (!isInEditingMode)
                {
                    // new note
                    var newItem = new NotesItem
                    {
                        Text   = notesTextArea.Text,
                        Delete = false
                    };
                    await notesService.InsertTodoItemAsync(newItem);
                }
                else
                {
                    // note already exists and has to be updated in azure
                    note.Text = notesTextArea.Text;
                    await notesService.UpdateNoteAsync(note);

                    isInEditingMode = false;
                }

                notesTextArea.Text = "";
                await notesService.RefreshDataAsync();
            };
        }