public void Setup()
        {
            foreach (GnosisGenericMenuItemController menuItemController in genericController.ChildControllers)
            {
                if (menuItemController.ChildControllers.Count > 0)
                {
                    GnosisMenuButton menuButton = new GnosisMenuButton();
                    //btn = CreateDropDownButton(menuItemController);
                    //  IGnosisToolbarMenuButtonImplementation menuBtnImplementation =
                    //    GlobalData.Singleton.ImplementationCreator.GetGnosisToolbarMenuButtonImplementation();
                    GnosisToolbarMenuButtonController btnController = new GnosisToolbarMenuButtonController(menuItemController, menuButton, EntityController, this);
                    btnController.Setup();

                    menuButton.AddMenuButton(menuButton);
                    childControllers.Add(btnController);
                }
                else if (menuItemController is GnosisGenericToggleMenuItemController)
                {
                    // IGnosisToggleButtonImplementation toggleButton = GlobalData.Singleton.ImplementationCreator.GetGnosisToggleButtonImplementation();
                    GnosisToggleButton          toggleButton = new GnosisToggleButton();
                    GnosisGenericToggleMenuItem menuItem     = (GnosisGenericToggleMenuItem)menuItemController.ControlImplementation;
                    toggleButton.Active     = menuItem.Active;
                    toggleButton.Caption    = menuItem.Caption;
                    toggleButton.GnosisIcon = menuItem.GnosisIcon;
                    toggleButton.ToolTip    = menuItem.Tooltip;
                    toggleButton.Disabled   = menuItem.Disabled;
                    toggleButton.Hidden     = menuItem.Hidden;
                    GnosisToolbarToggleButtonController btnController = new GnosisToolbarToggleButtonController((GnosisGenericToggleMenuItemController)menuItemController, toggleButton, EntityController, this);
                    //((GnosisToolbarToggleButtonController)btnController).Setup();

                    menuButton.AddToggleButton(toggleButton);
                    childControllers.Add(btnController);
                }
                else if (menuItemController is GnosisGenericMenuGroupController)
                {
                    GnosisGenericMenuGroupController groupController = (GnosisGenericMenuGroupController)menuItemController;

                    foreach (GnosisGenericToggleMenuItemController toggleMenuItemController in groupController.ToggleMenuItemControllers)
                    {
                        // IGnosisToggleButtonImplementation toggleButton = GlobalData.Singleton.ImplementationCreator.GetGnosisToggleButtonImplementation();
                        GnosisToggleButton          toggleButton = new GnosisToggleButton();
                        GnosisGenericToggleMenuItem menuItem     = (GnosisGenericToggleMenuItem)toggleMenuItemController.ControlImplementation;
                        toggleButton.Active     = menuItem.Active;
                        toggleButton.Caption    = menuItem.Caption;
                        toggleButton.GnosisIcon = menuItem.GnosisIcon;
                        toggleButton.ToolTip    = menuItem.Tooltip;
                        toggleButton.Disabled   = menuItem.Disabled;
                        toggleButton.Hidden     = menuItem.Hidden;
                        GnosisToolbarToggleButtonController btnController = new GnosisToolbarToggleButtonController(toggleMenuItemController, toggleButton, EntityController, this);

                        menuButton.AddToggleButton(toggleButton);
                        childControllers.Add(btnController);
                    }
                }
                else
                {
                    GnosisButton          toolbarButton = new GnosisButton();// ((GnosisGenericMenuItem)menuItemController.ControlImplementation);
                    GnosisGenericMenuItem menuItem      = (GnosisGenericMenuItem)menuItemController.ControlImplementation;
                    toolbarButton.Caption    = menuItem.Caption;
                    toolbarButton.GnosisIcon = menuItem.GnosisIcon;
                    toolbarButton.ToolTip    = menuItem.Tooltip;
                    toolbarButton.Disabled   = menuItem.Disabled;
                    toolbarButton.Hidden     = menuItem.Hidden;
                    // IGnosisButtonImplementation btnImplementation =
                    //   GlobalData.Singleton.ImplementationCreator.GetGnosisButtonImplementation();
                    GnosisToolbarButtonController btnController = new GnosisToolbarButtonController(menuItemController, toolbarButton, EntityController, this);
                    ((GnosisToolbarButtonController)btnController).Setup();

                    menuButton.AddButton(toolbarButton);
                    childControllers.Add(btnController);
                }
            }
        }
예제 #2
0
        public void Setup()
        {
            toolbarButtonControllers = new List <object>();

            try
            {
                //Find the GnosisGenericMenu which this toolbar points at
                genericMenuController = (GnosisGenericMenuController)GlobalData.Singleton.FindController(((GnosisToolbar)ControlImplementation).MenuSystemID,
                                                                                                         ((GnosisToolbar)ControlImplementation).MenuControlID);

                //create toolbar buttons for each generic menu item
                if (genericMenuController.GenericMenuItemControllers != null && genericMenuController.GenericMenuItemControllers.Count > 0)
                {
                    foreach (GnosisGenericMenuItemController menuItemController in genericMenuController.GenericMenuItemControllers.OrderBy(x => x.ControlImplementation.Order))
                    {
                        object btnController;

                        if (menuItemController.ChildControllers.Count > 0)
                        {
                            GnosisMenuButton menuButton = GnosisControlCreator.CreateGnosisMenuButton();
                            //btn = CreateDropDownButton(menuItemController);
                            //  IGnosisToolbarMenuButtonImplementation menuBtnImplementation =
                            //    GlobalData.Singleton.ImplementationCreator.GetGnosisToolbarMenuButtonImplementation();
                            btnController = new GnosisToolbarMenuButtonController(menuItemController, menuButton, EntityController, this);
                            ((GnosisToolbarMenuButtonController)btnController).Setup();

                            toolbar.AddMenuButton(menuButton);
                            toolbarButtonControllers.Add(btnController);
                        }
                        else if (menuItemController is GnosisGenericToggleMenuItemController)
                        {
                            // IGnosisToggleButtonImplementation toggleButton = GlobalData.Singleton.ImplementationCreator.GetGnosisToggleButtonImplementation();
                            GnosisToggleButton          toggleButton = new GnosisToggleButton();
                            GnosisGenericToggleMenuItem menuItem     = (GnosisGenericToggleMenuItem)menuItemController.ControlImplementation;
                            toggleButton.Active     = menuItem.Active;
                            toggleButton.Caption    = menuItem.Caption;
                            toggleButton.GnosisIcon = menuItem.GnosisIcon;
                            toggleButton.ToolTip    = menuItem.Tooltip;
                            toggleButton.Disabled   = menuItem.Disabled;
                            toggleButton.Hidden     = menuItem.Hidden;
                            btnController           = new GnosisToolbarToggleButtonController((GnosisGenericToggleMenuItemController)menuItemController, toggleButton, EntityController, this);
                            //((GnosisToolbarToggleButtonController)btnController).Setup();

                            toolbar.AddToggleButton(toggleButton);
                            toolbarButtonControllers.Add(btnController);
                        }
                        else if (menuItemController is GnosisGenericMenuGroupController)
                        {
                            GnosisGenericMenuGroupController groupController = (GnosisGenericMenuGroupController)menuItemController;

                            foreach (GnosisGenericToggleMenuItemController toggleMenuItemController in groupController.ToggleMenuItemControllers)
                            {
                                // IGnosisToggleButtonImplementation toggleButton = GlobalData.Singleton.ImplementationCreator.GetGnosisToggleButtonImplementation();
                                GnosisToggleButton          toggleButton = new GnosisToggleButton();
                                GnosisGenericToggleMenuItem menuItem     = (GnosisGenericToggleMenuItem)toggleMenuItemController.ControlImplementation;
                                toggleButton.Active     = menuItem.Active;
                                toggleButton.Caption    = menuItem.Caption;
                                toggleButton.GnosisIcon = menuItem.GnosisIcon;
                                toggleButton.ToolTip    = menuItem.Tooltip;
                                toggleButton.Disabled   = menuItem.Disabled;
                                toggleButton.Hidden     = menuItem.Hidden;
                                btnController           = new GnosisToolbarToggleButtonController(toggleMenuItemController, toggleButton, EntityController, this);
                                toolbar.AddToggleButton(toggleButton);
                                toolbarButtonControllers.Add(btnController);
                            }
                        }
                        else
                        {
                            GnosisButton          toolbarButton = new GnosisButton();// ((GnosisGenericMenuItem)menuItemController.ControlImplementation);
                            GnosisGenericMenuItem menuItem      = (GnosisGenericMenuItem)menuItemController.ControlImplementation;
                            toolbarButton.Caption    = menuItem.Caption;
                            toolbarButton.GnosisIcon = menuItem.GnosisIcon;
                            toolbarButton.ToolTip    = menuItem.Tooltip;
                            toolbarButton.Disabled   = menuItem.Disabled;
                            toolbarButton.Hidden     = menuItem.Hidden;
                            // IGnosisButtonImplementation btnImplementation =
                            //   GlobalData.Singleton.ImplementationCreator.GetGnosisButtonImplementation();
                            btnController = new GnosisToolbarButtonController(menuItemController, toolbarButton, EntityController, this);
                            ((GnosisToolbarButtonController)btnController).Setup();

                            toolbar.AddToolbarButton(toolbarButton);
                            toolbarButtonControllers.Add(btnController);
                        }


                        //genericMenuItemControllers.Add(menuItemController);
                    }
                }

                if (((GnosisGenericMenu)genericMenuController.ControlImplementation).SystemAddressField != null)
                {
                    // IGnosisSystemAddressFieldImplementation systemAddressFieldImp =
                    //   GlobalData.Singleton.ImplementationCreator.GetGnosisSystemAddressFieldImplementation();
                    GnosisSystemAddressController systemAddressController = new GnosisSystemAddressController(
                        ((GnosisGenericMenu)genericMenuController.ControlImplementation).SystemAddressField, EntityController, this);
                    toolbar.AddSystemAddressField(((GnosisGenericMenu)genericMenuController.ControlImplementation).SystemAddressField);
                }
            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }
        }