예제 #1
0
        private void InitFSM()
        {
            messages = new ObservableCollection <string>();
            lstMessages.DataContext = messages;
            lstMessages.ItemsSource = messages;

            string file = Path.GetDirectoryName(new Uri(Assembly.GetAssembly(typeof(MainWindow)).CodeBase).LocalPath);

            Configuration cfg = Configuration.Instance;

            cfg.GesturesFolder = file + @"\..\..\Gestures\";
            cfg.InitializeFrom(file + @"\..\..\gesturesConfig.xml");

            context = cfg.CreateContext();
            fsm     = new GesturesFSM <TrackingContext>(context);
            fsm.InitializeFromConfiguration(cfg);

            // bind to recording state events
            recordingState = (StateRecording)cfg.States[FSMStateId.Recording];
            recordingState.RecordingStarted  += new GestureRecordingHandler(recordingState_RecordingStarted);
            recordingState.RecordingStarting += new GestureRecordingHandler(recordingState_RecordingStarting);
            recordingState.RecordingStopped  += new GestureRecordingHandler(recordingState_RecordingStopped);
            recordingState.FrameRecorded     += new GestureRecordingHandler(recordingState_FrameRecorded);

            // bind to fsm events
            fsm.GestureRecognized += new GestureRecognizedEventHandler(fsm_GestureRecognized);
            fsm.StateChanged      += new StateChangedEventHandler(fsm_StateChanged);
        }
예제 #2
0
        public void TestInitializeFromEmptyConfiguration()
        {
            // arrange
            var fsm    = new GesturesFSM <TrackingContext>(new Mock <TrackingContext>().Object);
            var config = new Mock <IConfiguration <TrackingContext> >();

            config.Setup(x => x.StateTransitions).Returns(new Dictionary <KeyValuePair <FSMStateId, FSMEventId>, FSMStateId>());

            // act
            this.DisableUIAsserts();
            fsm.InitializeFromConfiguration(config.Object);
        }