Ejemplo n.º 1
0
        public static Models.View RaiseViewEvent(enumEventType eventtype, RenderContext context, ComponentSetting setting, Models.View view = null)
        {
            if (eventtype == enumEventType.ViewFinding)
            {
                ViewFinding finding = new ViewFinding(context, setting);
                RaiseEvent(context, finding);
                return(finding.View);
            }
            else if (eventtype == enumEventType.ViewFound)
            {
                if (view != null)
                {
                    ViewFound found = new ViewFound(context, setting, view);

                    RaiseEvent(context, found);

                    if (found.DataChange && found.View != null)
                    {
                        return(found.View);
                    }
                }
            }
            else if (eventtype == enumEventType.ViewNotFound)
            {
                ViewNotFound notfound = new ViewNotFound(context, setting);
                RaiseEvent(context, notfound);
                return(notfound.View);
            }
            return(null);
        }
Ejemplo n.º 2
0
 public static Models.Page RaisePageEvent(enumEventType eventtype, RenderContext context, Models.Page page = null)
 {
     if (eventtype == enumEventType.PageFinding)
     {
         PageFinding finding = new PageFinding(context);
         RaiseEvent(context, finding);
         return(finding.Page);
     }
     else if (eventtype == enumEventType.PageFound)
     {
         if (page != null)
         {
             PageFound found = new PageFound(context, page);
             RaiseEvent(context, found);
             if (found.DataChange && found.Page != null)
             {
                 return(found.Page);
             }
         }
     }
     //else if (eventtype == enumEventType.)
     //{
     //    PageNotFound notfound = new PageNotFound(context);
     //    RaiseEvent(context, notfound);
     //    return notfound.Page;
     //}
     return(null);
 }
Ejemplo n.º 3
0
        public static Kooboo.Sites.Routing.Route RaiseRouteEvent(enumEventType eventtype, RenderContext context, Kooboo.Sites.Routing.Route route = null)
        {
            if (eventtype == enumEventType.RouteFinding)
            {
                RouteFinding finding = new RouteFinding(context);
                RaiseEvent(context, finding);
                return(finding.Route);
            }
            else if (eventtype == enumEventType.RouteFound)
            {
                if (route != null)
                {
                    RouteFound found = new RouteFound(context, route);
                    RaiseEvent(context, found);
                    if (found.DataChange && found.Route != null)
                    {
                        return(found.Route);
                    }
                }
            }
            else if (eventtype == enumEventType.RouteNotFound)
            {
                RouteNotFound notfound = new RouteNotFound(context);
                RaiseEvent(context, notfound);
                return(notfound.Route);
            }

            return(null);
        }
Ejemplo n.º 4
0
        public void Handle(object sender, enumEventType eventType, object eventArg, EventHandleStatus status)
        {
            if (_modelEditor == null)
            {
                _modelEditor = sender  as IModelEditor;
            }
            switch (eventType)
            {
            case enumEventType.MouseWheel:
                MouseWheel(eventArg as MouseEventArgs, status);
                break;

            case enumEventType.MouseDown:
                MouseDown(eventArg as MouseEventArgs, status);
                break;

            case enumEventType.MouseMove:
                MouseMove(eventArg as MouseEventArgs, status);
                break;

            case enumEventType.MouseUp:
                MouseUp(eventArg as MouseEventArgs, status);
                break;
            }
        }
Ejemplo n.º 5
0
 public void Handle(object sender, enumEventType eventType, object eventArg, EventHandleStatus status)
 {
     switch (eventType)
     {
     case enumEventType.MouseDoubleClick:
         DoBinding(eventArg as MouseEventArgs, status);
         break;
     }
 }
Ejemplo n.º 6
0
        public static List <EventConditionSetting> GetConditionSetting(enumEventType eventype, RenderContext context)
        {
            var alltypes = Lib.Reflection.AssemblyLoader.LoadTypeByInterface(typeof(IFrontEvent));

            foreach (var item in alltypes)
            {
                if (System.Activator.CreateInstance(item) is IFrontEvent instance && instance.EventType == eventype)
                {
                    return(instance.GetConditionSetting(context));
                }
            }

            return(new List <EventConditionSetting>());
        }
Ejemplo n.º 7
0
 private void HandleEvent(enumEventType eventType, object eventArg)
 {
     if (_eventHandlers == null || _eventHandlers.Count == 0)
     {
         return;
     }
     _eventHandleStatus.Handled = false;
     try
     {
         foreach (IEventHandler h in _eventHandlers)
         {
             h.Handle(this, eventType, eventArg, _eventHandleStatus);
             if (_eventHandleStatus.Handled)
             {
                 return;
             }
         }
     }
     finally
     {
         _eventHandleStatus.Handled = false;
     }
 }