private void StopButton_Click(object sender, RoutedEventArgs e) { var lastEvent = EventCollection.LastOrDefault(); if (lastEvent != null && lastEvent.Type != EventType.Stop) { AddEvent(App.StopEventConstructorServiceId); } }