コード例 #1
0
        private void LbxSelectedActivities_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Activities selectedactivities = lbxSelectedActivities.SelectedItem as Activities;

            if (selectedactivities != null)
            {
                TxblkDescription.Text = selectedactivities.Description;
            }
        }
コード例 #2
0
        private void BtnRemove_Click(object sender, RoutedEventArgs e)
        {
            Activities selectedactivities = lbxSelectedActivities.SelectedItem as Activities;

            if (selectedactivities != null)
            {
                allactivities.Add(selectedactivities);
                selectedActivities.Remove(selectedactivities);

                lbxAllActivities.ItemsSource = null;
                lbxAllActivities.ItemsSource = allactivities;

                lbxSelectedActivities.ItemsSource = null;
                lbxSelectedActivities.ItemsSource = selectedActivities;


                total = total - selectedactivities.Cost;

                tbxTotal.Text = total.ToString();
            }
        }
コード例 #3
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            Activities l1 = new Activities("Mountain Biking", "Going up mountain on bike", new DateTime(2019, 6, 2), 40, ActivityType.Land);
            Activities l2 = new Activities("Abseiling", "controlled descent off a vertical drop", new DateTime(2019, 6, 3), 65, ActivityType.Land);
            Activities l3 = new Activities("Treking", "hiking up mountains", new DateTime(2019, 6, 1), 92, ActivityType.Land);
            Activities w1 = new Activities("Kayaking", "Boat Rowing", new DateTime(2019, 6, 1), 20, ActivityType.Water);
            Activities w2 = new Activities("Sailing", "Sailing", new DateTime(2019, 6, 3), 35, ActivityType.Water);
            Activities w3 = new Activities("Surfing", "Riding the waves", new DateTime(2019, 6, 5), 92, ActivityType.Water);
            Activities a1 = new Activities("Parachuting", "Droping from big height with parachute ", new DateTime(2019, 6, 1), 100, ActivityType.Air);
            Activities a2 = new Activities("Hang Gliding", "Flying with a glider", new DateTime(2019, 6, 2), 50, ActivityType.Air);
            Activities a3 = new Activities("Helicopter Tour", "sight seeing in helicopter", new DateTime(2019, 6, 4), 92, ActivityType.Air);



            allactivities.Add(l1);
            allactivities.Add(l2);
            allactivities.Add(l3);
            allactivities.Add(w1);
            allactivities.Add(w2);
            allactivities.Add(w3);
            allactivities.Add(a1);
            allactivities.Add(a2);
            allactivities.Add(a3);
        }