예제 #1
0
        public void UpdateDrivers()
        {
            this.Drivers.Clear();
            foreach (var id in this.Penalty.DriverIds)
            {
                var driver = Simulator.Instance.Drivers.FirstOrDefault(d => d.Driver.Id == id);
                if (driver != null)
                {
                    this.Drivers.Add(driver);
                }
            }

            if (this.Penalty.Result != null)
            {
                this.ResultDriver =
                    Simulator.Instance.Drivers.FirstOrDefault(d => d.Driver.Id == this.Penalty.Result.DriverId);
                if (this.ResultDriver != null)
                {
                    this.Penalty.Result.CarNumber = this.ResultDriver.Driver.CarNumber;
                }
                else
                {
                    this.Penalty.Result.CarNumber = "";
                    this.Penalty.Result.DriverId = -1;
                }
            }

            this.OnPropertyChanged("DriversDisplay");
        }
        public DecidePenaltyWindow(PenaltyContainer penalty, DriverContainer driver)
        {
            InitializeComponent();

            _model = new DecidePenaltyViewModel(penalty, driver);
            this.DataContext = _model;
        }
 private void btnSelect_Click(object sender, RoutedEventArgs e)
 {
     var driver = lst.SelectedItem as DriverContainer;
     if (driver != null)
     {
         _selectedDriver = driver;
         this.DialogResult = true;
         this.Close();
     }
 }
        public DriverOfftrackLimit AddLimit(DriverContainer driver, int count)
        {
            if (this.DriverLimits.Any(
                d => d.Driver.Driver.Id == driver.Driver.Id
                     && d.OfftrackCount == count))
            {
                // Already added
                return null;
            }

            var limit = new DriverOfftrackLimit(driver, count);
            this.DriverLimits.Add(limit);

            return limit;
        }
        public DecidePenaltyViewModel(PenaltyContainer penalty, DriverContainer driver)
        {
            _penalty = penalty;
            _driver = driver;

            _possibleResults = PenaltyResult.AllResults();

            _resetResult = penalty.Penalty.Result;

            if (string.IsNullOrWhiteSpace(penalty.Penalty.Result.PenaltyMessage))
            {
                penalty.Penalty.Result.PenaltyMessage = penalty.Penalty.Reason;
            }

            this.Penalty.Penalty.Result.DriverId = driver.Driver.Id;
            this.Penalty.UpdateDrivers();
        }
            public CameraSync(UserContainer admin, DriverContainer driver, CameraDetails camera)
            {
                this.Admin = admin;
                this.Driver = driver;
                this.Camera = camera;

                if (camera.ReplayChangeType == CameraDetails.ReplayChangeTypes.SetReplayFrame)
                {
                    var seconds = Simulator.Instance.Telemetry.SessionTime.Value - (camera.Frame/60f);
                    var time = TimeSpan.FromSeconds(seconds);
                    this.SessionTime = string.Format("{0:0}:{1:00}:{2:00}", time.Hours, time.Minutes, time.Seconds);
                }
                else if (camera.ReplayChangeType == CameraDetails.ReplayChangeTypes.SetSessionTime)
                {
                    var time = TimeSpan.FromSeconds(camera.SessionTime);
                    this.SessionTime = string.Format("{0:0}:{1:00}:{2:00}", time.Hours, time.Minutes, time.Seconds);
                }
            }
예제 #7
0
 public DriverOfftrackLimit(DriverContainer driver, int count)
 {
     this.Driver        = driver;
     this.OfftrackCount = count;
     this.Time          = DateTime.Now;
 }
예제 #8
0
        public void SwitchToDriver(DriverContainer driver)
        {
            if (driver == null) return;

            // Switch client camera to driver
            var camera = CameraDetails.ChangeFocus(driver.Driver.CarNumberRaw);
            CameraControl.ChangeCamera(camera);
        }
 public DriverOfftrackLimit(DriverContainer driver, int count)
 {
     this.Driver = driver;
     this.OfftrackCount = count;
     this.Time = DateTime.Now;
 }
 public UserCameraCollection(DriverContainer driver)
 {
     _driver = driver;
 }
예제 #11
0
        public void AddDriver(DriverContainer driver, PenaltyContainer parentPenalty = null)
        {
            Penalty penalty;
            if (parentPenalty == null)
            {
                penalty = Penalty.Create();
                penalty.Camera = CameraControl.GetCurrentCameraSessionTime();
                penalty.Lap = driver.Driver.Live.Lap.ToString();
                SyncManager.Instance.State.Penalties.Add(penalty);

                // Create incident event
                var @event = new ReplayEvent();
                @event.Type = ReplayEvent.EventTypes.Incident;
                @event.AdminId = SyncManager.Instance.UserId;
                @event.Camera = penalty.Camera;
                //_mainModel.ReplayBarModel.AddEvent(@event);
            }
            else
            {
                penalty = parentPenalty.Penalty;
            }

            penalty.StartInvestigation(driver.Driver.Id, SyncManager.Instance.User);

            if (parentPenalty == null)
            {
                SyncManager.Instance.SendStateUpdate(SyncCommandHelper.AddPenalty(penalty));
                EditPenalty(penalty);
            }
            else
            {
                SyncManager.Instance.SendPenaltyUpdate(penalty);
            }

            this.UpdatePenalties();
        }
        private DriverOfftrackLine GetLine(DriverContainer driver)
        {
            DriverOfftrackLine line;

            if (!_lines.ContainsKey(driver.Driver.Id))
            {
                line = new DriverOfftrackLine();
                line.Driver = driver;
                line.Line = _chart.CreateXY();
                line.Line.IsHitTest = true;
                line.Line.LineThickness = 2;
                line.Line.LineColor = GetColor();
                //line.Line.LegendColor = line.Line.LineColor;
                //line.Line.Label = driver.Driver.ShortName;
                //line.Line.LegendLabel = new ColorLabel(driver.Driver.ShortName, Colors.White);
                
                _lines.Add(driver.Driver.Id, line);
            }
            else
            {
                line = _lines[driver.Driver.Id];
            }

            this.SetOfftrackPoints(line);

            line.Taken = true;
            return line;
        }
예제 #13
0
 public DroppedDriverEventArgs(DriverContainer driver, PenaltyContainer penalty)
 {
     this.Driver = driver;
     this.Penalty = penalty;
 }
예제 #14
0
 protected virtual void OnDroppedDriver(DriverContainer driver, PenaltyContainer penalty)
 {
     if (DroppedDriver != null)
     {
         DroppedDriver(this, new DroppedDriverEventArgs(driver, penalty));
     }
 }
 private void btnCancel_Click(object sender, RoutedEventArgs e)
 {
     _selectedDriver = null;
     this.DialogResult = false;
     this.Close();
 }