예제 #1
0
        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();
        }
예제 #3
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();

            TodoItemDatabase database = await TodoItemDatabase.Instance;

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

            dbContext.Database.EnsureCreated();
            dbContext.Database.Migrate();
            return(dbContext);
        }
예제 #5
0
		public static Page GetMainPage ()
		{
			database = new TodoItemDatabase();

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

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

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

            return(loginNav);
        }
예제 #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;
        }
예제 #9
0
        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);
        }
예제 #10
0
		public static void SetDatabaseConnection (SQLite.Net.SQLiteConnection connection)
		{
			conn = connection;
			database = new TodoItemDatabase (conn);
		}
예제 #11
0
 public static void SetDatabaseConnection(SQLite.Net.SQLiteConnection connection)
 {
     conn     = connection;
     database = new TodoItemDatabase(conn);
 }
예제 #12
0
파일: App.cs 프로젝트: kidozen/kido-xamarin
		public static Page GetLoginPage (KidoZen.KZApplication.OnEventHandler onAuthFinish)
		{
			database = new TodoItemDatabase();
			return new LoginPage (onAuthFinish);
		}
예제 #13
0
        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
                }
            };
        }
예제 #14
0
 public static Page GetLoginPage(KidoZen.KZApplication.OnEventHandler onAuthFinish)
 {
     database = new TodoItemDatabase();
     return(new LoginPage(onAuthFinish));
 }