private void NewEQJob(EQJob eqJob) { ClearEQJobEvents(latestEQJob); latestEQJob = eqJob; latestEQJob.StartReading += LatestEQJob_StartReading; latestEQJob.EoFBattle += LatestEQJob_EoFBattle; }
private void ClearEQJobEvents(EQJob eqJob) { if (eqJob == null) { return; } latestEQJob.StartReading -= LatestEQJob_StartReading; latestEQJob.EoFBattle -= LatestEQJob_EoFBattle; }
private void CreateNewBattle(object fileName) { _eqJob = new EQJob(fileName as string); BindingOperations.EnableCollectionSynchronization(_eqJob.Battle.Skirmishes, _lock); Messenger.Instance.Publish("NewEQJob", _eqJob); Messenger.Instance.Publish("NewBattle", _eqJob.Battle); // NOTE: probably more robustness needed here to really make this async and handle errors etc... Task.Run(() => _eqJob.ReadFileIntoBattleAsync()); }
public BattleFooterViewModel() { // Update the Footer view even small interval to refresh properties from the EQJob (elapsed time, number of skirmishes) // Elapsed property doesn't have a event or INotifyPropertyChanged going on for it (doesn't really make sense) // So, just poll (instead of push) the property update StartDispatchTimer(250, () => { OnPropertyChanged(nameof(Elapsed)); OnPropertyChanged(nameof(SkirmishCount)); }); Messenger.Instance.Subscribe("NewEQJob", x => { eqJob = x as EQJob; OnPropertyChanged(nameof(FileName)); }); Messenger.Instance.Subscribe("NewBattle", x => Battle = x as Battle); }