private void followDeviceByGPSToolStripMenuItem_Click(object sender, EventArgs e) { if (StationList.SelectedIndices.Count > 0) { Station station = this.FilterStations[StationList.SelectedIndices[0]]; if (station != null) { if (station.HasGpsLocation(MainForm.GpsLocations.ToArray())) { using (SaveFileDialog dialog = new SaveFileDialog()) { if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { File.WriteAllText(dialog.FileName, GpsLocation.ToKML(station.GetGpsLocations(MainForm.GpsLocations.ToArray()))); } } } else { MessageBox.Show("No GPS Data is known for this station"); } } } }