private static void OnSourceEvent(InteractionManager.EventType eventType, InteractionSourceState state)
        {
            switch (eventType)
            {
            case InteractionManager.EventType.SourceDetected:
            {
                InteractionManager.SourceEventHandler sourceDetected = InteractionManager.SourceDetected;
                if (sourceDetected != null)
                {
                    sourceDetected(state);
                }
                break;
            }

            case InteractionManager.EventType.SourceLost:
            {
                InteractionManager.SourceEventHandler sourceLost = InteractionManager.SourceLost;
                if (sourceLost != null)
                {
                    sourceLost(state);
                }
                break;
            }

            case InteractionManager.EventType.SourceUpdated:
            {
                InteractionManager.SourceEventHandler sourceUpdated = InteractionManager.SourceUpdated;
                if (sourceUpdated != null)
                {
                    sourceUpdated(state);
                }
                break;
            }

            case InteractionManager.EventType.SourcePressed:
            {
                InteractionManager.SourceEventHandler sourcePressed = InteractionManager.SourcePressed;
                if (sourcePressed != null)
                {
                    sourcePressed(state);
                }
                break;
            }

            case InteractionManager.EventType.SourceReleased:
            {
                InteractionManager.SourceEventHandler sourceReleased = InteractionManager.SourceReleased;
                if (sourceReleased != null)
                {
                    sourceReleased(state);
                }
                break;
            }

            default:
                throw new ArgumentException("OnSourceEvent: Invalid EventType");
            }
        }
Exemplo n.º 2
0
        private static void OnSourceEvent(InteractionManager.EventType eventType, InteractionSourceState state, InteractionSourcePressType pressType)
        {
            switch (eventType)
            {
            case InteractionManager.EventType.SourceDetected:
            {
                InteractionManager.SourceEventHandler interactionSourceDetectedLegacy = InteractionManager.InteractionSourceDetectedLegacy;
                if (interactionSourceDetectedLegacy != null)
                {
                    interactionSourceDetectedLegacy(state);
                }
                Action <InteractionSourceDetectedEventArgs> interactionSourceDetected = InteractionManager.InteractionSourceDetected;
                if (interactionSourceDetected != null)
                {
                    interactionSourceDetected(new InteractionSourceDetectedEventArgs(state));
                }
                break;
            }

            case InteractionManager.EventType.SourceLost:
            {
                InteractionManager.SourceEventHandler interactionSourceLostLegacy = InteractionManager.InteractionSourceLostLegacy;
                if (interactionSourceLostLegacy != null)
                {
                    interactionSourceLostLegacy(state);
                }
                Action <InteractionSourceLostEventArgs> interactionSourceLost = InteractionManager.InteractionSourceLost;
                if (interactionSourceLost != null)
                {
                    interactionSourceLost(new InteractionSourceLostEventArgs(state));
                }
                break;
            }

            case InteractionManager.EventType.SourceUpdated:
            {
                InteractionManager.SourceEventHandler interactionSourceUpdatedLegacy = InteractionManager.InteractionSourceUpdatedLegacy;
                if (interactionSourceUpdatedLegacy != null)
                {
                    interactionSourceUpdatedLegacy(state);
                }
                Action <InteractionSourceUpdatedEventArgs> interactionSourceUpdated = InteractionManager.InteractionSourceUpdated;
                if (interactionSourceUpdated != null)
                {
                    interactionSourceUpdated(new InteractionSourceUpdatedEventArgs(state));
                }
                break;
            }

            case InteractionManager.EventType.SourcePressed:
            {
                InteractionManager.SourceEventHandler interactionSourcePressedLegacy = InteractionManager.InteractionSourcePressedLegacy;
                if (interactionSourcePressedLegacy != null)
                {
                    interactionSourcePressedLegacy(state);
                }
                Action <InteractionSourcePressedEventArgs> interactionSourcePressed = InteractionManager.InteractionSourcePressed;
                if (interactionSourcePressed != null)
                {
                    interactionSourcePressed(new InteractionSourcePressedEventArgs(state, pressType));
                }
                break;
            }

            case InteractionManager.EventType.SourceReleased:
            {
                InteractionManager.SourceEventHandler interactionSourceReleasedLegacy = InteractionManager.InteractionSourceReleasedLegacy;
                if (interactionSourceReleasedLegacy != null)
                {
                    interactionSourceReleasedLegacy(state);
                }
                Action <InteractionSourceReleasedEventArgs> interactionSourceReleased = InteractionManager.InteractionSourceReleased;
                if (interactionSourceReleased != null)
                {
                    interactionSourceReleased(new InteractionSourceReleasedEventArgs(state, pressType));
                }
                break;
            }

            default:
                throw new ArgumentException("OnSourceEvent: Invalid EventType");
            }
        }