Esempio n. 1
0
        /**************************************************************
        * EVENTS                                                      *
        * ************************************************************/

        //--Fill the fields with the values of the selected event
        private void eventsList_SelectedIndexChanged(object sender, EventArgs e)
        {
            CalendarEventType cEv = (CalendarEventType)this.eventsList.SelectedItem;

            if (cEv == null)
            {
                return;
            }
            this.weekdayStart.SelectedIndex           = cEv.resolveDay();
            this.hourStart.Value                      = cEv.start.hour;
            this.minuteStart.Value                    = cEv.start.minute;
            this.secondStart.Value                    = cEv.start.second;
            this.dayDuration.Value                    = cEv.duration.days;
            this.hoursDuration.Value                  = cEv.duration.hours;
            this.minutesDuration.Value                = cEv.duration.minutes;
            this.secondsDuration.Value                = cEv.duration.seconds;
            this.processPriorityComboBox.SelectedItem = Enum.GetName(typeof(ProcessPriorityClass), cEv.config.processPriority);
            this.maxCpuUsageNumericUpDown.Value       = cEv.config.maxCpuUsage;
            this.eventEditorGroup.Enabled             = true;
        }
Esempio n. 2
0
        public void loadEvents(List <CalendarEventType> eventsList)
        {
            rects.Clear();
            foreach (CalendarEventType ev in eventsList)
            {
                CalendarEventType cEv = (CalendarEventType)ev;

                //--Start
                int dayTimeslot   = 43 + cEv.resolveDay() * 35;
                int startTimeslot = (30 + (10 * cEv.start.hour)) + ((cEv.start.minute * 10) / 60);


                //--Duration
                int timeRemain = 1440 - (cEv.start.hour * 60) - cEv.start.minute;
                //--On compare le nb de min qu'il reste avec le nb de minute d'une journée
                int duration  = (cEv.duration.days * 1440) + (cEv.duration.hours * 60) + cEv.duration.minutes;
                int heightBar = 0;

                if (duration <= timeRemain)
                {
                    //--No overruning
                    heightBar = duration * 10 / 60;
                }
                else
                {
                    heightBar = timeRemain * 10 / 60;
                    //--Overflow
                    duration -= timeRemain;
                    int       startDay      = cEv.resolveDay();
                    int       heightBarNext = 0;
                    Rectangle rectNext;

                    while (duration > 0)
                    {
                        //--Day column selection
                        if (startDay > 5)
                        {
                            startDay = 0;
                        }
                        else
                        {
                            startDay++;
                        }
                        if (duration <= 1440)
                        {
                            heightBarNext = duration * 10 / 60;
                        }
                        else
                        {
                            heightBarNext = 1440 * 10 / 60;
                        }

                        rectNext = new Rectangle(new Point(43 + startDay * 35, 30), new Size(WITH_BAR, heightBarNext));
                        rects.Add(rectNext);
                        duration -= 1440;
                    }
                }
                Rectangle rect = new Rectangle(new Point(dayTimeslot, startTimeslot), new Size(WITH_BAR, heightBar));
                rects.Add(rect);
            }
        }