コード例 #1
0
 public static void CheckExistenceBinding <TBinding>(IBindingRepository bindingRepository)
 {
     if (bindingRepository.GetBinding <TBinding>() == null)
     {
         throw new BindingNotExistException($"{typeof(TBinding).Name} not founded in current module. Module: {bindingRepository.GetType().Name}");
     }
 }
コード例 #2
0
 public static ObjectDescriptor AddDisposableBinding(this IBindingRepository @this, string name, IDisposable obj)
 {
     return(@this.AddDisposableBinding(obj, new AnalyzeOptions
     {
         Name = name,
         AnalyzeProperties = true
     }));
 }
コード例 #3
0
        public static void CheckViewModelBinding <TView, TViewModel>(IBindingRepository bindingRepository)
            where TView : FrameworkElement where TViewModel : class
        {
            Type serviceType = bindingRepository.GetBinding <TView>().ServiceType;

            if (!serviceType.IsEquivalentTo(typeof(TViewModel)))
            {
                throw new ServiceNotExistException($"{typeof(TViewModel).Name} is not a binding to {typeof(TView).Name}. Binding service: {serviceType.Name}");
            }
        }
コード例 #4
0
        public RpcBindingHost(IConnection <TMarshal> connection, IPlatformBinder <TMarshal> parameterBinder, IScheduler baseScheduler)
        {
            this.connection   = connection;
            bindingRepository = new BindingRepository(new IntIdGenerator());

            if (baseScheduler is IDisposable disposable)
            {
                disposables.Add(disposable);
            }

            // ReSharper disable once InvokeAsExtensionMethod
            var baseMessages = Observable.ObserveOn(connection, baseScheduler);

            callbackExecutor = new CallbackExecutor <TMarshal>(new IntIdGenerator(),
                                                               connection,
                                                               baseMessages.Select(m => m.CallbackResult)
                                                               .Where(m => m != null));
            var callbackFactory = new CallbackFactory <TMarshal>(callbackExecutor);
            var binder          = new ObjectBinderBuilder <TMarshal>().Use(typeof(CallbackBinder <TMarshal>), callbackFactory)
                                  .Use(typeof(OutgoingValueBinder <TMarshal>), bindingRepository)
                                  .Use(typeof(PlatformBinder <TMarshal>), parameterBinder).Build();

            methodExecutor   = new MethodExecutor <TMarshal>(bindingRepository.Objects, binder);
            propertyExecutor = new PropertyExecutor <TMarshal>(bindingRepository.Objects, binder);

            disposables.Add(Observable.ObserveOn((callbackExecutor as IObservable <DeleteCallback>), baseScheduler)
                            .Subscribe(OnDeleteCallback));
            disposables.Add(Observable.ObserveOn((callbackExecutor as IObservable <CallbackExecution <TMarshal> >), baseScheduler)
                            .Subscribe(OnCallbackExecution));

            // ReSharper disable once InvokeAsExtensionMethod

            disposables.Add(baseMessages
                            .Select(m => m.MethodExecution)
                            .Where(m => m != null)
                            .Subscribe(OnMethodExecution));
            disposables.Add(baseMessages
                            .Select(m => m.PropertyGet)
                            .Where(m => m != null)
                            .Subscribe(OnPropertyGetExecution));
            disposables.Add(baseMessages
                            .Select(m => m.PropertySet)
                            .Where(m => m != null)
                            .Subscribe(OnPropertySetExecution));
            disposables.Add(baseMessages
                            .Select(m => m.DynamicObjectRequest)
                            .Where(m => m != null)
                            .Subscribe(OnDyanmicObjectRequest));

            disposables.Add(connection);
        }
コード例 #5
0
        public static List <IBinding> SearchBindings(this IBindingRepository bindingRepository, IEnumerable <Type> typeBindings)
        {
            List <IBinding> bindings = new List <IBinding>();

            foreach (Type bindingType in typeBindings)
            {
                IBinding binding = bindingRepository.GetBinding(bindingType);
                if (binding != null)
                {
                    bindings.Add(binding);
                }
            }

            return(bindings);
        }
コード例 #6
0
 public ContainerModule(IBindingRepository bindings) : base(bindings)
 {
     _bindings = bindings;
 }
コード例 #7
0
ファイル: Container.cs プロジェクト: gmmoreira/sting-ioc
 public Container(IBindingRepository repository)
 {
     Repository = repository;
 }
コード例 #8
0
ファイル: Container.cs プロジェクト: gmmoreira/sting-ioc
 public Container()
 {
     Repository = BindingRepository();
 }
コード例 #9
0
 public BindableBase(IBindingRepository repository)
 {
     _bindingRepository = repository;
 }
コード例 #10
0
 public BookController(IBookView view, IBookRepository bookRepository, IBindingRepository bindingRepository)
 {
     _view              = view;
     _bookRepository    = bookRepository;
     _bindingRepository = bindingRepository;
 }
コード例 #11
0
 public static IBindingRepository AsReadOnly(this IBindingRepository @this)
 {
     return(new ReadOnlyBindingRepositry(@this));
 }
コード例 #12
0
 public Component(IBindingRepository repository, Type bindingType)
 {
     _repository  = repository;
     _bindingType = bindingType;
 }
コード例 #13
0
 public ViewRegister(IBindingRepository bindingRepository)
 {
     _bindableBase = new BindableBase(bindingRepository);
 }
コード例 #14
0
        public void Init()
        {
            _swordBinding = new Binding(typeof(IWeapon), typeof(Sword));

            _repository = new Repository();
        }
コード例 #15
0
 public ViewFactory(IModule controllerModule, IImplementor implementor)
 {
     _viewModelsBindings = controllerModule.Bindings;
     _implementor        = implementor;
 }
コード例 #16
0
 public Configuration(IBindingRepository repository)
 {
     _repository = repository;
 }
コード例 #17
0
 public OutgoingValueBinder(BindingDelegate <TMarshal> next, IBindingRepository bindingRepository)
 {
     this.next = next;
     this.bindingRepository = bindingRepository;
 }
コード例 #18
0
 public ReadOnlyBindingRepositry(IBindingRepository wrapped)
 {
     this.wrapped = wrapped;
 }