public void FillData(string title, string location, OrganizerEventType type, DateTime? start, DateTime? end, bool allDay)
 {
     this.TitleTextBox.Text = title;
     this.LocationTextBox.Text = location;
     this.EventTypeComboBox.SelectedValue = type;
     this.StartTimePicker.Value = start;
     this.EndTimePicker.Value = end;
     this.AllDayCheckBox.IsChecked = allDay;
 }
Пример #2
0
        protected OrganizerEvent(string title, string location, DateTime start, DateTime end, OrganizerEventType type)
        {
            if (end < start)
            {
                MessageBox.Show("Event start should always be before its end.");

                // throw new ArgumentException("Event start should always be before its end.");
            }

            this.Title = title;
            this.Location = location;
            this.eventType = type;
            this.End = end;
            this.Start = start;
        }
 public static OrganizerEvent CreateOrganizerEvent(OrganizerEventType type, string title, string location, DateTime start, DateTime end, bool allDay, params string[] otherFields)
 {
     OrganizerEvent newEvent = null;
     switch (type)
     {
         case OrganizerEventType.Meeting:
             newEvent = new MeetingEvent(title, location, start, end);
             break;
         case OrganizerEventType.Lecture:
             newEvent = new LectureEvent(title, location, start, end);
             break;
         case OrganizerEventType.Exercise:
             newEvent = new ExerciseEvent(title, location, start, end);
             break;
         case OrganizerEventType.Deadline:
             newEvent = new DeadlineEvent(title, location, start, end);
             break;
         case OrganizerEventType.Other:
             newEvent = new OtherEvent(title, location, start, end);
             break;
     }
     return newEvent;
 }
Пример #4
0
 //Method for updating the control's tab color according to the type of the event being displayed. Colors are set as constants at top of this file.
 private void SetTabColor(OrganizerEventType type)
 {
     Color tabColor;
     switch (type)
     {
         case OrganizerEventType.Meeting:
             tabColor = TabColorForMeeting;
             break;
         case OrganizerEventType.Lecture:
             tabColor = TabColorForLecture;
             break;
         case OrganizerEventType.Exercise:
             tabColor = TabColorForExercise;
             break;
         case OrganizerEventType.Deadline:
             tabColor = TabColorForDeadline;
             break;
         default:
             tabColor = TabColorForOther;
             break;
     }
     SolidColorBrush fill = new SolidColorBrush(tabColor);
     this.Body.Background = fill;
 }
Пример #5
0
        public void BindTo(OrganizerEvent dataSource)
        {
            if (dataSource != null)
            {
                //Bind event Title.
                Binding titleBinding = new Binding("Title");
                titleBinding.Source = dataSource;
                this.SetBinding(EventControl.TitleProperty, titleBinding);

                //Bind event Location.
                Binding locationBinding = new Binding("Location");
                locationBinding.Source = dataSource;
                this.SetBinding(EventControl.LocationProperty, locationBinding);

                //Get event Type. (eventType field is readony for the derived types of OrganizerEvent class)
                this.Type = dataSource.EventType;

                //Bind event start.
                Binding startBinding = new Binding("Start");
                startBinding.Source = dataSource;
                this.SetBinding(EventControl.StartTimeProperty, startBinding);

                //Bind event end.
                Binding endBinding = new Binding("End");
                endBinding.Source = dataSource;
                this.SetBinding(EventControl.EndTimeProperty, endBinding);
            }
        }