private void OnSelectMenuItem(Runner obj) { SelectedRunners.Add(obj); Runners.Remove(obj); SelectedRunnersCount++; }
/// <summary> /// Removes <see cref="SelectedRunner"/> from <see cref="Runners"/>. /// </summary> public void RemoveRunner() { if (!_canRemoveRunner || SelectedRunner == null || !Runners.Contains(SelectedRunner)) { return; } Runners.Remove(SelectedRunner); SelectedRunner.PropertyChanged -= Runner_PropertyChanged; ReCalculateRaceMargin(); _canAddRunner = Runners.Count < _maxRunnerCount; OnPropertyChanged(nameof(CanAddRunner)); }
private void OnRunnerDied(BaseRunner runner) { Runners.Remove(runner); KillAllRunners -= runner.Die; if (Runners.Count < 1) { GetTree().Paused = true; Reset(); GameOverEvent?.Invoke(); } }
private async Task <List <Runner> > GetRunnersbyEvent() { var returned = await RunnerServices.GetRunnersByEventID(Event.Id); SelectedRunners = new ObservableCollection <Runner>(returned); SelectedRunnersCount = SelectedRunners.Count; foreach (var runner in SelectedRunners) { Runners.Remove(Runners.SingleOrDefault(i => i.Id == runner.Id)); } IsBusy = false; return(returned); }
private void RemoveRunner(RunnerViewModel runner) { _Dispatcher.Invoke(() => Runners.Remove(runner)); _Dispatcher.Invoke(() => ClearStatuses(runner.ConnectionId)); }