Esempio n. 1
0
 private void cancelButton2_Click(object sender, EventArgs e)
 {
     errorProvider1.SetError(mailAddressTextBox, "");
     mailAddressTextBox.Text = DataModel.EmailAddress;
     if (mailAddressTextBox.Text == string.Empty)
     {
         Calendar.SetWatermarkTextBox(mailAddressTextBox, "Please type here...");
     }
 }
Esempio n. 2
0
 private void cancelButton1_Click(object sender, EventArgs e)
 {
     newPlanTextBox.Text = string.Empty;
     Calendar.SetWatermarkTextBox(newPlanTextBox, "Please type here...");
     errorProvider1.SetError(newPlanTextBox, "");
     while (plansCheckedListBox.Items.Count > 0)
     {
         plansCheckedListBox.Items.RemoveAt(0);
     }
     plansCheckedListBox.Items.AddRange(DataModel.Plans.ToArray());
     newPlans = DataModel.Plans;
 }
Esempio n. 3
0
        public Settings()
        {
            InitializeComponent();

            while (plansCheckedListBox.Items.Count > 0)
            {
                plansCheckedListBox.Items.RemoveAt(0);
            }
            plansCheckedListBox.Items.AddRange(DataModel.Plans.ToArray());
            newPlans = DataModel.Plans;

            Calendar.SetWatermarkTextBox(newPlanTextBox, "Please type here...");

            currentHeaderButton = plansButton;

            mailAddressTextBox.Text = DataModel.EmailAddress;
            if (mailAddressTextBox.Text == string.Empty)
            {
                Calendar.SetWatermarkTextBox(mailAddressTextBox, "Please type here...");
            }

            plansButton.Click            += new EventHandler(headerButton_Click);
            accountButton.Click          += new EventHandler(headerButton_Click);
            addPlanButton.Click          += new EventHandler(addPlanButton_Click);
            deletePlansButton.Click      += new EventHandler(deletePlansButton_Click);
            acceptButton1.Click          += new EventHandler(acceptButton1_Click);
            acceptButton2.Click          += new EventHandler(acceptButton2_Click);
            cancelButton1.Click          += new EventHandler(cancelButton1_Click);
            cancelButton2.Click          += new EventHandler(cancelButton2_Click);
            acceptButton1.MouseEnter     += new EventHandler(button_MouseEnter);
            acceptButton1.MouseLeave     += new EventHandler(button_MouseLeave);
            acceptButton2.MouseEnter     += new EventHandler(button_MouseEnter);
            acceptButton2.MouseLeave     += new EventHandler(button_MouseLeave);
            cancelButton1.MouseEnter     += new EventHandler(cancelButton_MouseEnter);
            cancelButton1.MouseLeave     += new EventHandler(cancelButton_MouseLeave);
            cancelButton2.MouseEnter     += new EventHandler(cancelButton_MouseEnter);
            cancelButton2.MouseLeave     += new EventHandler(cancelButton_MouseLeave);
            addPlanButton.MouseEnter     += new EventHandler(button_MouseEnter);
            addPlanButton.MouseLeave     += new EventHandler(button_MouseLeave);
            deletePlansButton.MouseEnter += new EventHandler(button_MouseEnter);
            deletePlansButton.MouseLeave += new EventHandler(button_MouseLeave);
        }
Esempio n. 4
0
        public void ShowEventEditor(Event myEvent = null)
        {
            while (calendar.PlansCheckedListBox.Items.Count > 0)
            {
                calendar.PlansCheckedListBox.Items.RemoveAt(0);
            }
            calendar.PlansCheckedListBox.Items.AddRange(DataModel.Plans.ToArray());

            calendar.ErrorProvider1.SetError(calendar.NameEventTextBox, "");
            calendar.ErrorProvider1.SetError(calendar.EndDateTimePicker, "");
            calendar.ErrorProvider1.SetError(calendar.TypeEventComboBox, "");

            usersToInvite = new List <int>();
            calendar.InvitedListView.Items.Clear();
            calendar.InvitedListView.Items.Add(new ListViewItem("me"));

            if (myEvent != null)
            {
                calendar.NameEventTextBox.Text          = myEvent.Name;
                calendar.TypeEventComboBox.SelectedItem = DataModel.Types.FindAll(t => t.Id == myEvent.Type.Id).First();
                calendar.StartDateTimePicker.Value      = myEvent.Start;
                calendar.EndDateTimePicker.Value        = myEvent.End;
                List <Plan> plans = myEvent.Plans.ToList();
                foreach (Plan p in plans)
                {
                    for (int i = 0; i < calendar.PlansCheckedListBox.Items.Count; i++)
                    {
                        if ((calendar.PlansCheckedListBox.Items[i] as Plan).Id == p.Id)
                        {
                            calendar.PlansCheckedListBox.SetItemChecked(i, true);
                            break;
                        }
                    }
                }
                List <EventApproval> approvals = DataModel.EventApprovals.Where(ea => ea.EventId == myEvent.Id).ToList();
                foreach (EventApproval approval in approvals)
                {
                    if (approval.UserId != DataModel.ActiveUser.Id)
                    {
                        calendar.InvitedListView.Items.Add(new ListViewItem(DataModel.Users.Where(u => u.Id == approval.UserId).First().UserName));
                    }
                }
                if (DataModel.EventApprovals.Any(ea => ea.EventId == myEvent.Id && ea.UserId == DataModel.ActiveUser.Id && ea.Accepted))
                {
                    calendar.RespondInvitationButton.ImageList  = calendar.CrossImageList;
                    calendar.RespondInvitationButton.ImageIndex = 1;
                    calendar.RespondInvitationButton.Text       = "Not going";
                    calendar.RespondInvitationButton.Tag        = true;
                }
                else
                {
                    calendar.RespondInvitationButton.ImageList  = calendar.AcceptImageList;
                    calendar.RespondInvitationButton.ImageIndex = 1;
                    calendar.RespondInvitationButton.Text       = "Going";
                    calendar.RespondInvitationButton.Tag        = false;
                }
            }
            else
            {
                editedEventIndex = -1;
                calendar.NameEventTextBox.Text = string.Empty;
                Calendar.SetWatermarkTextBox(calendar.NameEventTextBox, "Please type here...");
                calendar.TypeEventComboBox.SelectedIndex = -1;
                calendar.StartDateTimePicker.Value       = new DateTime(shownDay.Year, shownDay.Month, shownDay.Number);
                calendar.EndDateTimePicker.Value         = new DateTime(shownDay.Year, shownDay.Month, shownDay.Number);
            }

            calendar.RightTabControl.SelectedIndex = 2;
        }