Exemplo n.º 1
0
        public void AddNewPartyDay(DateTime date)
        {
            PartyDay newDay = new PartyDay(date);

            listOfDays.Add(newDay);
            listOfPartyDays.Add(newDay);
        }
Exemplo n.º 2
0
 public bool Equals(PartyDay other)
 {
     if (other == null)
     {
         return(false);
     }
     return(this.date.Equals(other.Date));
 }
Exemplo n.º 3
0
 // Domysly comparer
 public int CompareTo(PartyDay otherDay)
 {
     if (otherDay == null)
     {
         return(1);
     }
     else
     {
         return(this.date.CompareTo(otherDay.Date));
     }
 }
Exemplo n.º 4
0
        private void MainCalendar_SelectedDatesChanged(object sender, SelectionChangedEventArgs e)
        {
            DateTime selectedDay = MainCalendar.SelectedDate.Value;

            displayDayWithDate(selectedDay);
            PartyDay partyDay = organiserElements.ListOfPartyDays.ToList().Find(day => day.Date == selectedDay);

            if (partyDay != null)
            {
                DataContext = partyDay;
                makeGuestsElementsVisible();
            }
            else
            {
                DataContext = null;
                makeGuestsElementsInvisible();
            }
        }
Exemplo n.º 5
0
        private void addGuestButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                DateTime selectedDay = MainCalendar.SelectedDate.Value;

                int ind = organiserElements.ListOfPartyDays.ToList().FindIndex(d => d.Date == selectedDay);
                if (ind != -1)
                {
                    PartyDay day = organiserElements.ListOfPartyDays.ElementAt(ind);
                    day.Guests.Add(addGuestsTextBox.Text.ToString());
                    addGuestsTextBox.Clear();
                    DataContext = day;
                }
            }
            catch (System.InvalidOperationException ex)
            {
                MessageBox.Show("The day not selected", "Exception");
            }
        }
Exemplo n.º 6
0
 private void AddPartyDay_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DateTime selectedDay = MainCalendar.SelectedDate.Value;
         int      ind         = organiserElements.ListOfDays.ToList().IndexOf(new Day(selectedDay));
         if (ind == -1)
         {
             PartyDay pt = new PartyDay(selectedDay);
             organiserElements.AddNewPartyDay(selectedDay);
             DataContext = pt; //wybranie dnia do wyswietlanie w guestsListBox
             makeGuestsElementsVisible();
         }
         else  //dzien niedodany
         {
             MessageBox.Show("The Party Day already added!");
         }
     }
     catch (System.InvalidOperationException ex)
     {
         MessageBox.Show("Not valid", "Exception");
     }
 }