Exemplo n.º 1
0
        //public bool Active
        //{
        //    get { return ((GnosisGenericToggleMenuItem)ControlImplementation).Active; }
        //    set
        //    {
        //        ((GnosisGenericToggleMenuItem)ControlImplementation).Active = value;
        //        OnPropertyChanged("Active");
        //    }
        //}

        //public int Code
        //{
        //    get { return ((GnosisGenericToggleMenuItem)ControlImplementation).Code; }
        //}

        public GnosisGenericToggleMenuItemController(
            GnosisGenericToggleMenuItem toggleMenuItem,
            GnosisController parentController)
            : base(toggleMenuItem, parentController)
        {
            // toggleMenuItem.PropertyChanged += ToggleMenuItem_PropertyChanged;
        }
Exemplo n.º 2
0
        //public string Caption
        //{
        //    get
        //    {
        //        return ((GnosisGenericMenuItem)ControlImplementation).Caption;
        //    }
        //}

        //public string Tooltip
        //{
        //    get
        //    {
        //        return ((GnosisGenericMenuItem)ControlImplementation).Tooltip;
        //    }
        //}

        //public bool Hidden
        //{
        //    get
        //    {
        //        return ((GnosisGenericMenuItem)ControlImplementation).Hidden;
        //    }
        //    set
        //    {
        //        ((GnosisGenericMenuItem)ControlImplementation).Hidden = value;
        //        OnPropertyChanged("Hidden");
        //    }
        //}

        //public string GnosisIcon
        //{
        //    get { return ((GnosisGenericMenuItem)ControlImplementation).GnosisIcon; }
        //}

        //public bool AllHidden
        //{
        //    get { return ((GnosisGenericMenuItem)ControlImplementation).AllHidden; }
        //    set
        //    {
        //        ((GnosisGenericMenuItem)ControlImplementation).AllHidden = value;
        //        OnPropertyChanged("AllHidden");
        //    }
        //}

        //public GnosisGenericMenuItem.MenuTagEnum MenuTag
        //{
        //    get
        //    {
        //        return ((GnosisGenericMenuItem)ControlImplementation)._MenuTag;
        //    }
        //}

        //public bool Disabled
        //{
        //    get
        //    {

        //        return ((GnosisGenericMenuItem)ControlImplementation).Disabled;
        //    }
        //    set
        //    {
        //        ((GnosisGenericMenuItem)ControlImplementation).Disabled = value;
        //        OnPropertyChanged("Disabled");
        //    }
        //}

        //public bool Redraw
        //{
        //    set
        //    {
        //        OnPropertyChanged("Redraw");
        //        foreach(GnosisGenericMenuItemController childController in ChildControllers)
        //        {
        //            childController.Redraw = true;
        //        }
        //    }

        //}

        public GnosisGenericMenuItemController(GnosisGenericMenuItem _menuItem, GnosisController _parentController)
            : base(_menuItem)
        {
            parentController = _parentController;
            ChildControllers = new List <GnosisGenericMenuItemController>();
            EventHandlers    = new List <GnosisEventHandler>();
            Setup();
        }
Exemplo n.º 3
0
        private GnosisGenericMenuController FindRootController()
        {
            GnosisController controller = parentController;

            while (!(controller is GnosisGenericMenuController))
            {
                controller = ((GnosisGenericMenuItemController)controller).parentController;
            }

            return((GnosisGenericMenuController)controller);
        }
Exemplo n.º 4
0
        //public GnosisControl FindControl(int entityID, int controlID)
        //{
        //    GnosisControl control = null;
        //    if (ParentWindow.EntityID == entityID)
        //    {
        //        control = ParentWindow.FindControlByID(controlID);
        //    }
        //    else if (Connection.EntityID == entityID)
        //    {
        //        control =  Connection;
        //    }
        //    else if (Generic.EntityID == entityID)
        //    {
        //        control = Generic.FindControlByID(controlID);
        //    }
        //    else if (Global.EntityID == entityID)
        //    {
        //        control = Global.FindControlByID(controlID);
        //    }
        //    else if (NavFrame.EntityID == entityID)
        //    {
        //        control = NavFrame;
        //    }

        //    return control;
        //}

        public GnosisController FindController(int entityID, int controlID)
        {
            GnosisController controller = null;

            if (SystemController != null)
            {
                controller = SystemController.FindControllerByID(entityID, controlID);
            }

            return(controller);
        }
Exemplo n.º 5
0
        //private void UpdateUsedCells(int col, int row, int colSpan, int rowSpan)
        //{

        //    //First fill in spaces occupied by this control
        //    for (int c = col; c  < col + colSpan; c++)
        //    {
        //        for (int r = row; r < row + rowSpan; r++)
        //        {
        //            usedCells[c, r] = 1;
        //        }
        //    }

        //    //update lastRowUsed
        //    bool found = false;
        //    int currentRow = row + rowSpan - 1;
        //    //at the end of while loop current row is the first empty row
        //    while (!found)
        //    {
        //        for (int c = 0; c < usedCells.GetLength(0); c++)
        //        {
        //            if (usedCells[c,currentRow] == 1)
        //            {
        //                currentRow = currentRow + 1;
        //                if (currentRow > usedCells.GetLength(1))
        //                {
        //                    GlobalData.Singleton.ErrorHandler.HandleError("All rows used in panel", "GnosisPanelController", 2);
        //                    found = true;
        //                }
        //                break;
        //            }
        //            else if (c == usedCells.GetLength(0) - 1)
        //            {
        //                //we have scanned the whole column and it is empty
        //                found = true;
        //            }
        //        }
        //    }
        //    lastRowUsed = currentRow - 1;

        //}

        internal override GnosisController FindControllerByID(int controlID)
        {
            GnosisController controller = null;

            foreach (GnosisPanelFieldController child in childControllers)
            {
                if (child.ControlImplementation.ID == controlID)
                {
                    controller = child;
                    break;
                }
            }

            return(controller);
        }
Exemplo n.º 6
0
        public GnosisController FindControllerByID(int controlID)
        {
            if (this.ControlImplementation.ID == controlID)
            {
                return(this);
            }

            foreach (GnosisGenericMenuItemController menuItemController in ChildControllers)
            {
                GnosisController controller = menuItemController.FindControllerByID(controlID);
                if (controller != null)
                {
                    return(controller);
                }
            }

            return(null);
        }
Exemplo n.º 7
0
        public override GnosisController FindControllerByID(int controlID)
        {
            GnosisController controller = null;

            if (((GnosisNavigatorFrame)ControlImplementation).Galleries.Count > 0)
            {
                foreach (GnosisGalleryController galleryController in galleryControllers)
                {
                    controller = galleryController.FindControllerByID(controlID);
                    if (controller != null)
                    {
                        break;
                    }
                }
            }

            return(controller);
        }
Exemplo n.º 8
0
        public virtual GnosisController FindControllerByID(int controlID)
        {
            GnosisController controller = null;

            if (EntityController.EntityType == GnosisEntity.EntityTypeEnum.Connection)
            {
                controller = ((GnosisConnectionFrameController)visibleController).FindControllerByID(controlID);
            }
            else if (EntityController.EntityType == GnosisEntity.EntityTypeEnum.Document)
            {
                controller = ((GnosisDocumentFrameController)visibleController).FindControllerByID(controlID);
            }
            else if (EntityController.EntityType == GnosisEntity.EntityTypeEnum.Navigator)
            {
                controller = ((GnosisNavigatorFrameController)visibleController).FindControllerByID(controlID);
            }
            else if (EntityController.EntityType == GnosisEntity.EntityTypeEnum.Search)
            {
                controller = ((GnosisSearchFrameController)visibleController).FindControllerByID(controlID);
            }

            return(controller);
        }
Exemplo n.º 9
0
        public virtual GnosisController FindControllerByID(int controlID)
        {
            GnosisController controller = null;

            foreach (GnosisController child in childControllers)
            {
                if (child.ControlImplementation.ID == controlID)
                {
                    return(child);
                }
            }

            foreach (GnosisInnerLayoutController child in childControllers)
            {
                controller = child.FindControllerByID(controlID);

                if (controller != null)
                {
                    break;
                }
            }

            return(controller);
        }
Exemplo n.º 10
0
        //public int VariableSystemID
        //{
        //    get { return ((GnosisGenericMenuGroup)ControlImplementation).VariableSystemID; }
        //}

        //public int VariableControlID
        //{
        //    get { return ((GnosisGenericMenuGroup)ControlImplementation).VariableControlID; }
        //}

        public GnosisGenericMenuGroupController(
            GnosisGenericMenuGroup menuGroup,
            GnosisController parent)
            : base(menuGroup, parent)
        {
        }
Exemplo n.º 11
0
        public void HandleEvent(GnosisController source)
        {
            try
            {
                bool result = false;
                //if no source expression is defined then the event should be fired
                if (this.SourceExpression == null)
                {
                    result = true;
                }
                else if (this.SourceExpression.Equals("True"))
                {
                    result = true;
                }
                else if (this.SourceExpression.Equals("False"))
                {
                    result = false;
                }
                else //boolean sequence
                {
                    GnosisBooleanHelper booleanHelper = new GnosisBooleanHelper(this, (GnosisControl)source.ControlImplementation);
                    result = booleanHelper.Evaluate(this.SourceExpression);
                }

                //Either TargetProperty, TargetAction or TargetEvent is defined
                //Find the target control
                //if the target is a GnosisGenericControl, the real target will be the type of the control that has current focus
                GnosisController target = GlobalData.Singleton.FindController(this.TargetControlEntityID, this.TargetControlControlID);
                GnosisController realTarget;
                if (target is GnosisGenericControlController)
                {
                    realTarget = ((GnosisGenericControlController)target).CurrentInstance;
                }
                else
                {
                    realTarget = target;
                }

                if (realTarget != null)
                {
                    // EventLogger.LogEvent(this, realTarget.ControlImplementation.GnosisName, result);

                    if (this._TargetAction != GnosisEventHandler.TargetActionType.None)
                    {
                        if (result)
                        {
                            realTarget.ExecuteAction(this._TargetAction);
                        }
                    }
                    else if (this._TargetProperty != GnosisEventHandler.TargetPropertyType.None)
                    {
                        //set property to SourceExpression result
                        string propName = Enum.GetName(typeof(GnosisEventHandler.TargetPropertyType), this.TargetProperty);
                        realTarget.GetType().GetProperty(propName).SetValue(realTarget, result, null);
                    }
                    else if (this._TargetEvent != TargetEventType.None)
                    {
                        if (result)
                        {
                            //If TargetEvent is defined, we must find the matching EventHandler(s) in the GenericControl (target)
                            //and invoke them on the CurrentInstance of the GenericControl (realTarget)
                            var targetEventHandlers = ((GnosisGenericControlController)target).EventHandlers
                                                      .Where(x => Enum.GetName(typeof(GnosisEventType), x.EventType).Equals(Enum.GetName(typeof(TargetEventType), this.TargetEvent)));

                            foreach (GnosisEventHandler eh in targetEventHandlers)
                            {
                                eh.HandleEvent(realTarget);
                            }
                        }
                    }
                    else
                    //target must be a variable
                    {
                        GlobalData.Singleton.ErrorHandler.HandleError("TargetProperty, TargetAction and TargetEvent not found", "GnosisEventHandler.HandleEvent()");
                    }
                }
                else
                {
                    GlobalData.Singleton.ErrorHandler.HandleError("TargetControl not found for GnosisEventHandler " + this.GnosisName,
                                                                  "GnosisEventHandler.HandleEvent");
                }
            }
            catch (Exception ex)
            {
                GlobalData.Singleton.ErrorHandler.HandleError(ex.Message, ex.StackTrace);
            }
        }
 public GnosisGenericMenuItemController_Search(GnosisGenericMenuItem _menuItem, GnosisController _parentController)
     : base(_menuItem, _parentController)
 {
 }