public virtual void BindCloudConnectView(ICloudConnectView view)
 {
     _cloudConnectView = view;
     _cloudConnectView.OnViewDestroy = (view2) =>
     {
         _cloudConnectPresenter.ViewDestroyed();
         _cloudConnectPresenter = null;
         _cloudConnectView = null;
     };
     _cloudConnectPresenter = Bootstrapper.GetContainer().Resolve<ICloudConnectPresenter>();
     _cloudConnectPresenter.BindView(view);
 }
Beispiel #2
0
        public virtual ICloudConnectView CreateCloudConnectView()
        {
            // If the view is still visible, just make it the top level window
            if (_cloudConnectView != null)
            {
                _cloudConnectView.ShowView(true);
                return _cloudConnectView;
            }

            // The view invokes the OnViewReady action when the view is ready. This means the presenter can be created and bound to the view.
            Action<IBaseView> onViewReady = (view) =>
            {
                _cloudConnectPresenter = Bootstrapper.GetContainer().Resolve<ICloudConnectPresenter>();
                _cloudConnectPresenter.BindView((ICloudConnectView)view);
            };

            // Create view and manage view destruction
            _cloudConnectView = Bootstrapper.GetContainer().Resolve<ICloudConnectView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
            _cloudConnectView.OnViewDestroy = (view) =>
            {
                _cloudConnectPresenter.ViewDestroyed();
                _cloudConnectPresenter = null;
                _cloudConnectView = null;
            };
            return _cloudConnectView;
        }