private void LoadVehiclesToStackPanel()
        {
            SpVehicles.Children.Clear();

            List <Vehicle> vehicles = vehiclesSqlRepository.ReadAll();

            foreach (Vehicle vehicle in vehicles)
            {
                VehiclePanel vehiclePanel = new VehiclePanel(vehicle);

                SpVehicles.Children.Add(vehiclePanel);
            }
        }
예제 #2
0
        private void UpdateInGameMouseClicks()
        {
            //This is for single selection clicks.  Vehicle Selections are done through world Vehicles
            //For vehicle popups we may have to modify something slighty
            if (WorldController.world.mouseDragUpResult == MouseDragUpResult.CLICKEDINTERSECTION)
            {
                IntersectionPanel intersectionPanel = (IntersectionPanel)GetNonPinnedContainer("IntersectionPanel");
                Intersection      intersection      = WorldController.world.tileGrid[WorldController.mouseTileHover.X, WorldController.mouseTileHover.Y].GetIntersection();
                if (intersection != null)
                {
                    if (intersectionPanel == null)
                    {
                        debugx += 50;
                        AddContainer(new IntersectionPanel(new Rectangle(debugx, 500, 500, 600), DockType.BOTTOMRIGHT, intersection));
                    }
                    else
                    {
                        MoveContainerToTop(intersectionPanel);
                        intersectionPanel.ChangeIntersection(intersection);
                    }
                }
            }
            else if (WorldController.world.mouseDragUpResult == MouseDragUpResult.CLICKEDONEVEHICLE)
            {
                VehiclePanel vehiclePanel = (VehiclePanel)GetNonPinnedContainer("VehiclePanel");
                Vehicle      vehicle      = WorldController.world.worldVehicles.GetFirstSelectedVehicle();

                if (vehicle != null)
                {
                    if (vehiclePanel == null)
                    {
                        debugx += 50;
                        AddContainer(new VehiclePanel(new Rectangle(debugx, 500, 500, 600), DockType.BOTTOMRIGHT, vehicle));
                    }
                    else
                    {
                        MoveContainerToTop(vehiclePanel);
                        vehiclePanel.ChangeVehicle(vehicle);
                    }
                }
            }
        }
 public VehiclePanelStateChangedArgs(Vehicle vehicle, VehiclePanel panel, VehiclePanelState state)
 {
     this.Vehicle = vehicle;
     this.Panel   = panel;
     this.State   = state;
 }