Beispiel #1
0
        private void logOffToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Hide();
            OpeningLogIn opening = new OpeningLogIn();

            if (opening.ShowDialog() != DialogResult.OK)
            {
                this.Close();
                return;
            }

            userToolStripMenuItem.Text = DataModel.ActiveUser.UserName;

            plansToolStripComboBox.Items.Clear();
            plansToolStripComboBox.Items.Add("All plans");
            plansToolStripComboBox.Items.AddRange(DataModel.Plans.ToArray());
            plansToolStripComboBox.SelectedIndex     = 0;
            CalendarModel.Day.plansToolStripComboBox = plansToolStripComboBox;

            views[0].Load(new CalendarModel.Day(DateTime.Today));
            rightViews[0].Load(new CalendarModel.Day(DateTime.Today.AddMonths(1)));
            rightViews[1].Load(new CalendarModel.Day(DateTime.Today));
            rightViews[2].Load(new CalendarModel.Day(DateTime.Today.AddMonths(-1)));

            this.Show();
        }
Beispiel #2
0
        public Calendar()
        {
            InitializeComponent();

            OpeningLogIn opening = new OpeningLogIn();

            if (opening.ShowDialog() != DialogResult.OK)
            {
                this.Close();
                return;
            }

            userToolStripMenuItem.Text = DataModel.ActiveUser.UserName;

            dayManager = new DayManager(this);
            CalendarModel.Day.plansToolStripComboBox = plansToolStripComboBox;

            views = new List <View>();
            views.Add(new MonthView(bigMonthPageTableLayoutPanel, monthPageTitle, dayManager));
            views.Add(new WeekView(weekPageTableLayoutPanel, weekPageTitle, weekHeaderTableLayoutPanel, dayManager));
            views.Add(new DayView(dayPageTableLayoutPanel, dayPageTitle, dayManager));
            views[0].Load(new CalendarModel.Day(DateTime.Today));

            rightViews = new List <RightMonthView>();
            rightViews.Add(new RightMonthView(nextMonthTableLayoutPanel, nextMonthTitle));
            rightViews.Add(new RightMonthView(thisMonthTableLayoutPanel, thisMonthTitle));
            rightViews.Add(new RightMonthView(previousMonthTableLayoutPanel, previousMonthTitle));
            rightViews[0].Load(new CalendarModel.Day(DateTime.Today.AddMonths(1)));
            rightViews[1].Load(new CalendarModel.Day(DateTime.Today));
            rightViews[2].Load(new CalendarModel.Day(DateTime.Today.AddMonths(-1)));

            calendarsTabControl.SelectedIndexChanged += new EventHandler(calendarsTabControl_SelectedIndexChanged);
            this.SizeChanged                            += new EventHandler(form_SizeChanged);
            backButton1.Click                           += new EventHandler(backButton_Click);
            backButton2.Click                           += new EventHandler(backButton_Click);
            upButton.Click                              += new EventHandler(upButton_Click);
            downButton.Click                            += new EventHandler(downButton_Click);
            okEventButton.Click                         += new EventHandler(okEventButton_Click);
            okEventButton.MouseEnter                    += new EventHandler(button_MouseEnter);
            okEventButton.MouseLeave                    += new EventHandler(button_MouseLeave);
            addEventButton.MouseEnter                   += new EventHandler(button_MouseEnter);
            addEventButton.MouseLeave                   += new EventHandler(button_MouseLeave);
            deleteEventButton.MouseEnter                += new EventHandler(button_MouseEnter);
            deleteEventButton.MouseLeave                += new EventHandler(button_MouseLeave);
            backButton1.MouseEnter                      += new EventHandler(button_MouseEnter);
            backButton1.MouseLeave                      += new EventHandler(button_MouseLeave);
            backButton2.MouseEnter                      += new EventHandler(button_MouseEnter);
            backButton2.MouseLeave                      += new EventHandler(button_MouseLeave);
            rightDayButton.MouseEnter                   += new EventHandler(button_MouseEnter);
            rightDayButton.MouseLeave                   += new EventHandler(button_MouseLeave);
            rightWeekButton.MouseEnter                  += new EventHandler(button_MouseEnter);
            rightWeekButton.MouseLeave                  += new EventHandler(button_MouseLeave);
            rightMonthButton.MouseEnter                 += new EventHandler(button_MouseEnter);
            rightMonthButton.MouseLeave                 += new EventHandler(button_MouseLeave);
            leftDayButton.MouseEnter                    += new EventHandler(button_MouseEnter);
            leftDayButton.MouseLeave                    += new EventHandler(button_MouseLeave);
            leftWeekButton.MouseEnter                   += new EventHandler(button_MouseEnter);
            leftWeekButton.MouseLeave                   += new EventHandler(button_MouseLeave);
            leftMonthButton.MouseEnter                  += new EventHandler(button_MouseEnter);
            leftMonthButton.MouseLeave                  += new EventHandler(button_MouseLeave);
            downButton.MouseEnter                       += new EventHandler(button_MouseEnter);
            downButton.MouseLeave                       += new EventHandler(button_MouseLeave);
            upButton.MouseEnter                         += new EventHandler(button_MouseEnter);
            upButton.MouseLeave                         += new EventHandler(button_MouseLeave);
            inviteButton.MouseEnter                     += new EventHandler(button_MouseEnter);
            inviteButton.MouseLeave                     += new EventHandler(button_MouseLeave);
            respondInvitationButton.MouseEnter          += new EventHandler(button_MouseEnter);
            respondInvitationButton.MouseLeave          += new EventHandler(button_MouseLeave);
            addEventButton.Click                        += new EventHandler(addEventButton_Click);
            deleteEventButton.Click                     += new EventHandler(deleteEventButton_Click);
            plansToolStripComboBox.SelectedIndexChanged += new EventHandler(plansToolStripComboBox_IndexChanged);
            settingsToolStripMenuItem.Click             += new EventHandler(settingsToolStripMenuItem_Click);
            logOffToolStripMenuItem.Click               += new EventHandler(logOffToolStripMenuItem_Click);
            inviteButton.Click                          += new EventHandler(inviteButton_Click);
            respondInvitationButton.Click               += new EventHandler(respondInvitationButton_Click);
            userToolStripMenuItem.DropDownOpened        += new EventHandler(userToolStripMenuItem_DropDownOpened);
            userToolStripMenuItem.DropDownClosed        += new EventHandler(userToolStripMenuItem_DropDownClosed);

            typeEventComboBox.DataSource = DataModel.Types;

            plansToolStripComboBox.Items.AddRange(DataModel.Plans.ToArray());
            plansToolStripComboBox.SelectedIndex = 0;
        }