Exemplo n.º 1
0
        public MediaContentViewModel(IKioskInteractionService interactionService, 
                                     IDemographicsService demographicSrv, 
                                     IContentManagement<ZoneFileMetaData> contentManagement, 
                                     IItemInteractionService itemInteractionService)
        {
            ItemState = ManipulationStates.NoTrack;
            _interactionService = interactionService;
            _interactionService.KioskStateChanged += _interactionService_KioskStateChanged;

            _demographicsService = demographicSrv;
            _demographicsService.DemographicsReceived += _demographicsService_DemographicsReceived;
            _demographicsService.DemographicsProcessingFailure += _demographicsService_DemographicsProcessingFailure;

            _contentManagement = contentManagement;

            _itemInteractionService = itemInteractionService;
            _itemInteractionService.ItemInteraction += _itemInteractionService_ItemStateChanged;

            ConfigurationProvider cp = new ConfigurationProvider();
            IConfigSettings cs = cp.Load();
            EnableDiagnostics = cs.EnableDiagnostics;
        }
Exemplo n.º 2
0
        public MediaContentViewModel(IKioskInteractionService interactionService, 
                                     IDemographicsService demographicSrv, 
                                     IContentManagement<ZoneFileMetaData> contentManagement, 
                                     IItemInteractionService itemInteractionService)
        {
            ItemState = ManipulationStates.NoTrack;
            _interactionService = interactionService;
            _interactionService.KioskStateChanged += _interactionService_KioskStateChanged;

            _demographicsService = demographicSrv;
            _demographicsService.DemographicsReceived += _demographicsService_DemographicsReceived;
            _demographicsService.DemographicsProcessingFailure += _demographicsService_DemographicsProcessingFailure;

            _contentManagement = contentManagement;

            _itemInteractionService = itemInteractionService;
            _itemInteractionService.ItemInteraction += _itemInteractionService_ItemStateChanged;

            ConfigurationProvider cp = new ConfigurationProvider();
            IConfigSettings cs = cp.Load();
            EnableDiagnostics = cs.EnableDiagnostics;
            //ClosestZone = cs.ZoneDefinitions.Where(x => x.MaximumRange == cs.ZoneDefinitions.Min(o => o.MaximumRange)).First().Name;
        }
Exemplo n.º 3
0
        private void SelectContentBasedOnItem(string itemSelected, ManipulationStates state)
        {
            bool hasContent = _contentManagement.LoadItemContents(itemSelected, state);

            if (hasContent)
            {
                if (!IsVideoPlaying)
                    MediaSource = _contentManagement.MoveNext().ContentPath;
            }
            else
            {
                ConfigurationProvider cp = new ConfigurationProvider();
                IConfigSettings cs = cp.Load();
                ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1}, for interaction {2}", cs.RootContentDirectory, itemSelected, state.ToString());
            }
        }
Exemplo n.º 4
0
        private void SelectContentBasedOnDemographics(BiometricData currentUser, string itemSelected = null)
        {
            bool hasContent = false;

            if (string.IsNullOrEmpty(itemSelected))
            {
                if (currentUser == null)
                    hasContent = _contentManagement.LoadContents(_currentZone);
                else
                    hasContent = _contentManagement.LoadContents(_currentZone, (m) => { return (currentUser.Age >= m.Age && currentUser.Age < m.MaxAge) && m.Gender.ToString().ToLower() == currentUser.Gender.ToString().ToLower(); });
            }
            else
            {
                if (currentUser == null)
                    hasContent = _contentManagement.LoadContents(itemSelected);
                else
                    hasContent = _contentManagement.LoadContents(itemSelected, (m) => { return (currentUser.Age >= m.Age && currentUser.Age < m.MaxAge) && m.Gender.ToString().ToLower() == currentUser.Gender.ToString().ToLower(); });
            }

            if (hasContent)
            {
                if (!IsVideoPlaying)
                    MediaSource = _contentManagement.MoveNext().ContentPath;
            }
            else
            {
                ConfigurationProvider cp = new ConfigurationProvider();
                IConfigSettings cs = cp.Load();
                if (string.IsNullOrEmpty(itemSelected))
                {
                    if (currentUser == null)
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1}", cs.RootContentDirectory, _currentZone);
                    else
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1} for {2}yo {3}", cs.RootContentDirectory, _currentZone, currentUser.Age.ToString(), currentUser.Gender.ToString());
                }
                else
                {
                    if (currentUser == null)
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1}", cs.RootContentDirectory, itemSelected);
                    else
                        ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1} for {2}yo {3}", cs.RootContentDirectory, itemSelected, currentUser.Age.ToString(), currentUser.Gender.ToString());
                }
            }
        }
Exemplo n.º 5
0
 public void MoveNext()
 {
     IFileMetaData metaData = _contentManagement.MoveNext();
     if (metaData != null)
     {
         MediaSource = metaData.ContentPath;
         ErrorMessage = String.Empty;
     }
     else
     {
         ConfigurationProvider cp = new ConfigurationProvider();
         IConfigSettings cs = cp.Load();
         if (_demographics != null)
             ErrorMessage = String.Format(@"Media Content is missing. Root Directory setting: {0}\{1}", cs.RootContentDirectory, _currentZone);
         else
             ErrorMessage = String.Format(@"Media Content is missing in the following directory: {0}\{1} for {2}yo {3}", cs.RootContentDirectory, _currentZone, _demographics.Age.ToString(), _demographics.Gender.ToString());
     }
 }