public App()
        {
            database = new TodoItemDatabase();
            var mainNav = new NavigationPage(new TodoListPage());

            MainPage = mainNav;
        }
        async void OnDeleteClicked(object sender, EventArgs e)
        {
            var todoItem = (TodoItem)BindingContext;
            TodoItemDatabase database = await TodoItemDatabase.Instance;
            await database.DeleteItemAsync(todoItem);

            await Navigation.PopAsync();
        }
Example #3
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            TodoItemDatabase database = await TodoItemDatabase.Instance;

            listView.ItemsSource = await database.GetItemsAsync();
        }
Example #4
0
        public static TodoItemDatabase Create(string databasePath)
        {
            var dbContext = new TodoItemDatabase(databasePath);

            dbContext.Database.EnsureCreated();
            dbContext.Database.Migrate();
            return(dbContext);
        }
		public static Page GetMainPage ()
		{
			database = new TodoItemDatabase();

			var mainNav = new NavigationPage (new TodoListPage ());

			return mainNav;
		}
Example #6
0
        public static Page GetLoginPage()
        {
            database = new TodoItemDatabase();

            var loginNav = new NavigationPage(new LoginPage());

            return(loginNav);
        }
Example #7
0
        public static Page GetMainPage()
        {
            database = new TodoItemDatabase();

            var mainNav = new NavigationPage(new TodoListPage());

            return(mainNav);
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var sqliteFilename = "TodoSQLite.db3";
            string documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder
            string libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder
            var path = Path.Combine(libraryPath, sqliteFilename);

            // This is where we copy in the prepopulated database
            Console.WriteLine (path);
            if (!File.Exists (path)) {
                File.Copy (sqliteFilename, path);
            }

            var db = new ADODatabase(path);
            Database = new TodoItemDatabase(db);

            return true;
        }
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            var    sqliteFilename = "TodoSQLite.db3";
            string documentsPath  = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder
            string libraryPath    = Path.Combine(documentsPath, "..", "Library");                  // Library folder
            var    path           = Path.Combine(libraryPath, sqliteFilename);

            // This is where we copy in the prepopulated database
            Console.WriteLine(path);
            if (!File.Exists(path))
            {
                File.Copy(sqliteFilename, path);
            }


            var db = new ADODatabase(path);

            Database = new TodoItemDatabase(db);


            return(true);
        }
Example #10
0
		public static void SetDatabaseConnection (SQLite.Net.SQLiteConnection connection)
		{
			conn = connection;
			database = new TodoItemDatabase (conn);
		}
Example #11
0
 public static void SetDatabaseConnection(SQLite.Net.SQLiteConnection connection)
 {
     conn     = connection;
     database = new TodoItemDatabase(conn);
 }
Example #12
0
		public static Page GetLoginPage (KidoZen.KZApplication.OnEventHandler onAuthFinish)
		{
			database = new TodoItemDatabase();
			return new LoginPage (onAuthFinish);
		}
        public TodoItemPageCS()
        {
            Title = "Todo Item";

            var nameEntry = new Entry();

            nameEntry.SetBinding(Entry.TextProperty, "Name");

            var notesEntry = new Entry();

            notesEntry.SetBinding(Entry.TextProperty, "Notes");

            var doneSwitch = new Switch();

            doneSwitch.SetBinding(Switch.IsToggledProperty, "Done");

            var saveButton = new Button {
                Text = "Save"
            };

            saveButton.Clicked += async(sender, e) =>
            {
                var todoItem = (TodoItem)BindingContext;
                TodoItemDatabase database = await TodoItemDatabase.Instance;
                await database.SaveItemAsync(todoItem);

                await Navigation.PopAsync();
            };

            var deleteButton = new Button {
                Text = "Delete"
            };

            deleteButton.Clicked += async(sender, e) =>
            {
                var todoItem = (TodoItem)BindingContext;
                TodoItemDatabase database = await TodoItemDatabase.Instance;
                await database.DeleteItemAsync(todoItem);

                await Navigation.PopAsync();
            };

            var cancelButton = new Button {
                Text = "Cancel"
            };

            cancelButton.Clicked += async(sender, e) =>
            {
                await Navigation.PopAsync();
            };

            Content = new StackLayout
            {
                Margin          = new Thickness(20),
                VerticalOptions = LayoutOptions.StartAndExpand,
                Children        =
                {
                    new Label {
                        Text = "Name"
                    },
                    nameEntry,
                    new Label {
                        Text = "Notes"
                    },
                    notesEntry,
                    new Label {
                        Text = "Done"
                    },
                    doneSwitch,
                    saveButton,
                    deleteButton,
                    cancelButton
                }
            };
        }
Example #14
0
 public static Page GetLoginPage(KidoZen.KZApplication.OnEventHandler onAuthFinish)
 {
     database = new TodoItemDatabase();
     return(new LoginPage(onAuthFinish));
 }