예제 #1
0
        public void ProcessEvents(int maxTimeMilliseconds)
        {
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();
            while (EdkDll.EE_EngineGetNextEvent(this.hEvent) == 0)
            {
                if ((maxTimeMilliseconds != 0) && (stopwatch.ElapsedMilliseconds >= maxTimeMilliseconds))
                {
                    return;
                }
                uint pUserIdOut = 0;
                EdkDll.EE_EmoEngineEventGetUserId(this.hEvent, out pUserIdOut);
                EmoEngineEventArgs e = new EmoEngineEventArgs(pUserIdOut);
                switch (EdkDll.EE_EmoEngineEventGetType(this.hEvent))
                {
                case EdkDll.EE_Event_t.EE_CognitivEvent:
                {
                    switch (EdkDll.EE_CognitivEventGetType(this.hEvent))
                    {
                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingStarted:
                    {
                        this.OnCognitivTrainingStarted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingSucceeded:
                    {
                        this.OnCognitivTrainingSucceeded(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingFailed:
                    {
                        this.OnCognitivTrainingFailed(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingCompleted:
                    {
                        this.OnCognitivTrainingCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingDataErased:
                    {
                        this.OnCognitivTrainingDataErased(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingRejected:
                    {
                        this.OnCognitivTrainingRejected(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivTrainingReset:
                    {
                        this.OnCognitivTrainingReset(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivAutoSamplingNeutralCompleted:
                    {
                        this.OnCognitivAutoSamplingNeutralCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_CognitivEvent_t.EE_CognitivSignatureUpdated:
                    {
                        this.OnCognitivSignatureUpdated(e);
                        continue;
                    }
                    }
                    continue;
                }

                case EdkDll.EE_Event_t.EE_ExpressivEvent:
                {
                    switch (EdkDll.EE_ExpressivEventGetType(this.hEvent))
                    {
                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingStarted:
                    {
                        this.OnExpressivTrainingStarted(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingSucceeded:
                    {
                        this.OnExpressivTrainingSucceeded(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingFailed:
                    {
                        this.OnExpressivTrainingFailed(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingCompleted:
                    {
                        this.OnExpressivTrainingCompleted(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingDataErased:
                    {
                        this.OnExpressivTrainingDataErased(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingRejected:
                    {
                        this.OnExpressivTrainingRejected(e);
                        continue;
                    }

                    case EdkDll.EE_ExpressivEvent_t.EE_ExpressivTrainingReset:
                    {
                        this.OnExpressivTrainingReset(e);
                        continue;
                    }
                    }
                    continue;
                }

                case EdkDll.EE_Event_t.EE_InternalStateChanged:
                    break;

                case EdkDll.EE_Event_t.EE_UserAdded:
                {
                    this.OnUserAdded(e);
                    continue;
                }

                case EdkDll.EE_Event_t.EE_UserRemoved:
                {
                    this.OnUserRemoved(e);
                    continue;
                }

                case EdkDll.EE_Event_t.EE_EmoStateUpdated:
                {
                    EmoState emoState = new EmoState();
                    errorHandler(EdkDll.EE_EmoEngineEventGetEmoState(this.hEvent, emoState.GetHandle()));
                    EmoStateUpdatedEventArgs args2 = new EmoStateUpdatedEventArgs(pUserIdOut, emoState);
                    this.OnEmoStateUpdated(args2);
                    if (!emoState.EmoEngineEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnEmoEngineEmoStateUpdated(args2);
                    }
                    if (!emoState.AffectivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnAffectivEmoStateUpdated(args2);
                    }
                    if (!emoState.CognitivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnCognitivEmoStateUpdated(args2);
                    }
                    if (!emoState.ExpressivEqual(this.lastEmoState[pUserIdOut]))
                    {
                        args2 = new EmoStateUpdatedEventArgs(pUserIdOut, new EmoState(emoState));
                        this.OnExpressivEmoStateUpdated(args2);
                    }
                    this.lastEmoState[pUserIdOut] = (EmoState)emoState.Clone();
                    continue;
                }

                default:
                {
                    continue;
                }
                }
                this.OnInternalStateChanged(e);
            }
        }