// Shared initialization code
		void Initialize()
		{
			// Custom types cannot be used in the constructors under Mac.
			string database = "/Users/animal/.MPfm/MPfm.Database.db";
//			gateway = new MPfmGateway(database);
//			libraryService = new LibraryService(gateway);
//			updateLibraryService = new UpdateLibraryService(libraryService);
//
//			// Create presenter
//			presenter = new UpdateLibraryPresenter(
//				libraryService,
//				updateLibraryService
//			);

            presenter = Bootstrapper.GetContainer().Resolve<UpdateLibraryPresenter>();

			presenter.BindView(this);

			// Center window
			Window.Center();
		}
Пример #2
0
 public virtual void BindUpdateLibraryView(IUpdateLibraryView view)
 {
     _updateLibraryView = view;
     _updateLibraryPresenter = Bootstrapper.GetContainer().Resolve<IUpdateLibraryPresenter>();
     _updateLibraryPresenter.BindView(view);
     _updateLibraryView.OnViewDestroy = (view2) =>
     {
         _updateLibraryPresenter.ViewDestroyed();
         _updateLibraryPresenter = null;
         _updateLibraryView = null;
     };
 }
Пример #3
0
        public virtual IUpdateLibraryView CreateUpdateLibraryView(List<string> filePaths, List<Folder> folderPaths)
        {
            if (_updateLibraryView != null)
            {
                _updateLibraryView.ShowView(true);
                return _updateLibraryView;
            }

            Action<IBaseView> onViewReady = (view) =>
            {
                _updateLibraryPresenter = Bootstrapper.GetContainer().Resolve<IUpdateLibraryPresenter>();
                _updateLibraryPresenter.BindView((IUpdateLibraryView)view);
                _updateLibraryPresenter.UpdateLibrary(filePaths, folderPaths);
            };

            _updateLibraryView = Bootstrapper.GetContainer().Resolve<IUpdateLibraryView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
            _updateLibraryView.OnViewDestroy = (view) =>
            {
                _updateLibraryPresenter.ViewDestroyed();
                _updateLibraryPresenter = null;
                _updateLibraryView = null;
            };
            return _updateLibraryView;
        }
Пример #4
0
 public virtual IMainView CreateMainView()
 {
     // 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) => {
         _mainPresenter = Bootstrapper.GetContainer().Resolve<IMainPresenter>();
         _mainPresenter.BindView((IMainView)view);                
         _playerPresenter = Bootstrapper.GetContainer().Resolve<IPlayerPresenter>();
         _playerPresenter.BindView((IPlayerView)view);
         _libraryBrowserPresenter = Bootstrapper.GetContainer().Resolve<ILibraryBrowserPresenter>();
         _libraryBrowserPresenter.BindView((ILibraryBrowserView)view);                
         _songBrowserPresenter = Bootstrapper.GetContainer().Resolve<ISongBrowserPresenter>();
         _songBrowserPresenter.BindView((ISongBrowserView)view);
         _markersPresenter = Bootstrapper.GetContainer().Resolve<IMarkersPresenter>();
         _markersPresenter.BindView((IMarkersView)view);
         _markerDetailsPresenter = Bootstrapper.GetContainer().Resolve<IMarkerDetailsPresenter>(new NamedParameterOverloads() { { "markerId", Guid.Empty } });
         _markerDetailsPresenter.BindView((IMarkerDetailsView)view);
         _loopsPresenter = Bootstrapper.GetContainer().Resolve<ILoopsPresenter>();
         _loopsPresenter.BindView((ILoopsView)view);
         _loopDetailsPresenter = Bootstrapper.GetContainer().Resolve<ILoopDetailsPresenter>(new NamedParameterOverloads() { { "loopId", Guid.Empty } });
         _loopDetailsPresenter.BindView((ILoopDetailsView)view);
         _segmentDetailsPresenter = Bootstrapper.GetContainer().Resolve<ISegmentDetailsPresenter>(new NamedParameterOverloads() { { "segmentId", Guid.Empty } });
         _segmentDetailsPresenter.BindView((ISegmentDetailsView)view);
         _timeShiftingPresenter = Bootstrapper.GetContainer().Resolve<ITimeShiftingPresenter>();
         _timeShiftingPresenter.BindView((ITimeShiftingView)view);
         _pitchShiftingPresenter = Bootstrapper.GetContainer().Resolve<IPitchShiftingPresenter>();
         _pitchShiftingPresenter.BindView((IPitchShiftingView)view);
         _updateLibraryPresenter = Bootstrapper.GetContainer().Resolve<IUpdateLibraryPresenter>();
         _updateLibraryPresenter.BindView((IUpdateLibraryView)view);
     };            
     _mainView = Bootstrapper.GetContainer().Resolve<IMainView>(new NamedParameterOverloads() { { "onViewReady", onViewReady } });
     _mainView.OnViewDestroy = (view) => {
         _mainView = null;
         _mainPresenter.ViewDestroyed();
         _mainPresenter = null;
         _playerPresenter.ViewDestroyed();
         _playerPresenter = null;
         _libraryBrowserPresenter.ViewDestroyed();
         _libraryBrowserPresenter = null;
         _songBrowserPresenter.ViewDestroyed();
         _songBrowserPresenter = null;
         _markersPresenter.ViewDestroyed();
         _markersPresenter = null;
         _markerDetailsPresenter.ViewDestroyed();
         _markerDetailsPresenter = null;
         _loopsPresenter.ViewDestroyed();
         _loopsPresenter = null;
         _loopDetailsPresenter.ViewDestroyed();
         _loopDetailsPresenter = null;
         _segmentDetailsPresenter.ViewDestroyed();
         _segmentDetailsPresenter = null;
         _timeShiftingPresenter.ViewDestroyed();
         _timeShiftingPresenter = null;
         _pitchShiftingPresenter.ViewDestroyed();
         _pitchShiftingPresenter = null;
         _updateLibraryPresenter.ViewDestroyed();
         _updateLibraryPresenter = null;
     };
     return _mainView;
 }