Beispiel #1
0
        private void ButtonEvents_Click(object sender, RoutedEventArgs e)
        {
            MyEvents myEvents = new MyEvents(user);

            myEvents.ShowDialog();
            calendar = Utils.ReadEventsSerialFile();
            Week newWeekView = new Week(month, year, user);

            newWeekView.Show();
            this.Close();
        }
Beispiel #2
0
        private void NewEventBtn_Click(Object sender, EventArgs e)
        {
            NewEvent newEvent = new NewEvent(user);

            newEvent.ShowDialog();
            calendar = Utils.ReadEventsSerialFile();
            Week newWeekView = new Week(month, year, user);

            newWeekView.Show();
            this.Close();
        }
Beispiel #3
0
        void InitListWiev(int numberOfMonth)
        {
            List <Week> month = new List <Week>();

            int      i          = 0;
            int      j          = 0;
            DateTime date       = new DateTime(2018, numberOfMonth, 1);
            int      dayInMonth = DateTime.DaysInMonth(2018, numberOfMonth);
            int      dayOfWeek  = (int)date.DayOfWeek;

            switch (dayOfWeek)
            {
            case 1:
                week = new Week("1", "2", "3", "4", "5", "6", "7");
                i    = 7;
                break;

            case 2:
                week = new Week("", "1", "2", "3", "4", "5", "6");
                i    = 6;
                break;

            case 3:
                week = new Week("", "", "1", "2", "3", "4", "5");
                i    = 5;
                break;

            case 4:
                week = new Week("", "", "", "1", "2", "3", "4");
                i    = 4;
                break;

            case 5:
                week = new Week("", "", "", "", "1", "2", "3");
                i    = 3;
                break;

            case 6:
                week = new Week("", "", "", "", "", "1", "2");
                i    = 2;
                break;

            case 7:
                week = new Week("", "", "", "", "", "", "1");
                i    = 1;
                break;

            default:
                break;
            }
            int numberFullWeek = (dayInMonth - i) / 7;
            int restOfDay      = (dayInMonth - i) % 7;

            month.Add(week);
            while (j < numberFullWeek)
            {
                week = new Week((++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString());
                j++;
                month.Add(week);
            }
            switch (restOfDay)
            {
            case 1:
                week = new Week((++i).ToString(), "", "", "", "", "", "");
                break;

            case 2:
                week = new Week((++i).ToString(), (++i).ToString(), "", "", "", "", "");
                break;

            case 3:
                week = new Week((++i).ToString(), (++i).ToString(), (++i).ToString(), "", "", "", "");
                break;

            case 4:
                week = new Week((++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), "", "", "");
                break;

            case 5:
                week = new Week((++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), "", "");
                break;

            case 6:
                week = new Week((++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), (++i).ToString(), "");
                break;

            default:
                break;
            }
            month.Add(week);
            monthList.ItemsSource = month;
        }