Esempio n. 1
0
        private void createCarTiles(Panel host, List <Racer> racers)
        {
            int i = 0;

            foreach (Racer racer in racers)
            {
                i++;
                CarTile tile = CarTile.createTile(racer, true, delegate()
                {
                    addRacer(DataManager.Competition.Racers.IndexOf(racer));
                });
                tile.MouseUp += delegate
                {
                    RacerDetails.editOldRacer(HostGrid, racer, delegate()
                    {
                        updateRacerList();
                    }, delegate()
                    {
                        lastResults = null;
                        lastRaceList.Children.Clear();
                        forgetRace();
                    });
                };
                tile.Cursor = Cursors.Hand;
                tile.Margin = new Thickness(8, 8, 0, 0);
                tile.AnimateIn(i * 250);
                host.Children.Add(tile);
            }
        }
Esempio n. 2
0
        private void addRacer(int index)
        {
            if (DataManager.readyForRace)
            {
                RaceManager.MakeNextReturn result = DataManager.RaceManager.makeNext_CarLane(index);

                if (result == RaceManager.MakeNextReturn.Added)
                {
                    //listBox1.Items.Add(DataManager.Competition.Racers[index].Car.Name);

                    try
                    {
                        CarTile tile = CarTile.createTile(DataManager.Competition.Racers[index], false);
                        tile.SetValue(Grid.ColumnProperty, DataManager.RaceManager.nextOpenLane - 2);
                        tile.Margin = new Thickness(8, 8, 8, 0);
                        tile.AnimateIn();
                        RaceList.Children.Add(tile);
                    }
                    catch (Exception ex)
                    {
                        DataManager.MessageProvider.showError("Could Not Add Racer", ex.Message);
                    }
                } //error handling
                else if (result == RaceManager.MakeNextReturn.CallBackUsed)
                {
                    DataManager.MessageProvider.showMessage("Duplicate Racer", DataManager.Competition.Racers[index].Car.Name + " has allready been entered into this race");
                }
                else if (result == RaceManager.MakeNextReturn.RaceFull)
                {
                    DataManager.MessageProvider.showMessage("Race is full", "Cannot enter more than " + DataManager.RaceManager.NumberOfLanes + " racers into a race");
                }
                else if (result == RaceManager.MakeNextReturn.NotPassed)
                {
                    DataManager.MessageProvider.showMessage("Racer Has Not Passed Inspection", DataManager.Competition.Racers[index].Car.Name + " has not passed inspection, and cannot race.");
                }
            }
            else
            {
                DataManager.MessageProvider.showMessage("Not Ready To Add Racer", "The track timer does not seem to be connected. Please try to reconnect to the track timer.");
            }
        }