コード例 #1
0
        public App()
        {
            database = new TodoItemDatabase();
            var mainNav = new NavigationPage(new TodoListPage());

            MainPage = mainNav;
        }
コード例 #2
0
        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);
        }
コード例 #8
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;
        }
コード例 #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));
 }