コード例 #1
0
        protected override void OnActivated()
        {
            base.OnActivated();

            if (LogicRuleManager.HasRules(View.ObjectTypeInfo))
            {
                View.SelectionChanged            += ViewOnSelectionChanged;
                View.CurrentObjectChanged        += ViewOnCurrentObjectChanged;
                View.QueryCanChangeCurrentObject += ViewOnQueryCanChangeCurrentObject;

                ObjectSpace.ObjectChanged += ObjectSpaceOnObjectChanged;
                ObjectSpace.Committed     += ObjectSpaceOnCommitted;
                ObjectSpace.Refreshing    += ObjectSpace_Refreshing;
                ObjectSpace.Reloaded      += ObjectSpace_Reloaded;

                Frame.TemplateViewChanged += FrameOnTemplateViewChanged;
                _logicRuleExecutor.Execute(ExecutionContext.ControllerActivated, EventArgs.Empty, View);

                if (View is ListView)
                {
                    Frame.GetController <ListViewProcessCurrentObjectController>(controller => {
                        controller.CustomProcessSelectedItem   += OnCustomProcessSelectedItem;
                        controller.CustomizeShowViewParameters += CustomizeShowViewParameters;
                    });
                }
            }
        }
コード例 #2
0
        protected override void OnDeactivated()
        {
            base.OnDeactivated();
            if (LogicRuleManager.HasActionContextRules(View.ObjectTypeInfo))
            {
                UnsubscribeFromActionEvents();
            }
            if (LogicRuleManager.HasRules(View.ObjectTypeInfo))
            {
                _logicRuleExecutor.Execute(ExecutionContext.ControllerDeActivated, EventArgs.Empty, View);
                View.SelectionChanged            -= ViewOnSelectionChanged;
                View.CurrentObjectChanged        -= ViewOnCurrentObjectChanged;
                View.QueryCanChangeCurrentObject -= ViewOnQueryCanChangeCurrentObject;

                if (ObjectSpace != null)
                {
                    ObjectSpace.ObjectChanged -= ObjectSpaceOnObjectChanged;
                    ObjectSpace.Refreshing    -= ObjectSpace_Refreshing;
                    ObjectSpace.Reloaded      -= ObjectSpace_Reloaded;
                    ObjectSpace.Committed     -= ObjectSpaceOnCommitted;
                }

                Frame.TemplateViewChanged -= FrameOnTemplateViewChanged;
                if (View is ListView)
                {
                    Frame.GetController <ListViewProcessCurrentObjectController>(controller => {
                        controller.CustomProcessSelectedItem   -= OnCustomProcessSelectedItem;
                        controller.CustomizeShowViewParameters -= CustomizeShowViewParameters;
                    });
                }
            }
        }
コード例 #3
0
 protected override void OnViewControllersActivated()
 {
     base.OnViewControllersActivated();
     if (LogicRuleManager.HasActionContextRules(View.ObjectTypeInfo))
     {
         SubscribeToActionEvents();
     }
 }
コード例 #4
0
        void ForceExecutioning(View view, ExecutionContext executionContext)
        {
            if (View != null)
            {
                InvertExecution(View, executionContext);
            }
            Active[ActiveObjectTypeHasRules] = LogicRuleManager <TModelLogicRule> .HasRules(view);

            ForceExecution(Active[ActiveObjectTypeHasRules] && view != null && view.ObjectTypeInfo != null, view, false,
                           executionContext);
        }
コード例 #5
0
        void FrameOnTemplateChanged(object sender, EventArgs eventArgs)
        {
            var supportViewChanged = (Frame.Template) as ISupportViewChanged;

            if (supportViewChanged != null)
            {
                supportViewChanged.ViewChanged += (o, args) => {
                    Active[ActiveObjectTypeHasRules] = LogicRuleManager <TModelLogicRule> .HasRules(args.View);

                    ForceExecution(ExecutionContext.ViewChanged, args.View);
                }
            }
            ;
        }
コード例 #6
0
        void ApplicationOnViewCreating(object sender, ViewCreatingEventArgs viewCreatingEventArgs)
        {
            if (Application != null)
            {
                var modelObjectView = Application.Model.Views.Single(modelView => modelView.Id == viewCreatingEventArgs.ViewID).AsObjectView;
                if (modelObjectView != null)
                {
                    var typeInfo = modelObjectView.ModelClass.TypeInfo;
                    Active[ActiveObjectTypeHasRules] = LogicRuleManager <TModelLogicRule> .HasRules(typeInfo);

                    ForceExecution(Active[ActiveObjectTypeHasRules], null, false, ExecutionContext.ViewCreating);
                }
            }
        }
コード例 #7
0
 public bool HasRules(View view)
 {
     return(LogicRuleManager <TLogicRule> .HasRules(view));
 }
コード例 #8
0
        void ForceExecution(ActionBaseEventArgs args)
        {
            Active[ActiveObjectTypeHasRules] = LogicRuleManager <TModelLogicRule> .HasRules(args.ShowViewParameters.CreatedView.ObjectTypeInfo);

            ForceExecution(IsReady, args.ShowViewParameters.CreatedView, false, ExecutionContext.None, args.ShowViewParameters.CreatedView.CurrentObject, args.Action);
        }