Example #1
0
        public PartPresenter(PartPresenterView view, IUnityContainer container)
        {
            _container = container;
            View = view;
            View.DataContext = this;
            _regionManager = new RegionManager();
            RegionManager.SetRegionManager(View, _regionManager);

            _addPartCommand = new Lazy<DelegateCommand<object>>(() => new DelegateCommand<object>(AddPartExecuted));
            Action<int> add = (i) =>
            {
                var region = _regionManager.Regions["Page1Content" + i];
                if (region.Views.Count() == 0)
                {
                    var partView = _container.Resolve<PartView>();

                    region.Add(partView);
                    region.Activate(partView);

                }
            };

            add(1);
            add(2);
            add(3);
        }
Example #2
0
        public PartPresenter(PartPresenterView view, IUnityContainer container)
        {
            _container       = container;
            View             = view;
            View.DataContext = this;
            _regionManager   = new RegionManager();
            RegionManager.SetRegionManager(View, _regionManager);

            _addPartCommand = new Lazy <DelegateCommand <object> >(() => new DelegateCommand <object>(AddPartExecuted));
            Action <int> add = (i) =>
            {
                var region = _regionManager.Regions["Page1Content" + i];
                if (region.Views.Count() == 0)
                {
                    var partView = _container.Resolve <PartView>();

                    region.Add(partView);
                    region.Activate(partView);
                }
            };

            add(1);
            add(2);
            add(3);
        }