Example #1
0
        public async override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary <string, object> state)
        {
            if (Notebooks.Count == 0)
            {
                var notebooks = await NotebooksService.GetNotebooksAsync();

                Notebooks.AddRange(notebooks);
            }

            await Task.CompletedTask;
        }
        private async void NameTextBox_LostFocus(object sender, RoutedEventArgs e)
        {
            var textBox  = sender as TextBox;
            var notebook = textBox.DataContext as Notebook;

            if (!ViewModel.Notebooks.Contains(notebook))        // This fires when you delete a notebook, for some reason.
            {
                return;
            }

            notebook.Name = textBox.Text;
            await NotebooksService.ChangeNotebookAsync(notebook);
        }