Exemple #1
0
        void CarElementMouseEnter(object sender, MouseEventArgs e)
        {
            CarElement         = (controlCarInfo)sender;
            CarElementPosition = CarElement.GetPosition(layoutCars);

            var carDetailsElement = new controlCarInfo(true, true, true);

            carDetailsElement.DataContext   = CarElement.DataContext;
            carDetailsElement.FlowDirection = CarElement.FlowDirection;
            carDetailsElement.FontFamily    = CarElement.FontFamily;
            carDetailsElement.Owner         = CarElement;

            CarDetailsPopup                 = new TransparentPopup();
            CarDetailsPopup.Child           = carDetailsElement;
            CarDetailsPopup.PlacementTarget = layoutCars;
            CarDetailsPopup.IsOpen          = true;
            carDetailsElement.UpdateLayout();
            if (CarDetailsPopup == null)
            {
                return;
            }
            Point carDetailsPopupPosition =
                PointHelper.Subtract(PointHelper.Add(CarElementPosition, CarElement.ContentOffset), carDetailsElement.ContentOffset);

            CarDetailsPopup.HorizontalOffset = carDetailsPopupPosition.X;
            CarDetailsPopup.VerticalOffset   = carDetailsPopupPosition.Y;
            CarDetailsPopup.MakeVisible();

            //Storyboard.SetTarget(CarDetailsShowingAnimation, carDetailsElement);
            //CarDetailsShowingAnimation.Begin();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Wheel  wheel  = new Wheel();
            Body   body   = new Body();
            Engine engine = new Engine();

            CarElement[] elements = new CarElement[3] {
                wheel, body, engine
            };
            Car car = new Car(elements);
            CarElementPrintVisitor visitor = new CarElementPrintVisitor();

            car.accept(visitor);
        }
Exemple #3
0
        void OnLayoutUpdated(object sender, EventArgs e)
        {
            if (CarDetailsPopup == null)
            {
                return;
            }
            Point newPosition = CarElement.GetPosition(layoutCars);
            Point offset      = PointHelper.Subtract(newPosition, CarElementPosition);

            if (offset.X == 0 && offset.Y == 0)
            {
                return;
            }
            CarElementPosition = newPosition;
            CarDetailsPopup.HorizontalOffset += offset.X;
            CarDetailsPopup.VerticalOffset   += offset.Y;
        }
Exemple #4
0
        public void Start()
        {
            var car   = new CarElement();
            var motor = new MotorCycleElement();

            ObjectStructure o = new ObjectStructure();

            o.Attach(car);
            o.Attach(motor);

            // Create visitor objects

            ServiceVisitor vService = new ServiceVisitor();
            RefuelVisitor  vRefuel  = new RefuelVisitor();

            // Structure accepting visitors

            o.Accept(vService);
            o.Accept(vRefuel);

            car.GoHome();
            motor.GoHome();
        }
Exemple #5
0
 public Engine[] engines;      //assigned from inspector
 //and more car components like these two...
 //arrays because there will be multiple to chose from each type
 public void Setup(CarElement component)
 {
     component.Equip();
     DoSomethingWithCommonVariables(component.price, component.prefab);
 }
Exemple #6
0
 public abstract void OperateCar(CarElement concreteElementA);