// Use this for initialization
    void Start()
    {
        //vectorDiff = transform.position - ballPad.transform.position;
        ballPad = GameObject.FindObjectOfType <ControlLogic>();

        vectorDiff.y = transform.position.y;
    }
Beispiel #2
0
 public QueueWorker(ControlLogic Net)
 {
     m_Net         = Net;
     m_ActionQueue = new ConcurrentQueue <Action>();
     m_Timer       = new DispatcherTimer {
         Interval = new TimeSpan(0, 0, 0, 0, 50)
     };
     m_Timer.Tick += Timer_Tick;
 }
Beispiel #3
0
 protected UserControl(IViewModel viewModel)
     : base(viewModel)
 {
     _controlLogic       = new ControlLogic(this, viewModel);
     DataContextChanged += (sender, args) =>
     {
         if (args.NewValue != viewModel)
         {
             ((FrameworkElement)sender).DataContext = viewModel;
         }
     };
 }
        public void VehicleWestOrientedGoesForward_ButIsNotInTheLimit_ThenItCanMove()
        {
            //Arrange
            _direction    = new WestDirection();
            _vehicle      = new Vehicle(_xPoint, _yPoint, _direction);
            _controlLogic = new ControlLogic(_vehicle, _permissiveLimits, _obstaclesEmptyList);

            //Act
            _controlLogic.ExecuteCommands(_commandList);

            //Assert
            Assert.AreNotEqual(_vehicle.X_Point, _xPoint);
        }
        public void VehicleEastOrientedGoesForward_ButIsAlreadyInTheLimit_ThenCannotMove()
        {
            //Arrange
            _direction    = new EastDirection();
            _vehicle      = new Vehicle(_xPoint, _yPoint, _direction);
            _controlLogic = new ControlLogic(_vehicle, _restrictiveLimits, _obstaclesEmptyList);

            //Act
            _controlLogic.ExecuteCommands(_commandList);

            //Assert
            Assert.AreEqual(_vehicle.X_Point, _xPoint);
            Assert.AreEqual(_vehicle.Y_Point, _yPoint);
        }
        public void VehicleWestOrientedGoesForward_ButThereAreObstacles_ThenCannotMove()
        {
            //Arrange
            _direction    = new WestDirection();
            _vehicle      = new Vehicle(_xPoint, _yPoint, _direction);
            _controlLogic = new ControlLogic(_vehicle, _permissiveLimits, _obstaclesWithItems);

            //Act
            _controlLogic.ExecuteCommands(_commandList);

            //Assert
            Assert.AreEqual(_vehicle.X_Point, _xPoint);
            Assert.AreEqual(_vehicle.Y_Point, _yPoint);
        }
Beispiel #7
0
        private static void OnCommandStadeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (_isIn)
            {
                return;
            }

            var root = ControlLogic.FindRoot(d);

            if (root == null)
            {
                return;
            }

            var name = GetCommand(d);

            BindInternal(name, name, root, d);
        }
Beispiel #8
0
        protected Window(IViewModel viewModel)
            : base(viewModel, DataWindowMode.Custom)
        {
            _viewModel            = viewModel;
            SizeToContent         = SizeToContent.Manual;
            ShowInTaskbar         = true;
            ResizeMode            = ResizeMode.CanResize;
            WindowStartupLocation = WindowStartupLocation.CenterScreen;

            _controlLogic       = new ControlLogic(this, viewModel);
            DataContextChanged += (sender, args) =>
            {
                if (args.NewValue != _viewModel)
                {
                    ((FrameworkElement)sender).DataContext = _viewModel;
                }
            };
        }
Beispiel #9
0
        private static void OnEventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            if (DesignerProperties.GetIsInDesignMode(d))
            {
                return;
            }

            var root = ControlLogic.FindRoot(d);

            if (root == null)
            {
                if (d is FrameworkElement element)
                {
                    ControlLogic.MakeLazy(element, e.NewValue as string, e.OldValue as string, BindInternal);
                }
                return;
            }

            BindInternal(e.OldValue as string, e.NewValue as string, root, d);
        }
Beispiel #10
0
        private static void SetLinker(DependencyObject obj, string?oldName, string?newName, Func <LinkerBase> factory)
        {
            if (string.IsNullOrWhiteSpace(newName))
            {
                return;
            }

            Argument.NotNull(obj, nameof(obj));
            Argument.NotNull(factory, nameof(factory));
            if (DesignerProperties.GetIsInDesignMode(obj))
            {
                return;
            }

            var root = ControlLogic.FindRoot(obj);

            if (root == null)
            {
                return;
            }

            if (oldName != null)
            {
                root.CleanUp(ControlHelperPrefix + oldName);
            }

            if (newName == null)
            {
                return;
            }

            var linker = factory();

            linker.Name = newName;
            root.Register(ControlHelperPrefix + newName, linker, obj);
        }
Beispiel #11
0
 public RunTemplateManager(ControlLogic managedControl)
 {
     _managedControl      = managedControl;
     _currentTemplatePath = ReadCurrentTemplatePath();
 }