예제 #1
0
        public ArrowController(int rows, int columns)
        {
            Arrow = new ArrowContext(new ConcreteStateForward());
            Arrow.X = 0;
            Arrow.Y = 0;

            _rows = rows;
            _columns = columns;

            _acea = new ArrowChangedEventArgs();

            // TODO: Create a 'Common' configuration class for this.
            ConfigurationManager.RefreshSection("appSettings");
            int speed = Int32.Parse(ConfigurationManager.AppSettings["animationSpeed"]) * 1000;

            _timer = new Timer(speed);
            _timer.Elapsed += _timer_Elapsed;
        }
예제 #2
0
파일: UIController.cs 프로젝트: riyaan/ADS4
 protected virtual void OnArrowChanged(ArrowChangedEventArgs e)
 {
     if (ArrowChanged != null)
         ArrowChanged(this, e);
 }
예제 #3
0
파일: UIController.cs 프로젝트: riyaan/ADS4
 void _arrowController_ArrowChanged(object sender, ArrowChangedEventArgs e)
 {
     // Pass the event on to the calling party
     OnArrowChanged(e);
 }
예제 #4
0
파일: Navigator.cs 프로젝트: riyaan/ADS4
        void _uiController_ArrowChanged(object sender, ArrowChangedEventArgs e)
        {
            if (_isRunning)
            {
                Diagnostics.Logger.Instance.Log("Handling the arrow changed event.");
                ArrowContext ac = e.Arrow;
                Diagnostics.Logger.Instance.Log("Current State: " + ac.CurrentState.ToString());
                Diagnostics.Logger.Instance.Log(String.Format("X:{0} Y:{1}", ac.X, ac.Y));

                string direction = String.Empty;
                if (ac.CurrentState.ToString().ToUpper().Contains("RIGHT"))
                    direction = "R";
                else if (ac.CurrentState.ToString().ToUpper().Contains("LEFT"))
                    direction = "L";
                else if (ac.CurrentState.ToString().ToUpper().Contains("FORWARD"))
                    direction = "F";

                UpdateGrid(ac.X, ac.Y, direction);
            }
        }