Esempio n. 1
0
 public virtual void BindSyncWebBrowserView(ISyncWebBrowserView view)
 {
     _syncWebBrowserView = view;
     _syncWebBrowserView.OnViewDestroy = (view2) =>
     {
         _syncWebBrowserPresenter.ViewDestroyed();
         _syncWebBrowserPresenter = null;
         _syncWebBrowserView = null;
     };
     _syncWebBrowserPresenter = Bootstrapper.GetContainer().Resolve<ISyncWebBrowserPresenter>();
     _syncWebBrowserPresenter.BindView(view);
 }
Esempio n. 2
0
        public virtual ISyncWebBrowserView CreateSyncWebBrowserView()
        {
            // If the view is still visible, just make it the top level window
            if (_syncWebBrowserView != null)
            {
                _syncWebBrowserView.ShowView(true);
                return _syncWebBrowserView;
            }

            // 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) =>
            {
                _syncWebBrowserPresenter = Bootstrapper.GetContainer().Resolve<ISyncWebBrowserPresenter>();
                _syncWebBrowserPresenter.BindView((ISyncWebBrowserView)view);
            };

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