예제 #1
0
        private void SelectState(int menuItem)
        {
            State state = null;

            if (_arrayState[menuItem] == null)
            {
                switch (menuItem)
                {
                case 0:
                    state = new LedButtonState(MainHandle);
                    break;

                case 1:
                    state = new JoystickDemoState(MainHandle);
                    break;

                case 2:
                    state = new ExampleState(MainHandle);
                    break;

                case 3:
                    state = new SDCardState(MainHandle);
                    break;

                case 4:
                    state = new TunesDemoState(MainHandle);
                    break;

                case 5:
                    state = new LedStripDemoState(MainHandle);
                    break;

                case 6:
                    state = new ScreenDemoState(MainHandle);
                    break;

                case 8:
                    state = new InfoState(MainHandle);
                    break;
                }
                _arrayState[menuItem] = state;
            }
            else
            {
                state = _arrayState[menuItem];
            }

            MainHandle.Context.CurrentState = state;
        }
예제 #2
0
        private void SelectState(int menuItem)
        {
            State state = null;
             if (_arrayState[menuItem] == null)
             {
                 switch (menuItem)
                 {
                     case 0:
                         state = new LedButtonState(MainHandle);
                         break;
                     case 1:
                         state = new JoystickDemoState(MainHandle);
                         break;
                     case 2:
                         state = new ExampleState(MainHandle);
                         break;
                     case 3:
                         state = new SDCardState(MainHandle);
                         break;
                     case 4:
                         state = new TunesDemoState(MainHandle);
                         break;
                     case 5:
                         state = new LedStripDemoState(MainHandle);
                         break;
                     case 6:
                         state = new ScreenDemoState(MainHandle);
                         break;
                     case 8:
                         state = new InfoState(MainHandle);
                         break;
                 }
                 _arrayState[menuItem] = state;
             }
             else
             {
                 state = _arrayState[menuItem];
             }

             MainHandle.Context.CurrentState = state;
        }