예제 #1
0
        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();
        }
예제 #2
0
 public ToDoViewModel()
 {
     AddCommand = new Command(ExecuteAddCommand);
     database   = new ToDoDatabase();
     ToDos      = new ObservableCollection <ToDoItem>();
     RefreshList();
 }
예제 #3
0
 public LoginModel()
 {
     database     = new ToDoDatabase();
     SavekHandler = new Command(SaveItemButton);
     Items        = new ObservableCollection <ToDoItem>();
     ItemList     = Items;
     RefreshList();
 }
예제 #4
0
        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();
        }
예제 #5
0
 /// <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();
 }