Exemple #1
0
        public MainPage()
        {
            InitializeComponent();
            var dbConnection = App.Database;

            TodoItemDatabase todoItemDatabase = App.Database;
            TodoItem         item2            = new TodoItem();
            TodoItem         item             = new TodoItem();

            /*item2.Name = "Tramvaj";
             * item2.Text = "Jela domů";
             * App.Database.SaveItemAsync(item2);*/


            var itemsFromDb = App.Database.GetItemsAsync().Result;

            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");

            Debug.WriteLine(itemsFromDb.Count);
            foreach (TodoItem todoItem in itemsFromDb)
            {
                Debug.WriteLine(todoItem);
            }

            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");


            ItemsCount.Text = "Items in Database " + itemsFromDb.Count;
            ToDoItemsListView.ItemsSource = itemsFromDb;
        }
        public TodoItemPage()
        {
            InitializeComponent();
            var dbConnection = App.Database;

            TodoItemDatabase todoItemDatabase = App.Database;
            TodoItem         item             = new TodoItem();
        }
Exemple #3
0
        async void HandleAdd(object sender, EventArgs ea)
        {
            if (taskName != null)
            {
                if (taskDesc != null)
                {
                    var dbConnection = Database;

                    TodoItemDatabase todoItemDatabase = Database;
                    TodoItem         item             = new TodoItem();
                    item.Name = taskName.Text;
                    item.Text = taskDesc.Text;
                    await Database.SaveItemAsync(item);

                    taskName.Text = "";
                    taskDesc.Text = "";

                    await App.Current.MainPage.Navigation.PopModalAsync();
                }
            }
        }
        private void CreateSampleData()
        {
            var dbConnection = App.Database;

            TodoItemDatabase todoItemDatabase = App.Database;
            TodoItem         item             = new TodoItem();
            TodoItem         item2            = new TodoItem();

            item.Notes    = "Dodělat tenhle ukol";
            item.Obrazek  = "check.png";
            item2.Notes   = "Koupit perník";
            item2.Obrazek = "none.png";

            /*App.Database.SaveItemAsync(item);
             * App.Database.SaveItemAsync(item2);*/


            LoadData();

            /*foreach (TodoItem todoItem in itemsFromDb)
             * {
             * string obrazek = "";
             *  if (todoItem.Obrazek == "check.png")
             *  {
             *      obrazek = "check.png";
             *  }
             *  else
             *  {
             *      obrazek = "none.png";
             *  }
             *  Console.WriteLine(todoItem.Notes);
             *  Persons.Add(new TodoItem() { Notes = "haha", Obrazek = "none.png" });
             * }*/



            // for (int i = 0; i < 10; i++) persons.Add(new Person() { Lastname = "Jméno" + i, Firstname = "Přijmení" + i, DateOfBirth = new DateTime(1980+i,1,1) });
        }
Exemple #5
0
        public MainPage()
        {
            InitializeComponent();
            var dbConnection = App.Database;

            TodoItemDatabase todoItemDatabase = App.Database;
            TodoItem         item             = new TodoItem();
            TodoItem         item2            = new TodoItem();

            item.Notes  = "Dodělat tenhle ukol";
            item2.Notes = "Koupit perník";
            App.Database.SaveItemAsync(item);
            App.Database.SaveItemAsync(item2);



            var itemsFromDb = App.Database.GetItemsAsync().Result;

            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");

            Debug.WriteLine(itemsFromDb.Count);
            foreach (TodoItem todoItem in itemsFromDb)
            {
                Debug.WriteLine(todoItem);
            }

            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");
            Debug.WriteLine("                             ");


            ItemsCount.Text = "Items in Database " + itemsFromDb.Count;
            ToDoItemsListView.ItemsSource = itemsFromDb;
        }