private Label CreateLabelForItem(AgendaItem item, AgendaItem prevItem)
        {
            // Create label
            Label lbl = new Label();
            lbl.Padding = new Padding(5);
            lbl.Width = this.Width;
            lbl.TextAlign = ContentAlignment.MiddleCenter;
            lbl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            lbl.AutoSize = false;
            lbl.Font = new System.Drawing.Font("Tahoma", 8, FontStyle.Bold);
            lbl.Text = item.CourseName;
            lbl.BackColor = item.BackColor;

            int top, height;
            GetLabelDisplayProperties(item.StartTime, item.EndTime, prevItem == null ? null : (DateTime?)prevItem.EndTime, out top, out height);

            lbl.Margin = new Padding(0, top, 0, 0);
            lbl.Height = height;
            lbl.Width = this.Width;

            return lbl;
        }
        private ToolTip CreateToolTipForItem(AgendaItem item, Label lbl)
        {
            // Create ToolTip
            ToolTip tt = new ToolTip();
            string courseID = item.CourseNumber + "." + (item.GroupNumber < 10 ? "0" + item.GroupNumber : item.GroupNumber.ToString());
            string tooltipText = item.EndTime.ToShortTimeString() + " - " + item.StartTime.ToShortTimeString() + "\n" +
                                 item.CourseName + "\n" +
                                 courseID + ", נ.ז: " + item.CourseCredit + "\n" +
                                 item.TeacherName;
            tt.InitialDelay = 0;
            tt.SetToolTip(lbl, tooltipText);
            tt.ToolTipTitle = item.CourseType == 1 ? "שיעור" : "תרגול";

            return tt;
        }
Ejemplo n.º 3
0
        private List<AgendaItem> ExtractAgendaItemsFromBlock(CourseBlock b)
        {
            List<AgendaItem> items = new List<AgendaItem>();

            // First class (if exists)
            if (b.HasFirstClass)
            {
                AgendaItem first = new AgendaItem()
                {
                    CourseNumber = b.ID,
                    CourseName = b.CourseTitle,
                    CourseType = b.TypeOfFirstClass,
                    TeacherName = b.TeacherNameOfFirstClass,
                    GroupNumber = b.GroupNumberForFirstClass,
                    StartTime = b.StartTimeSlotOfFirstClassEx.Value,
                    EndTime = b.EndTimeSlotOfFirstClassEx.Value,
                    Day = b.DayOfFirstClass,
                    CourseCredit = b.CourseCredit
                };
                items.Add(first);
            }

            // Second class (if exists)
            if (b.HasSecondClass)
            {
                AgendaItem second = new AgendaItem()
                {
                    CourseNumber = b.ID,
                    CourseName = b.CourseTitle,
                    CourseType = b.TypeOfSecondClass,
                    TeacherName = b.TeacherNameOfSecondClass,
                    GroupNumber = b.GroupNumberForSecondClass,
                    StartTime = b.StartTimeSlotOfSecondClassEx.Value,
                    EndTime = b.EndTimeSlotOfSecondClassEx.Value,
                    Day = b.DayOfSecondClass,
                    CourseCredit = b.CourseCredit
                };
                items.Add(second);
            }

            // Third class (if exists)
            if (b.HasThirdClass)
            {
                AgendaItem third = new AgendaItem()
                {
                    CourseNumber = b.ID,
                    CourseName = b.CourseTitle,
                    CourseType = b.TypeOfThirdClass,
                    TeacherName = b.TeacherNameOfThirdClass,
                    GroupNumber = b.GroupNumberForThirdClass,
                    StartTime = b.StartTimeSlotOfThirdClassEx.Value,
                    EndTime = b.EndTimeSlotOfThirdClassEx.Value,
                    Day = b.DayOfThirdClass,
                    CourseCredit = b.CourseCredit
                };
                items.Add(third);
            }

            return items;
        }