/// <summary>
        /// Initializes a new instance of the <see cref="SearchViewPresentationModel"/> class.
        /// </summary>
        /// <param name="view">The view associated with this presentation model.</param>
        /// <param name="configurationService">The configuration service instance used to retrieve configuration values.</param>
        /// <param name="assetsDataServiceFacade">The service facade used to search for assets.</param>
        /// <param name="eventAggregator">The event aggregator instance used to publish/subscribe for events.</param>
        public SearchViewPresentationModel(ISearchView view, IConfigurationService configurationService, IAssetsDataServiceFacade assetsDataServiceFacade, IEventAggregator eventAggregator, ISearchServiceBridge searchServiceBridge)
        {
            this.configurationService = configurationService;

            this.assetsDataServiceFacade = assetsDataServiceFacade;
            this.assetsDataServiceFacade.LoadAssetsCompleted += this.OnLoadAssetsCompleted;

            this.searchServiceBridge = searchServiceBridge;
            this.searchServiceBridge.ResultsAvailable += this.OnLoadAssetsCompleted;

            this.eventAggregator = eventAggregator;
            this.eventAggregator.GetEvent <AssetsLoadingEvent>().Subscribe(this.OnAssetsLoading, true);

            this.searchCommand         = new DelegateCommand <string>(this.Search);
            this.KeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.ExecuteKeyboardAction);

            this.SearchIntegrationEnabled = this.configurationService.GetParameterValueAsBoolean("SearchIntegrationEnabled").GetValueOrDefault();
            this.CanSearch = true;

            this.View       = view;
            this.View.Model = this;

            if (!this.SearchIntegrationEnabled)
            {
                this.Search(null);
            }
        }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SearchViewPresentationModel"/> class.
        /// </summary>
        /// <param name="view">The view associated with this presentation model.</param>
        /// <param name="configurationService">The configuration service instance used to retrieve configuration values.</param>
        /// <param name="assetsDataServiceFacade">The service facade used to search for assets.</param>
        /// <param name="eventAggregator">The event aggregator instance used to publish/subscribe for events.</param>
        public SearchViewPresentationModel(ISearchView view, IConfigurationService configurationService, IAssetsDataServiceFacade assetsDataServiceFacade, IEventAggregator eventAggregator)
        {
            this.configurationService    = configurationService;
            this.assetsDataServiceFacade = assetsDataServiceFacade;
            this.eventAggregator         = eventAggregator;
            this.assetsDataServiceFacade.LoadAssetsCompleted += this.DataServiceFacade_LoadAssetsCompleted;
            this.View = view;

            this.searchCommand = new DelegateCommand <string>(this.Search);

            this.View.Model = this;

            this.Search(null);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="MediaBinViewPresentationModel"/> class.
        /// </summary>
        /// <param name="view">The view of Media Bin Module.</param>
        /// <param name="assetsDataServiceFacade">The service facade.</param>
        /// <param name="eventAggregator">The event aggregator.</param>
        /// <param name="logger">The logger class object.</param>
        /// <param name="projectService">The project service.</param>
        /// <param name="regionManager">The region manager.</param>
        /// <param name="configurationService">Tje Configuration service.</param>
        public MediaBinViewPresentationModel(IMediaBinView view, IAssetsDataServiceFacade assetsDataServiceFacade, IEventAggregator eventAggregator, ILogger logger, IProjectService projectService, IRegionManager regionManager, IConfigurationService configurationService)
        {
            this.logger = logger;
            this.assetsDataServiceFacade = assetsDataServiceFacade;
            this.assetsDataServiceFacade.LoadAssetsByLibraryIdCompleted += this.OnLoadAssetsByLibraryIdCompleted;
            this.eventAggregator = eventAggregator;
            this.projectService  = projectService;
            this.projectService.ProjectRetrieved += this.RefreshMediaBin;
            this.regionManager        = regionManager;
            this.configurationService = configurationService;
            this.currentAssets        = new ObservableCollection <Asset>();
            this.View = view;

            this.resourceManager = new ResourceManager(typeof(Resources));

            this.searchCommand            = new DelegateCommand <string>(this.Search);
            this.shiftSliderScaleCommand  = new DelegateCommand <string>(this.ShiftScale, this.CanShiftScale);
            this.addFolderCommand         = new DelegateCommand <string>(this.AddFolder, this.CanAddFolder);
            this.parentFolderCommand      = new DelegateCommand <string>(this.ShowParentFolders, this.CanShowParentFolder);
            this.deleteAssetCommand       = new DelegateCommand <string>(this.DeleteAsset, this.CanDeleteAsset);
            this.helpViewCommand          = new DelegateCommand <string>(this.ShowHelpView);
            this.playSelectedAssetCommand = new DelegateCommand <object>(this.PlaySelectedAsset);
            this.DropCommand           = new DelegateCommand <DropPayload>(this.DropAssetOnFolder);
            this.KeyboardActionCommand = new DelegateCommand <Tuple <KeyboardAction, object> >(this.ExecuteKeyboardAction);
            this.ShowImages            = true;
            this.ShowVideos            = true;
            this.ShowAudio             = true;
            this.LoadMediaBin();
            this.PropertyChanged += this.MediaBinPresentationModel_PropertyChanged;

            this.eventAggregator.GetEvent <ResetWindowsEvent>().Subscribe(this.ResetWindow);
            this.eventAggregator.GetEvent <AddAssetEvent>()
            .Subscribe(this.AddAsset, ThreadOption.PublisherThread, true, this.AddAssetFilter);

            // Set the default value of the text box.
            this.FolderTitle = "Root";

            // Todo: Get this value from the config file.
            this.Scale = 0.2;

            // Add metadata fields.
            this.View.AddMetadataFields(this.configurationService.GetMetadataFields());
            this.IsThumbChecked = true;
            this.View.Model     = this;
        }