Пример #1
0
        public GnosisContainerTreeViewItemController(GnosisVisibleController controller)
        {
            SourceController                     = controller;
            TreeViewItemImplementation           = GnosisControlCreator.CreateGnosisContainerTreeViewItem();
            TreeViewItemImplementation.GnosisTag = SourceController;

            SetIconAndCaption();


            //Add child nodes
            if (controller is GnosisParentWindowController)
            {
                GnosisContainerTreeViewItemController primary =
                    new GnosisContainerTreeViewItemController(GlobalData.Singleton.PrimarySplitController);
                TreeViewItemImplementation.AddItem(primary.TreeViewItemImplementation);
            }
            else if (controller is GnosisPrimarySplitController || controller is GnosisSplitController)
            {
                foreach (GnosisContainerController child in ((GnosisSplitController)controller).ChildControllers.OrderBy(x => x.ControlImplementation.Order))
                {
                    GnosisContainerTreeViewItemController childItem = new GnosisContainerTreeViewItemController(child);
                    TreeViewItemImplementation.AddItem(childItem.TreeViewItemImplementation);
                }
            }
        }
Пример #2
0
        public GnosisToolbarToggleButtonController(
            GnosisGenericToggleMenuItemController toggleMenuItemController,
            GnosisToggleButton _toggleButton,
            GnosisEntityController entityController,
            GnosisVisibleController parent)
            : base(_toggleButton, entityController, parent)
        {
            toggleButton = _toggleButton;
            genericToggleMenuItemController = toggleMenuItemController;
            menuItem = (GnosisGenericToggleMenuItem)genericToggleMenuItemController.ControlImplementation;

            //The toggle button reflects the properties of the generic menu item.
            //A click on a toggle button is passed to the generic menu item controller and changes are made to the generic menu item.
            //toggleButton.Order = menuItem.Order;
            //toggleButton.GnosisIcon = menuItem.GnosisIcon;
            //toggleButton.Tooltip = menuItem.Tooltip;
            //toggleButton.Caption = menuItem.Caption;
            //toggleButton.Active = menuItem.Active;
            //toggleButton.Disabled = menuItem.Disabled;

            menuItem.PropertyChanged += MenuItem_PropertyChanged;
            // toggleButton.PropertyChanged += ToggleButton_PropertyChanged;

            toggleButton.SetClickHandler(new Action(OnClick));
        }
Пример #3
0
 public GnosisContainerController(
     IGnosisContainerImplementation _container,
     // IGnosisContainerImplementation _containerImplementation,
     GnosisEntityController entityController,
     GnosisVisibleController parent)
     : base(_container, entityController, parent)
 {
     // _containerImplementation.SetOrder(_container.Order);
 }
Пример #4
0
        public void HandleGenericEvent(GnosisEventHandler.GnosisEventType eventType, GnosisVisibleController controller)
        {
            var handlers = EventHandlers.Where(x => x._EventType == eventType).OrderBy(x => x.Order);

            foreach (GnosisEventHandler handler in handlers)
            {
                handler.HandleEvent(controller);
            }
        }
Пример #5
0
        // private List<GnosisToolbarButtonItemController> childControllers;


        public GnosisToolbarButtonController(
            GnosisGenericMenuItemController _genericMenuItemController,
            GnosisButton _button,
            GnosisEntityController entityController,
            GnosisVisibleController parent)
            : base(_button, entityController, parent)
        {
            genericMenuItemController = _genericMenuItemController;
            menuItem = (GnosisGenericMenuItem)genericMenuItemController.ControlImplementation;
            button   = _button;

            button.SetClickHandler(new Action(genericMenuItemController.SelectMenuItem));

            menuItem.PropertyChanged += GenericMenuItem_PropertyChanged;
        }
Пример #6
0
        public virtual void Setup()
        {
            if (entityController.Entity.ParentWindow != null)
            {
                // IGnosisParentWindowImplementation parentWindowImplementation = GlobalData.Singleton.ParentWindowImplementation;
                visibleController = new GnosisParentWindowController(entityController.Entity.ParentWindow, entityController);
                ((GnosisParentWindowController)visibleController).Setup();
            }
            if (entityController.Entity.DocumentFrame != null)
            {
                GnosisTileController firstTile = GlobalData.Singleton.PrimarySplitController.GetFirstTile();

                //  IGnosisDocFrameImplementation docFrameImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisDocFrameImplementation();
                visibleController = new GnosisDocumentFrameController(entityController.Entity.DocumentFrame, this, firstTile);
                ((GnosisDocumentFrameController)visibleController).Setup();

                //  firstTile.LoadFrame(docFrameController);
            }
            else if (entityController.Entity.ConnectionFrame != null)
            {
                // IGnosisConnectionFrameImplementation connectionFrameImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisConnectionFrameImplementation();
                visibleController = new GnosisConnectionFrameController(entityController.Entity.ConnectionFrame, this, null);
                ((GnosisConnectionFrameController)visibleController).Setup();
            }
            else if (entityController.Entity.NavigatorFrame != null)
            {
                //  IGnosisNavFrameImplementation navFrameImplementation = GlobalData.Singleton.ImplementationCreator.GetGnosisNavFrameImplementation();
                visibleController = new GnosisNavigatorFrameController(entityController.Entity.NavigatorFrame, this, GlobalData.Singleton.PrimarySplitController.NavTileController);
                ((GnosisNavigatorFrameController)visibleController).Setup();

                // GlobalData.Singleton.PrimarySplitController.AddNavFrame((GnosisNavFrameController)visibleController);
            }
            else if (entityController.Entity.SearchFrame != null)
            {
                GnosisTileController firstTile = GlobalData.Singleton.PrimarySplitController.GetFirstTile();

                // IGnosisSearchFrameImplementation searchFrameImp = GlobalData.Singleton.ImplementationCreator.GetGnosisSearchFrameImplementation();
                visibleController = new GnosisSearchFrameController(entityController.Entity.SearchFrame, this, firstTile);
                ((GnosisSearchFrameController)visibleController).Setup();

                // firstTile.LoadFrame(searchFrameController);
            }

            this.PropertyChanged += GnosisInstanceController_PropertyChanged;
            visibleController.PropertyChanged += VisibleController_PropertyChanged;
        }
Пример #7
0
        public GnosisSplitController(
            GnosisSplit split,
            //  IGnosisSplitImplementation _splitImplementation,
            GnosisEntityController entityController,
            GnosisVisibleController _parent)
            : base(split, entityController, _parent)
        {
            //create split detail controller
            // SplitDetailController = new GnosisSplitDetailController(((GnosisSplit)ControlImplementation).GnosisSplitDetails[0]);
            //SplitDetailController.PropertyChanged += SplitDetailController_PropertyChanged;

            //register to listen for property changes
            //this.PropertyChanged += GnosisSplitController_PropertyChanged;

            ChildControllers = new List <GnosisContainerController>();

            //Handlers
            split.SetSplitterMovedHandler(new Action <double>(SplitterMoved));
            split.SetLoadedHandler(new Action <double>(SplitLoaded));
        }
Пример #8
0
 public void PushRedo(GnosisVisibleController _controller, object newState)
 {
     redoStack.Push(new GnosisDocChange(_controller, newState));
 }
Пример #9
0
 public void PushUndo(GnosisVisibleController _controller, object oldState)
 {
     undoStack.Push(new GnosisDocChange(_controller, oldState));
 }
Пример #10
0
        private bool EvaluateSequence(string input)
        {
            MatchCollection conditions = regexCondition.Matches(input);

            foreach (Match condition in conditions)
            {
                //Find the source control and evaluate the relevant property
                //We do not have the id of the source control. We find it by type.
                //It may reference the control on which the event was raised - ownerControl
                string propertyName             = regexPropertyName.Match(condition.ToString()).ToString();
                GnosisEventHandlerSource source = FindEventHandlerSource(propertyName);
                if (source == null)
                {
                    GlobalData.Singleton.ErrorHandler.HandleError("Could not find event handler source for " + propertyName, "GnosisBooleanHelper.EvaluateSequence");
                }

                bool   result            = false;
                string sourceControlType = source.ControlType;
                if (ownerControl.ControlType.Equals(sourceControlType))
                {
                    //check property of ownerControl
                    PropertyInfo prop = ownerControl.GetType().GetProperty(propertyName);
                    result = (bool)prop.GetValue(ownerControl, null);
                }
                else if (sourceControlType.Equals("Connection"))
                {
                    GnosisConnection connection = GlobalData.Singleton.Connection;
                    PropertyInfo     propInfo   = connection.GetType().GetProperty(propertyName);
                    result = (bool)propInfo.GetValue(connection, null);
                }
                else if (sourceControlType.Equals("Generic Menu Item"))
                {
                    GnosisGenericMenuItemController target = GnosisGenericMenuItemController.CurrentMenuItemController;
                    PropertyInfo propInfo = target.GetType().GetProperty(propertyName);
                    result = (bool)propInfo.GetValue(target, null);
                }
                else if (sourceControlType.Equals("Navigator Tile"))
                {
                    GnosisNavTileController target   = GlobalData.Singleton.PrimarySplitController.NavTileController;
                    PropertyInfo            propInfo = target.GetType().GetProperty(propertyName);
                    result = (bool)propInfo.GetValue(target, null);
                }
                else
                {
                    //Look for the GenericControlController
                    GnosisGenericControlController genericControlController = GlobalData.Singleton.FindGenericControllerByType(sourceControlType);
                    if (genericControlController != null)
                    {
                        GnosisVisibleController target   = genericControlController.CurrentInstance;
                        PropertyInfo            propInfo = target.GetType().GetProperty(propertyName);
                        result = (bool)propInfo.GetValue(target, null);
                    }
                    else
                    {
                        GlobalData.Singleton.ErrorHandler.HandleError("GenericControl not found of type " + sourceControlType.ToString(),
                                                                      "GnosisBooleanHelper.EvaluateSequence");
                    }
                }

                if (condition.ToString().Contains("Not"))
                {
                    result = !result;
                }
                input = input.Replace(condition.ToString(), result.ToString());
            }


            bool sequenceResult = Eval(input);

            //MatchCollection booleans = regexBooleans.Matches(input);
            //List<bool> results = new List<bool>();
            //foreach (Match m in booleans)
            //{
            //    results.Add(Boolean.Parse(m.ToString()));
            //}
            //if (input.Contains("and"))
            //{
            //    if (results.Any(x => x == false))
            //    {
            //        sequenceResult = false;
            //    }
            //    else
            //    {
            //        sequenceResult = true;
            //    }

            //}
            //else if (input.Contains("or"))
            //{
            //    if (results.Any(x => x == true))
            //    {
            //        sequenceResult = true;
            //    }
            //    else
            //    {
            //        sequenceResult = false;
            //    }
            //}
            //else //only one condition
            //{
            //    if (input.Contains("True"))
            //    {
            //        sequenceResult = true;
            //    }
            //    else
            //    {
            //        sequenceResult = false;
            //    }
            //}

            return(sequenceResult);
        }
Пример #11
0
        //public void LoadPrimarySplit(IGnosisPrimarySplitImplementation primarySplit)
        //{
        //    contentRoot.Children.Add((GnosisPrimarySplit)primarySplit);
        //}

        //public void LoadToolbarTray(IGnosisToolbarTrayImplementation toolbarTray)
        //{
        //    switch (((GnosisToolbarTray)toolbarTray).HorizontalAlignment)
        //    {
        //        case HorizontalAlignment.Left:
        //            pnlToolsLeft.Children.Add((GnosisToolbarTray)toolbarTray);
        //            break;
        //        case HorizontalAlignment.Center:
        //            pnlToolsCentre.Children.Add((GnosisToolbarTray)toolbarTray);
        //            break;
        //        case HorizontalAlignment.Right:
        //            pnlToolsRight.Children.Add((GnosisToolbarTray)toolbarTray);
        //            break;
        //    }
        //}

        public void SetController(GnosisVisibleController _controller)
        {
            controller = (GnosisParentWindowController)_controller;
        }
Пример #12
0
 public GnosisDocChange(GnosisVisibleController _controller, object _oldState)
 {
     controller = _controller;
     oldState   = _oldState;
 }
Пример #13
0
 public void SetTag(GnosisVisibleController controller)
 {
     this.Tag = controller;
 }