示例#1
0
        public bool OnActionPerformed <T>(IActionPerformer <T> sender, ActionPerformedEventArgs <T> args)
            where T : IViewModel, new()
        {
            if (this.Behaviors.ContainsKey(args.BehaviorName) == false)
            {
                return(false);
            }

            var behavior = this.Behaviors[args.BehaviorName] as IBehavior <T>;

            if (behavior == null)
            {
                return(false);
            }

            behavior.Execute(args);

            var viewName = this.Mapping[args.BehaviorName];

            var nextView = this.GetNextView(viewName);

            this.OnBeforeViewSwitch(nextView, behavior);

            this.SwitchView(sender as ApplicationViewBase, viewName, args);

            return(true);
        }
示例#2
0
 public bool RaiseActionEvent <T>(ActionPerformedHandler <T> handler, ActionPerformedEventArgs <T> args) where T : IViewModel, new()
 {
     if (args == null)
     {
         return(false);
     }
     return(handler != null && handler(this as IActionPerformer <T>, args));
 }
示例#3
0
        public bool OnActionPerformed <T>(ActionPerformedEventArgs <T> args) where T : IViewModel, new()
        {
            var success = false;

            foreach (var raiseActionEventDelegate in this.RaiseActionEventDelegates)
            {
                success = raiseActionEventDelegate.Invoke(args);
            }

            return(success);
        }
示例#4
0
        private void SwitchView <T>(IHideable sender, string viewName, ActionPerformedEventArgs <T> args)
            where T : IViewModel, new()
        {
            this.SwitchView(sender, viewName);

            this.RaiseViewSwitch(args, this.OnViewSwitch, viewName);

            if (sender is IActionPerformer <T> )
            {
                this.CurrentViewName = viewName;
            }
        }
示例#5
0
        private void RaiseViewSwitch <T>(ActionPerformedEventArgs <T> args,
                                         ViewSwitchedMethodDelegate <T> viewSwitchedMethod, string viewName)
            where T : IViewModel, new()
        {
            viewSwitchedMethod(new ViewSwitchedEventArgs <T>(args)
            {
                DataItem         = args.DataItem,
                CurrentViewName  = viewName,
                PreviousViewName = this.CurrentViewName
            });

            this.CurrentViewName = viewName;
        }