public static void AddAgendaView(SchedulerControl scheduler, DateNavigator dateNavigator, bool showResources)
        {
            CurrentScheduler = scheduler;
            navigator        = dateNavigator;
            if (!(scheduler.Parent is LayoutControl))
            {
                MessageBox.Show("SchedulerControl should be located within a LayoutControl to enable AgendaView functionality");
            }
            else
            {
                AgendaView = new AgendaViewControl(showResources, CurrentScheduler);
                CurrentScheduler.PopupMenuShowing += new DevExpress.XtraScheduler.PopupMenuShowingEventHandler(CurrentScheduler_PopupMenuShowing);
                LayoutControl     currentLayout       = scheduler.Parent as LayoutControl;
                LayoutControlItem schedulerLayoutItem = currentLayout.GetItemByControl(CurrentScheduler);
                //Create a layout item and add it to the root group.
                LayoutControlItem itemAgendaView = currentLayout.Root.AddItem(schedulerLayoutItem, DevExpress.XtraLayout.Utils.InsertType.Top) as LayoutControlItem;
                // Set the item's Control and caption.
                itemAgendaView.Name        = "layoutControlItemAgendaView";
                itemAgendaView.Control     = AgendaView;
                itemAgendaView.TextVisible = false;

                ChangeControlsVisibility(CurrentScheduler, true);
                if (navigator != null)
                {
                    ChangeControlsVisibility(navigator, true);
                }
                ChangeControlsVisibility(AgendaView, false);
            }
        }
Exemplo n.º 2
0
        public static void GenerateContextMenu(AgendaViewControl viewControl, GridViewMenu contextMenu, SchedulerControl control, Appointment apt)
        {
            Scheduler          = control;
            CurrentAppointment = apt;
            ViewControl        = viewControl;
            if (apt != null)
            {
                contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Open appointment", OnOpenCurrentAppointment));
                contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Delete appointment", OnDeleteCurrentAppointment, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.Delete.png"))));
            }

            DevExpress.Utils.Menu.DXMenuItem nextInterval = new DevExpress.Utils.Menu.DXMenuItem("Go to the next month", OnNextInterval, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.NextArrow.png")));
            nextInterval.BeginGroup = true;

            contextMenu.Items.Add(nextInterval);
            contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Go to the previous month", OnPreviousInterval, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.PrevArrow.png"))));
            contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Go to the specific date", OnGoToSpecificDate));

            DevExpress.Utils.Menu.DXSubMenuItem switchView = new DevExpress.Utils.Menu.DXSubMenuItem("Change view to");
            switchView.BeginGroup = true;
            contextMenu.Items.Add(switchView);

            if (Scheduler.DayView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Day View", OnSwitchToDayView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.DayView.png"))));
            }
            if (Scheduler.WorkWeekView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Work Week View", OnSwitchToWorkWeekView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.WorkWeekView.png"))));
            }
            if (Scheduler.WeekView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Week View", OnSwitchToWeekView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.WeekView.png"))));
            }
            if (Scheduler.MonthView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Month View", OnSwitchToMonthView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.MonthView.png"))));
            }
            if (Scheduler.TimelineView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Timeline View", OnSwitchToTimelineView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.TimelineView.png"))));
            }
            if (Scheduler.GanttView.Enabled)
            {
                switchView.Items.Add(new DevExpress.Utils.Menu.DXMenuItem("Gantt View", OnSwitchToGanttView, Image.FromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("AgendViewComponent.Resources.GanttView.png"))));
            }

            if (apt != null)
            {
                contextMenu.Items.Add(new DevExpress.Utils.Menu.DXMenuItem(ViewControl.ShowResources ? "Show all appointments" : "Group appointments by resources", OnSwitchResourcesVisibility));
            }
        }