Пример #1
0
            public void Complete()
            {
                // If the manipulation was not started, we just abort the manipulation without any event
                switch (_state)
                {
                case ManipulationStates.Started:
                    _state = ManipulationStates.Completed;

                    _recognizer.ManipulationCompleted?.Invoke(
                        _recognizer,
                        new ManipulationCompletedEventArgs(_deviceType, _currents.Center, GetDelta(), isInertial: false));
                    break;

                default:
                    _state = ManipulationStates.Completed;
                    break;
                }

                // Self scavenge our self from the _recognizer ... yes it's a bit strange,
                // but it's the safest and easiest way to avoid invalid state.
                if (_recognizer._manipulation == this)
                {
                    _recognizer._manipulation = null;
                }
            }
Пример #2
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());
            }
        }
        public bool LoadItemContents(string item, ManipulationStates itemState)
        {
            _filteredContentList = null;
            _filteredContentList = _allItemContentList.Where(x => x.ContentFolder.ToLower() == item.ToLower() && x.ItemState.ToLower() == itemState.ToString().ToLower());

            // if _filteredContentList is null, return default content
            if (_filteredContentList == null || _filteredContentList.Count() == 0)
            {
                _filteredContentList = _defaultItemContentList.Where(x => x.ContentFolder.ToLower() == item.ToLower());
            }

            if (_filteredContentList != null && _filteredContentList.Count() > 0)
            {
                return(true);        // has content
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
            private void NotifyUpdate(bool forceUpdate = false)
            {
                // Note: Make sure to update the _manipulationLast before raising the event, so if an exception is raised
                //		 or if the manipulation is Completed, the Complete event args can use the updated _manipulationLast.

                switch (_state)
                {
                case ManipulationStates.Starting:
                    var cumulative = GetDelta();
                    if (forceUpdate || IsSignificant(cumulative))
                    {
                        _state         = ManipulationStates.Started;
                        _lastPublished = _currents;

                        _recognizer.ManipulationStarted?.Invoke(
                            _recognizer,
                            new ManipulationStartedEventArgs(_deviceType, _currents.Center, cumulative));
                    }

                    break;

                case ManipulationStates.Started when _recognizer.ManipulationUpdated == null:
                    _lastPublished = _currents;
                    break;

                case ManipulationStates.Started:
                    // Even if Scale and Angle are expected to be default when we add a pointer (i.e. forceUpdate == true),
                    // the 'delta' and 'cumulative' might still contains some TranslateX|Y compared to the previous Pointer1 location.
                    var delta = GetDelta(_lastPublished);
                    if (forceUpdate || IsSignificant(delta))
                    {
                        _lastPublished = _currents;

                        _recognizer.ManipulationUpdated.Invoke(
                            _recognizer,
                            new ManipulationUpdatedEventArgs(_deviceType, _currents.Center, delta, GetDelta(), isInertial: false));
                    }
                    break;
                }
            }
Пример #5
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());
            }
        }
Пример #6
0
 private void OnItemInteraction(TrackedItem item, ManipulationStates st)
 {
     var handler = this.ItemInteraction;
     if (handler != null)
     {
         var kioskEvent = new KioskStateEventArgs();
         kioskEvent.ItemSelected = item.ObjectID;
         kioskEvent.ItemState = st;
         kioskEvent.TrackingID = this.CorrelationPlayerId;
         handler(this, kioskEvent);
     }
 }