public DatabasePage() { InitializeComponent(); database = new ToDoDatabase(); Items = new ObservableCollection <ToDoItem>(); ItemList.ItemsSource = Items; SaveItemButton.Clicked += (sender, e) => { if (string.IsNullOrWhiteSpace(Item.Text)) { return; } database.SaveItem(new ToDoItem { Name = Item.Text }); RefreshList(); Item.Text = string.Empty; }; RefreshList(); }
public ToDoViewModel() { AddCommand = new Command(ExecuteAddCommand); database = new ToDoDatabase(); ToDos = new ObservableCollection <ToDoItem>(); RefreshList(); }
public LoginModel() { database = new ToDoDatabase(); SavekHandler = new Command(SaveItemButton); Items = new ObservableCollection <ToDoItem>(); ItemList = Items; RefreshList(); }
public DatabasePage() { InitializeComponent(); database = new ToDoDatabase(); Items = new ObservableCollection<ToDoItem>(); ItemList.ItemsSource = Items; SaveItemButton.Clicked += (sender, e) => { if(string.IsNullOrWhiteSpace(Item.Text)) return; database.SaveItem(new ToDoItem{ Name = Item.Text }); RefreshList(); Item.Text = string.Empty; }; RefreshList(); }
/// <summary> /// this invokes methods to run migrations and seeds initial data if applicable /// </summary> /// <param name="scopedServices"></param> private static void EnsureDataStorageIsReady(IServiceProvider scopedServices) { LoggingEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); CoreEFStartup.InitializeDatabaseAsync(scopedServices).Wait(); ToDoDatabase.InitializeDatabaseAsync(scopedServices).Wait(); }