Exemplo n.º 1
0
        public void populateListView()
        {
            var itemsToAdd = connection.Table <AddTrip>();

            //string name;
            //string dest;
            //string start;
            //AddTrip addTrp = new AddTrip();

            foreach (var addTrip in itemsToAdd)
            {
                StoredTrips newTrip = new StoredTrips();

                newTrip.startingPoint = addTrip.startingPoint;
                newTrip.destination   = addTrip.destination;
                newTrip.tripName      = addTrip.tripName;

                storedTrips.Add(newTrip);

                ListViewItem newButton = new ListViewItem();

                trips.Add(newButton);

                newButton.Content = addTrip.tripName;

                listView.Items.Add(newButton);
            }
        }
Exemplo n.º 2
0
        private async void Trip_Click(object sender, RoutedEventArgs e)
        {
            AddTrip     trip    = new AddTrip();
            StoredTrips newTrip = new StoredTrips();

            EnterTrip tripDialog = new EnterTrip(ref newTrip);
            var       result     = await tripDialog.ShowAsync();

            if (newTrip.allFields != false)
            {
                ListViewItem newButton = new ListViewItem();


                if (result == ContentDialogResult.Primary)
                {
                    //stored the entered trip with startingPoint and destination
                    //newTrip.tripName = trip.tripName;

                    trip.tripName = newTrip.tripName;

                    storedTrips.Add(newTrip);

                    connection.Insert(new AddTrip()
                    {
                        tripName      = newTrip.tripName,
                        destination   = newTrip.destination,
                        startingPoint = newTrip.startingPoint
                    });

                    trips.Add(newButton);
                    newButton.Content = trip.tripName;
                    listView.Items.Add(newButton);
                }
            }
            else
            {
                var messageDialog = new MessageDialog("Unable to create trip. All fields are required.");
                await messageDialog.ShowAsync();
            }
        }
Exemplo n.º 3
0
        public EnterTrip(ref StoredTrips trip)
        {
            this.InitializeComponent();

            newTrip = trip;
        }