private void closeAnalysis(object sender, RoutedEventArgs e) { int currentTabIndex = analysisTabControl.SelectedIndex; if (currentTabIndex != -1) { _tabContainer.CommunicationList[currentTabIndex].SendGUIMessage(new Abort()); } }