Exemplo n.º 1
0
        public Form2()
        {
            InitializeComponent();

            var newEvent = new ScheduleBoxEvent();

            // Create absolutely new event
            newEvent = new ScheduleBoxEvent();
            newEvent.Start = DateTime.Now;
            newEvent.End = newEvent.Start.AddHours(1);
            newEvent.Subject = "This is a test Subject";
            newEvent.Tag = "This is a test tag";
            this.scheduleBox1.Events.Add(newEvent);
            this.scheduleBox1.Show();
        }
 public void Remove(ScheduleBoxEvent objEvent)
 {
     if (this.mobjEvents.Contains(objEvent))
     {
         this.mobjEvents.Remove(objEvent);
         this.mobjOwner.OnEventRemoved(objEvent);
     }
 }
 public ScheduleBoxEvent Add(string strSubject, DateTime objStart, DateTime objEnd)
 {
     this.mintLastEventId++;
     ScheduleBoxEvent event2 = new ScheduleBoxEvent(this.mobjOwner, this.mintLastEventId, strSubject, objStart, objEnd);
     this.mobjEvents.Add(event2);
     this.mobjOwner.OnEventAdded(event2);
     return event2;
 }
 public int Add(ScheduleBoxEvent objEvent)
 {
     if (objEvent != null)
     {
         this.mintLastEventId++;
         objEvent.EventId = this.mintLastEventId;
         objEvent.Owner = this.mobjOwner;
         int num = this.mobjEvents.Add(objEvent);
         this.mobjOwner.OnEventAdded(objEvent);
         return num;
     }
     return -1;
 }
Exemplo n.º 5
0
 internal EventSite(ScheduleBoxEvent objEvent)
 {
     this.Event = objEvent;
     this.mobjShared = new ArrayList();
 }
Exemplo n.º 6
0
 public ScheduleBoxEventArgs(ScheduleBoxEvent objEvent)
 {
     this.mobjEvent = objEvent;
 }
Exemplo n.º 7
0
 private void RenderEventEvents(IResponseWriter objWriter, ScheduleBoxEvent objEvent)
 {
     EventTypes eventCriticalEvents = this.GetEventCriticalEvents(objEvent);
     if (eventCriticalEvents != EventTypes.None)
     {
         objWriter.WriteAttributeString("E", ((int)eventCriticalEvents).ToString());
     }
 }
Exemplo n.º 8
0
 private EventTypes GetEventCriticalEvents(ScheduleBoxEvent objEvent)
 {
     EventTypes none = EventTypes.None;
     if ((objEvent.ContextMenu == null) && (this.ContextMenu == null))
     {
         return none;
     }
     return (none | EventTypes.RightClick);
 }
Exemplo n.º 9
0
        protected override void Render(IContext objContext, IResponseWriter objWriter, long lngRequestID)
        {
            objWriter.WriteAttributeString("HourFormat", this.HourFormat.ToString());
            objWriter.WriteAttributeString("DisplayMonthHeader", this.displayMonthHeader.ToString());
            if ((this.mintWorkStartHour != 8) || (this.mintWorkEndHour != 0x11))
            {
                objWriter.WriteAttributeString("WorkStartHour", this.mintWorkStartHour.ToString());
                objWriter.WriteAttributeString("WorkEndHour", this.mintWorkEndHour.ToString());
            }
            if (this.menmView != ScheduleBoxView.Month)
            {
                objWriter.WriteAttributeString("VW", "Days");
                if (this.menmView == ScheduleBoxView.FullMonth)
                {
                    objWriter.WriteAttributeString("FullMonth", "Yes");
                }
                else
                {
                    objWriter.WriteAttributeString("FullMonth", "No");
                }
            }
            else
            {
                objWriter.WriteAttributeString("VW", "Month");
                DateTime time = new DateTime(this.FirstDate.Year, this.FirstDate.Month, 1, 0, 0, 0);
                DateTime time2 = new DateTime(this.FirstDate.Year, this.FirstDate.Month, 1, 0, 0, 0);
                objWriter.WriteAttributeString("CurrentMonthHeader", this.FirstDate.ToString("yyyy年M月"));
                time2 = time2.AddMonths(1).AddDays(-1.0);
                int num = this.DayToNumber(this.menmFirstDayOfWeek);
                int num2 = this.DayToNumber(time.DayOfWeek);
                int num3 = 0;
                if (num <= num2)
                {
                    num3 = (num2 - num) + 1;
                }
                else
                {
                    num3 = (7 - (num - num2)) + 1;
                }
                objWriter.WriteAttributeString("DisplayStart", num3.ToString());
                objWriter.WriteAttributeString("DisplayDays", time2.Day.ToString());
            }
            switch (this.menmFirstDayOfWeek)
            {
                case Day.Sunday:
                case Day.Default:
                    objWriter.WriteAttributeString("DisplatFirstWeekDay", "1");
                    break;

                case Day.Monday:
                    objWriter.WriteAttributeString("DisplatFirstWeekDay", "2");
                    break;
            }
            ArrayList days = this.Days;
            ArrayList allDayEvents = this.Events.AllDayEvents;
            SortedList list3 = new SortedList();
            SortedList list4 = new SortedList();
            ScheduleBoxEvent[,] eventArray = new ScheduleBoxEvent[days.Count, 30];
            int index = 0;
            foreach (DateTime time3 in days)
            {
                if ((this.menmView == ScheduleBoxView.FullMonth) && this.displayMonthHeader)
                {
                    if ((list3.Count == 0) || !list3.ContainsKey(time3.Month))
                    {
                        list3.Add(time3.Month, 1);
                        list4.Add(time3.Month, time3.Year);
                    }
                    else if (list3.ContainsKey(time3.Month))
                    {
                        list3[time3.Month] = ((int)list3[time3.Month]) + 1;
                    }
                }
                foreach (ScheduleBoxEvent event2 in allDayEvents)
                {
                    if (!event2.IsInRange(time3))
                    {
                        continue;
                    }
                    int num5 = -1;
                    for (int j = 0; j < 30; j++)
                    {
                        if (num5 == -1)
                        {
                            if (eventArray[index, j] != null)
                            {
                                continue;
                            }
                            if ((index > 0) && (eventArray[index - 1, j] != null))
                            {
                                ScheduleBoxEvent event3 = eventArray[index - 1, j];
                                if ((event3 != event2) && event3.IsInRange(time3))
                                {
                                    continue;
                                }
                            }
                            if (eventArray[index, j] == null)
                            {
                                num5 = j;
                                if (index == 0)
                                {
                                    break;
                                }
                            }
                        }
                        if ((index > 0) && (eventArray[index - 1, j] == event2))
                        {
                            num5 = j;
                            break;
                        }
                    }
                    eventArray[index, num5] = event2;
                }
                index++;
            }
            if ((this.menmView == ScheduleBoxView.FullMonth) && this.displayMonthHeader)
            {
                if (list3.Count > 1)
                {
                    if (((int)list4.GetByIndex(0)) <= ((int)list4.GetByIndex(1)))
                    {
                        objWriter.WriteStartElement("Month");
                        objWriter.WriteAttributeString("MonthDays", list3.GetByIndex(0).ToString());
                        objWriter.WriteAttributeString("MonthHeader", this.GetMonthString((int)list3.GetKey(0)) + " / " + ((int)list4[(int)list3.GetKey(0)]).ToString());
                        objWriter.WriteEndElement();
                        objWriter.WriteStartElement("Month");
                        objWriter.WriteAttributeString("MonthDays", list3.GetByIndex(1).ToString());
                        objWriter.WriteAttributeString("MonthHeader", this.GetMonthString((int)list3.GetKey(1)) + " / " + ((int)list4[(int)list3.GetKey(1)]).ToString());
                        objWriter.WriteEndElement();
                    }
                    else
                    {
                        objWriter.WriteStartElement("Month");
                        objWriter.WriteAttributeString("MonthDays", list3.GetByIndex(1).ToString());
                        objWriter.WriteAttributeString("MonthHeader", this.GetMonthString((int)list3.GetKey(1)) + " / " + ((int)list4[(int)list3.GetKey(1)]).ToString());
                        objWriter.WriteEndElement();
                        objWriter.WriteStartElement("Month");
                        objWriter.WriteAttributeString("MonthDays", list3.GetByIndex(0).ToString());
                        objWriter.WriteAttributeString("MonthHeader", this.GetMonthString((int)list3.GetKey(0)) + " / " + ((int)list4[(int)list3.GetKey(0)]).ToString());
                        objWriter.WriteEndElement();
                    }
                }
                else
                {
                    objWriter.WriteStartElement("Month");
                    objWriter.WriteAttributeString("MonthDays", list3.GetByIndex(0).ToString());
                    objWriter.WriteAttributeString("MonthHeader", this.GetMonthString((int)list3.GetKey(0)) + " / " + ((int)list4[(int)list3.GetKey(0)]).ToString());
                    objWriter.WriteEndElement();
                }
            }
            for (int i = 0; i < 30; i++)
            {
                bool flag = false;
                ScheduleBoxEvent event4 = null;
                index = 0;
                while (index < days.Count)
                {
                    if (eventArray[index, i] != null)
                    {
                        objWriter.WriteStartElement("Row");
                        flag = true;
                        break;
                    }
                    index++;
                }
                for (index = 0; index < days.Count; index++)
                {
                    ScheduleBoxEvent objEvent = eventArray[index, i];
                    if ((objEvent != null) && (event4 != objEvent))
                    {
                        objWriter.WriteStartElement("Event");
                        objWriter.WriteAttributeString("mId", objEvent.ID);
                        objWriter.WriteAttributeString("oId", this.ID.ToString());
                        this.RenderEventEvents(objWriter, objEvent);
                        objWriter.WriteAttributeString("Start", (index + 1).ToString());
                        int num8 = 1;
                        while ((index + num8) < days.Count)
                        {
                            if (eventArray[index + num8, i] != objEvent)
                            {
                                break;
                            }
                            num8++;
                        }
                        objWriter.WriteAttributeString("Duration", num8.ToString());
                        objWriter.WriteAttributeString("Subject", objEvent.Subject);
                        objWriter.WriteEndElement();
                        event4 = objEvent;
                    }
                }
                if (!flag)
                {
                    break;
                }
                objWriter.WriteEndElement();
            }
            ArrayList[] listArray = new ArrayList[days.Count];
            ArrayList partialDayEvents = this.Events.PartialDayEvents;
            index = 0;
            foreach (DateTime time4 in days)
            {
                listArray[index] = new ArrayList();
                ArrayList list6 = new ArrayList(partialDayEvents);
                foreach (ScheduleBoxEvent event6 in list6)
                {
                    if (event6.IsInRange(time4))
                    {
                        partialDayEvents.Remove(event6);
                        listArray[index].Add(new EventSite(event6));
                    }
                }
                index++;
            }
            index = 0;
            foreach (ArrayList list7 in listArray)
            {
                list7.Sort();
                foreach (EventSite site in list7)
                {
                    foreach (EventSite site2 in list7)
                    {
                        if ((!site.HasShare(site2) && (site != site2)) && (((site.Event.Start <= site2.Event.Start) && (site.Event.End >= site2.Event.Start)) || ((site.Event.End >= site2.Event.End) && (site.Event.Start <= site2.Event.End))))
                        {
                            site.Share++;
                            site.AddShare(site2);
                            site2.Share++;
                            site2.AddShare(site);
                            site2.Left++;
                        }
                    }
                }
                objWriter.WriteStartElement("Day");
                DateTime time11 = (DateTime)days[index];
                objWriter.WriteAttributeString("Number", time11.Day.ToString());
                DateTime time5 = (DateTime)days[index];
                if (time5.Day == DateTime.Now.Day)
                {
                    objWriter.WriteAttributeString("IsToday", "1");
                }
                if (this.menmView != ScheduleBoxView.FullMonth)
                {
                    time5 = (DateTime)days[index];
                    if (this.menmView == ScheduleBoxView.FullWeek || this.menmView == ScheduleBoxView.Week)
                    {
                        var week = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(time5.DayOfWeek);
                        objWriter.WriteAttributeString("TL", ToShortTimeAndWeekDay(time5));
                    }
                    else
                    {
                        objWriter.WriteAttributeString("TL", time5.ToShortDateString());
                    }
                }
                else
                {
                    objWriter.WriteAttributeString("TL", ((DateTime)days[index]).ToString("dd"));
                }
                foreach (EventSite site3 in list7)
                {
                    objWriter.WriteStartElement("Event");
                    objWriter.WriteAttributeString("Start", site3.Event.StartHalfHoursFromMidnight.ToString());
                    objWriter.WriteAttributeString("Duration", site3.Event.Duration.ToString(CultureInfo.InvariantCulture));
                    double offsetY = site3.Event.OffsetY;
                    if (offsetY > 0.0)
                    {
                        objWriter.WriteAttributeString("OY", offsetY.ToString(CultureInfo.InvariantCulture));
                    }
                    objWriter.WriteAttributeString("mId", site3.Event.ID);
                    objWriter.WriteAttributeString("oId", this.ID.ToString());
                    this.RenderEventEvents(objWriter, site3.Event);
                    objWriter.WriteAttributeString("Subject", site3.Event.Subject);
                    objWriter.WriteAttributeString("Left", site3.Left.ToString());
                    objWriter.WriteAttributeString("Share", site3.Share.ToString());
                    objWriter.WriteEndElement();
                }
                objWriter.WriteEndElement();
                index++;
            }
        }
Exemplo n.º 10
0
 internal void OnEventUpdated(ScheduleBoxEvent objEvent)
 {
     this.Update();
 }