Beispiel #1
0
        private void importCompareLapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var openDialog = new OpenFileDialog
            {
                Filter = "F1Speed|*.f1s",
                Title = "Import Reference Lap",
                Multiselect = false
            };
            var result = openDialog.ShowDialog();

            if (result == DialogResult.OK && !string.IsNullOrEmpty(openDialog.FileName))
            {
                var fileRepo = new BinaryTelemetryLapRepository();

                var lap = fileRepo.Get(openDialog.FileName);
                if (lap != null)
                {
                    manager.SetReferenceLap(lap);
                    CircuitLabel.Text = manager.ReferenceLap.Circuit.Name;
                    LapTypeLabel.Text = manager.ReferenceLap.LapType;

                    clearReferenceLapToolStripMenuItem.Enabled = true;
                }
            }
        }
Beispiel #2
0
        private void exportFastestLapToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (manager.FastestLap == null)
            {
                MessageBox.Show("No fastest lap to export! Please set a fastest lap first :)", "Doh!",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            var saveDialog = new SaveFileDialog
            {
                Filter = "F1Speed|*.f1s",
                Title = "Export Fastest Lap",
                FileName = manager.FastestLap.CircuitName + "_" + manager.FastestLap.LapType + ".f1s"
            };
            var result = saveDialog.ShowDialog();

            if (result == DialogResult.OK && !string.IsNullOrEmpty(saveDialog.FileName))
            {
                var fileRepo = new BinaryTelemetryLapRepository();
                fileRepo.Save(manager.FastestLap, saveDialog.FileName);
            }
        }