void HandleListChanged(object sender, PersonEventArgs e) { Application.Invoke(delegate { listStore.Clear(); IPerson[] pl = list.List; foreach (IPerson p in pl) { string s = ""; switch (p.State) { case PersonState.Arrived: s = "Прибыл"; break; case PersonState.Traveling: s = "Едет"; break; case PersonState.Waiting: s = "Ждет"; break; } listStore.AppendValues(p.SourceFloor + 1, p.DestinationFloor + 1, p.Weight, s); } } ); }
public void PersonEnteredHandler(object sender, PersonEventArgs e) { lock (personHandlerLock) { numberOfServedPeople++; totalWeightMoved += e.Person.Weight; OnStatisticsChanged(EventArgs.Empty); } }