Exemplo n.º 1
0
        public ThoughtEntryPage(RandomThoughtsPage parent, RandomThoughtDatabase database)
        {
            _parent   = parent;
            _database = database;
            Title     = "Enter a Thought";

            var entry  = new Entry();
            var button = new Button
            {
                Text = "Add"
            };

            button.Clicked += async(object sender, EventArgs e) => {
                var thought = entry.Text;

                _database.AddThought(thought);

                await Navigation.PopAsync();


                _parent.Refresh();
            };

            Content = new StackLayout
            {
                Spacing  = 20,
                Padding  = new Thickness(20),
                Children = { entry, button },
            };
        }
Exemplo n.º 2
0
        public static Page GetMainPage()
        {
            var database = new RandomThoughtDatabase();
           
            return new NavigationPage(new RandomThoughtsPage(database));

        }
Exemplo n.º 3
0
        public ThoughtEntryPage(RandomThoughtsPage parent, RandomThoughtDatabase database)
        {
            _parent   = parent;
            _database = database;
            Title     = "Enter name lat and lon";

            var entry = new Entry()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start,
                Text = "Enter lat and lon"
            };
            var entry2 = new Entry()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start,
                Text = "Enter Name"
            };
            var button = new Button
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions   = LayoutOptions.Start,
                Text = "Add"
            };

            //   button.Clicked += async (object sender, EventArgs e) => {
            //      string Input = entry.Text;
            //      string Name = entry2.Text;
            //      double Lat = Convert.ToDouble(Input.Substring(0, Input.IndexOf(" ",0) - 1));
            //     double Lon = Convert.ToDouble(Input.Substring(Input.IndexOf(" ", 0) + 1, Input.Length));

            //     _database.AddThought(Name, Lat, Lon);

            //    await Navigation.PopAsync();


            //      _parent.Refresh();
            //  };

            Content = new StackLayout
            {
                Spacing  = 20,
                Padding  = new Thickness(20),
                Children = { entry2, button },
            };
        }
Exemplo n.º 4
0
        public ThoughtEntryPage(RandomThoughtsPage parent, RandomThoughtDatabase database)
        {
            _parent = parent;
            _database = database;
            Title = "Enter name lat and lon";

            var entry = new Entry()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                Text = "Enter lat and lon"
            };
            var entry2 = new Entry()
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                Text = "Enter Name"
            };
            var button = new Button
            {
                HorizontalOptions = LayoutOptions.Center,
                VerticalOptions = LayoutOptions.Start,
                Text = "Add"
            };

         //   button.Clicked += async (object sender, EventArgs e) => {
          //      string Input = entry.Text;
          //      string Name = entry2.Text;
          //      double Lat = Convert.ToDouble(Input.Substring(0, Input.IndexOf(" ",0) - 1));
           //     double Lon = Convert.ToDouble(Input.Substring(Input.IndexOf(" ", 0) + 1, Input.Length));

           //     _database.AddThought(Name, Lat, Lon);

           //    await Navigation.PopAsync();


          //      _parent.Refresh();
          //  };

            Content = new StackLayout
            {
                Spacing = 20,
                Padding = new Thickness(20),
                Children = {entry2 , button},
            };
        }
Exemplo n.º 5
0
        public RandomThoughtsPage(RandomThoughtDatabase database)
        {
            _database = database;
            Title     = "Random Thoughts";
            var thoughts = _database.GetThoughts();

            _thoughtList              = new ListView();
            _thoughtList.ItemsSource  = thoughts;
            _thoughtList.ItemTemplate = new DataTemplate(typeof(TextCell));
            _thoughtList.ItemTemplate.SetBinding(TextCell.TextProperty, "Thought");
            _thoughtList.ItemTemplate.SetBinding(TextCell.DetailProperty, "CreatedOn");

            var toolbarItem = new ToolbarItem
            {
                Text    = "Add",
                Command = new Command(() => Navigation.PushAsync(new ThoughtEntryPage(this, database)))
            };

            ToolbarItems.Add(toolbarItem);

            Content = _thoughtList;
        }
        public RandomThoughtsPage(RandomThoughtDatabase database)
        {
            _database = database;
            Title = "Testing SQLite";
            var thoughts = _database.GetThoughts();

            _thoughtList = new ListView();
            _thoughtList.ItemsSource = thoughts;
            _thoughtList.ItemTemplate = new DataTemplate(typeof(TextCell));
           _thoughtList.ItemTemplate.SetBinding(TextCell.TextProperty, "Name");
           _thoughtList.ItemTemplate.SetBinding(TextCell.DetailProperty, "Lat");
            _thoughtList.ItemTemplate.SetBinding(TextCell.DetailColorProperty, "Lon");

            var toolbarItem = new ToolbarItem
            {
                Name = "Add",
                Command = new Command(() => Navigation.PushAsync(new ThoughtEntryPage(this, database)))
            };

            ToolbarItems.Add(toolbarItem);

            Content = _thoughtList;
        }
Exemplo n.º 7
0
        public static Page GetMainPage()
        {
            var database = new RandomThoughtDatabase();

            return(new NavigationPage(new RandomThoughtsPage(database)));
        }