예제 #1
0
        private void Btnadd_Click(object sender, RoutedEventArgs e)
        {
            //know which item is selected


            activity SelectedActivty = lbxactivities1.SelectedItem as activity; //funds selected item

            //null check
            if (SelectedActivty != null)
            {
                //move from left to right
                AllActivties.Remove(SelectedActivty);
                selectedActivites.Add(SelectedActivty);
                AllActivties.Sort();
                selectedActivites.Sort();

                TotalCost     += SelectedActivty.Cost; //add to runnning total
                tblkTotal.Text = TotalCost.ToString(); //displays running total to screen


                RefreshScreen();
            }
            else if (SelectedActivty == null) // This displays a description when nothing is there to be added
            {
                txtboxdescription.Text = "Please select an activity to add first !";
            }
        }
예제 #2
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            //create activity objects


            activity A1 = new activity("kayaking", new DateTime(2019, 06, 01), 20m, "Instructor led group trek through local mountains.", ActivityType.Water);
            activity A2 = new activity("Treking", new DateTime(2019, 06, 01), 30m, "Instructor led half day mountain biking.  All equipment provided.", ActivityType.Land);
            activity A3 = new activity("Parachuting", new DateTime(2019, 06, 01), 40m, "Experience the rush of adrenaline as you descend cliff faces from 10-500m.", ActivityType.Air);
            activity A4 = new activity("Moutain Biking", new DateTime(2019, 06, 02), 40m, "Half day lakeland kayak with island picnic.", ActivityType.Land);
            activity A5 = new activity("Surfing", new DateTime(2019, 06, 02), 25m, "2 hour surf lesson on the wild atlantic way", ActivityType.Water);
            activity A6 = new activity("Hang Gliding", new DateTime(2019, 06, 02), 50m, "Full day lakeland kayak with island picnic.", ActivityType.Air);
            activity A7 = new activity("Absailing", new DateTime(2019, 06, 03), 100m, " Experience the thrill of free fall while you tandem jump from an airplane.", ActivityType.Land);
            activity A8 = new activity("Sailing", new DateTime(2019, 06, 03), 80m, "Soar on hot air currents and enjoy spectacular views of the coastal region.", ActivityType.Water);
            activity A9 = new activity("Helicopter", new DateTime(2019, 06, 03), 200m, "Experience the ultimate in aerial sight-seeing as you tour the area in our modern helicopters", ActivityType.Air);

            //add to a list
            AllActivties.Add(A1);
            AllActivties.Add(A2);
            AllActivties.Add(A3);
            AllActivties.Add(A4);
            AllActivties.Add(A5);
            AllActivties.Add(A6);
            AllActivties.Add(A7);
            AllActivties.Add(A8);
            AllActivties.Add(A9);


            //AllActivties.Sort();



            //display in list box
            lbxactivities1.ItemsSource = AllActivties;
        }
예제 #3
0
        private void Btnremove_Click(object sender, RoutedEventArgs e)
        {
            //know which item is selected


            activity SelectedActivty = lbxactivities2.SelectedItem as activity; //funds selected item

            //null check
            if (SelectedActivty != null)
            {
                //move from left to right
                AllActivties.Add(SelectedActivty);
                selectedActivites.Remove(SelectedActivty);
                AllActivties.Sort();
                selectedActivites.Sort();



                //refresh screen
                RefreshScreen();
            }
            else if (SelectedActivty == null) // This displays a description when nothing is there to remove
            {
                txtboxdescription.Text = "Please select an activity to remove first !";
            }
        }
예제 #4
0
        private void Lbxactivities1_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            activity SelectedActivty = lbxactivities1.SelectedItem as activity;

            if (SelectedActivty != null)
            {
                txtboxdescription.Text = SelectedActivty.Description;
            }
        }
예제 #5
0
        private void Txtboxcost_SelectionChanged(object sender, RoutedEventArgs e)
        {
            activity SelectedActivty = lbxactivities1.SelectedItem as activity;

            if (SelectedActivty != null)
            {
                //AllActivties.updateCost
            }
        }
예제 #6
0
        public int CompareTo(Object obj)
        {
            activity that = (activity)obj;

            return(ActivitiyDate.CompareTo(that.ActivitiyDate));
        }