private void HideWeekends(bool hide)
        {
            var scales = schedulerControl1.TimelineView.Scales;

            try
            {
                scales.BeginUpdate();
                scales.Clear();
                scales.Add(new TimeScaleMonth());
                if (hide)
                {
                    var customWorkWeekScale    = new MyTimeScaleWorkWeekDays();
                    var customTimeScaleHour    = new MyTimeScaleWorkHours();
                    var customTimeScaleMinutes = new TimeScaleFixedInterval(TimeSpan.FromMinutes(30));

                    customWorkWeekScale.Width    = 125;
                    customTimeScaleHour.Width    = 125;
                    customTimeScaleMinutes.Width = 125;

                    scales.Add(customWorkWeekScale);
                    scales.Add(customTimeScaleHour);
                    scales.Add(customTimeScaleMinutes);
                }
                else
                {
                    scales.Add(new TimeScaleDay());
                    var hourScale = new TimeScaleHour();
                    hourScale.Width = 125;
                    scales.Add(hourScale);
                }
            }
            finally
            {
                scales.EndUpdate();
            }
        }
예제 #2
0
        private void LoadScheduler()
        {
            if (IterationScheduler != null)
            {
                return;
            }
            IterationScheduler = new SchedulerControl();
            this.layoutControlItem1.Control     = IterationScheduler;
            this.layoutControlItem1.TextVisible = false;
            this.dataLayoutControl1.Controls.Add(IterationScheduler);

            IterationScheduler.ActiveViewType = DevExpress.XtraScheduler.SchedulerViewType.Gantt;
            IterationScheduler.GroupType      = DevExpress.XtraScheduler.SchedulerGroupType.Resource;
            IterationScheduler.Name           = "IterationScheduler";
            IterationScheduler.Start          = new System.DateTime(2012, 7, 1, 0, 0, 0, 0);
            IterationScheduler.Storage        = this.schedulerStorage1;
            IterationScheduler.ActiveView.ResourcesPerPage = 4;

            //timeRuler1
            TimeRuler timeRuler1 = new TimeRuler();

            timeRuler1.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler1.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler1.UseClientTimeZone     = false;

            //timeScaleYear1
            TimeScaleYear timeScaleYear1 = new TimeScaleYear();

            timeScaleYear1.Enabled = false;

            //timeScaleQuarter1
            TimeScaleQuarter timeScaleQuarter1 = new TimeScaleQuarter();

            timeScaleQuarter1.Enabled = false;

            //timeScaleMonth1
            TimeScaleMonth timeScaleMonth1 = new TimeScaleMonth();

            timeScaleMonth1.Visible = false;

            //timeScaleWeek1
            TimeScaleWeek timeScaleWeek1 = new TimeScaleWeek();

            timeScaleWeek1.DisplayFormat = "MMMM dd";
            timeScaleWeek1.Width         = 120;

            //timeScaleDay1
            TimeScaleDay timeScaleDay1 = new TimeScaleDay();

            timeScaleDay1.Enabled = false;
            timeScaleDay1.Visible = false;
            timeScaleDay1.Width   = 28;

            //timeScaleHour1
            TimeScaleHour timeScaleHour1 = new TimeScaleHour();

            timeScaleHour1.Enabled = false;

            // timeScaleFixedInterval1
            TimeScaleFixedInterval timeScaleFixedInterval1 = new TimeScaleFixedInterval();

            timeScaleFixedInterval1.Enabled = false;


            IterationScheduler.Views.DayView.TimeRulers.Add(timeRuler1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleYear1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleQuarter1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleMonth1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleWeek1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleDay1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleHour1);
            this.IterationScheduler.Views.GanttView.Scales.Add(timeScaleFixedInterval1);
            this.IterationScheduler.Views.GanttView.ShowResourceHeaders = false;

            //timeScaleYear2
            TimeScaleYear timeScaleYear2 = new DevExpress.XtraScheduler.TimeScaleYear();

            timeScaleYear2.Enabled = false;

            //timeScaleQuarter2
            TimeScaleQuarter timeScaleQuarter2 = new TimeScaleQuarter();

            timeScaleQuarter2.Enabled = false;

            //timeScaleMonth2
            TimeScaleMonth timeScaleMonth2 = new TimeScaleMonth();

            timeScaleMonth2.Enabled = false;

            //timeScaleWeek2
            TimeScaleWeek timeScaleWeek2 = new TimeScaleWeek();

            timeScaleWeek2.DisplayFormat = "yyyy-MM-dd";

            //timeScaleDay2
            TimeScaleDay timeScaleDay2 = new TimeScaleDay();

            timeScaleDay2.Visible = false;
            timeScaleDay2.Width   = 20;

            //timeScaleHour2
            TimeScaleHour timeScaleHour2 = new TimeScaleHour();

            timeScaleHour2.Enabled = false;

            //timeScaleFixedInterval2
            TimeScaleFixedInterval timeScaleFixedInterval2 = new TimeScaleFixedInterval();

            timeScaleFixedInterval2.Enabled = false;

            //timeRuler2
            TimeRuler timeRuler2 = new TimeRuler();

            timeRuler2.TimeZone.DaylightBias = System.TimeSpan.Parse("-01:00:00");
            timeRuler2.TimeZone.UtcOffset    = System.TimeSpan.Parse("08:00:00");
            timeRuler2.UseClientTimeZone     = false;

            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleYear2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleQuarter2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleMonth2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleWeek2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleDay2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleHour2);
            this.IterationScheduler.Views.TimelineView.Scales.Add(timeScaleFixedInterval2);
            this.IterationScheduler.Views.WorkWeekView.TimeRulers.Add(timeRuler2);
            this.resourcesTree1.SchedulerControl = IterationScheduler;
        }