Example #1
0
            private void ImplementUiStuff(ComponentRegistration <object> registration)
            {
                if (_configuration != Configuration.Ui)
                {
                    return;
                }

                registration.Proxy
                .AdditionalInterfaces(
                    typeof(INotifyPropertyChanged),
                    typeof(INotifyPropertyChangedRaiser),
                    typeof(INotifyCollectionChanged),
                    typeof(IClosable))
                .Interceptors(
                    typeof(NotifyPropertyChangedInterceptor),
                    typeof(CloseInterceptor));


                registration.OnCreate((kernel, instance) =>
                {
                    if (registration.Implementation.Implements <IReceive>())
                    {
                        Game game = null;

                        if (Ui.Match != null)
                        {
                            game = Ui.Match.Game;
                            game.Subscribe(instance);
                        }

                        Ui.Publisher.Subscribe(instance);

                        var disposed     = (IClosable)instance;
                        disposed.Closed += delegate
                        {
                            if (game != null)
                            {
                                game.Unsubscribe(instance);
                            }

                            Ui.Publisher.Unsubscribe(instance);
                        };
                    }

                    var initializable = instance as ViewModelBase;
                    if (initializable != null)
                    {
                        initializable.Initialize();
                    }
                });
            }
 public virtual void Apply(Component component, ComponentRegistration registration)
 {
     registration.OnCreate(onCreate);
 }
Example #3
0
 public virtual void Apply(Component component, ComponentRegistration registration)
 {
     registration.OnCreate(onCreate);
 }