Ejemplo n.º 1
0
        protected virtual void UserControlOnLoaded()
        {
            Logger.Debug("Control Loaded {Element}", UserControl.GetType());

            if (!Model.IsInitialized)
            {
                var parentOption = ControlBindLogic.FindParentDatacontext(UserControl);
                parentOption.Run(
                    parent => parent.Actor.Tell(new InitParentViewModel(Model)),
                    () => ViewModelSuperviser.Get(ActorApplication.ActorSystem)
                    .Create(Model));
            }

            Model.AwaitInit(() => Model.Actor.Tell(new InitEvent()));
        }
Ejemplo n.º 2
0
        protected virtual void UserControlOnLoaded()
        {
            Logger.Debug("Control Loaded {Element}", UserControl.GetType());
            ControlUnload?.Invoke();

            if (!Model.IsInitialized)
            {
                var mayParent = ControlBindLogic.FindParentDatacontext(May(UserControl).Cast <TControl, DependencyObject>());

                Match(mayParent,
                      parent => Tell(parent.Actor, new InitParentViewModel(Model)),
                      () => ViewModelSuperviser.Get(ActorApplication.Application.ActorSystem)
                      .Create(Model));
            }

            Model.AwaitInit(() =>
            {
                Tell(Model.Actor, new InitEvent(UserControl.Key));
                CommandManager.InvalidateRequerySuggested();
            });
        }