示例#1
0
        public StackViewLayout(Transform layout, IBackgroundView background)
        {
            _background = background;
            Layout      = layout;

            OnClosed.Where(x => x == _activeView)
            .Subscribe(HideView)
            .AddTo(LifeTime);

            OnBecameHidden.Where(x => x == _activeView)
            .Subscribe(HideView)
            .AddTo(LifeTime);

            OnBecameVisible.Where(x => x != _activeView)
            .Subscribe(ActivateView)
            .AddTo(LifeTime);
        }
        public DefaultViewLayout(Transform layout, IBackgroundView background)
        {
            _background = background;
            Layout      = layout;

            OnClosed.Where(x => x == _activeView).
            Subscribe(HideView).
            AddTo(LifeTime);

            OnHidden.Where(x => x == _activeView).
            Subscribe(HideView).
            AddTo(LifeTime);

            OnShown.Where(x => x != _activeView).
            Subscribe(ActivateView).
            AddTo(LifeTime);
        }
        protected virtual IViewLayout Create()
        {
            IBackgroundView backgroundView = null;

            if (_backgroundFactory != null)
            {
                backgroundView = _backgroundFactory.Create();
                backgroundView.Hide();
            }

            if (_layoutBehaviourFactory == null)
            {
                throw new NullReferenceException(nameof(_layoutBehaviourFactory));
            }

            return(_layoutBehaviourFactory.Create(_layoutCanvas.transform, backgroundView));
        }
        private static void CreateViewInstances(IApplicationController applicationController,
                                                IGraphControlView controlView,
                                                IDataService dataService,
                                                IScaleService scaleService,
                                                IBackgroundView userBackgroundView,
                                                IGridView userGridView,
                                                IDataView userDataView,
                                                IScalingSelectionView userScalingSelectionView,
                                                IBackgroundState userBackgroundState,
                                                IGridState userGridState,
                                                IDataDrawState userDataDrawState,
                                                out IBackgroundPresenter backgroundPresenter,
                                                out IGridPresenter gridPresenter,
                                                out IDataPresenter dataPresenter,
                                                out IScalingSelectionView scalingView)
        {
            var backgroundView = userBackgroundView ?? new BackgroundView();

            backgroundPresenter = new BackgroundPresenter(backgroundView, userBackgroundState);
            applicationController.RegisterInstance <IBackgroundPresenter>(backgroundPresenter);

            var gridView = userGridView ?? new GridView(scaleService);

            gridPresenter = new GridPresenter(gridView, userGridState);
            applicationController.RegisterInstance <IGridPresenter>(gridPresenter);

            var dataView = userDataView ?? new DataView(scaleService, dataService);

            dataPresenter = new DataPresenter(dataView, userDataDrawState, dataService);
            applicationController.RegisterInstance <IDataPresenter>(dataPresenter);

            scalingView = userScalingSelectionView ?? new ScalingView();

            // Register IGraphControlView here
            applicationController.RegisterInstance <IGraphControlView>(controlView);
        }
示例#5
0
 public override IViewLayout Create(Transform canvasPoint, IBackgroundView backgroundView)
 {
     return(new DefaultViewLayout(canvasPoint, backgroundView));
 }
 public abstract IViewLayout Create(Transform canvasPoint, IBackgroundView backgroundView);
 public BackgroundPresenter(IBackgroundView view, IBackgroundState state)
 {
     this.View  = view;
     this.state = state;
 }