using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace puls200.AIS2Excel { public partial class Main : Form { public Main() { InitializeComponent(); } protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Default: last 12 hours this.dateTimePickerTo.Value = DateTime.Now; this.dateTimePickerFrom.Value = DateTime.Now.AddHours(-12); } private void ButtonFileBrowse_Click(object sender, EventArgs e) { using (SaveFileDialog ofd = new SaveFileDialog()) { ofd.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*"; if(ofd.ShowDialog() == DialogResult.OK) { this.textBoxExportFile.Text = ofd.FileName; } } } private void ButtonExport_Click(object sender, EventArgs e) { try { AISVessel.Export(this.dateTimePickerFrom.Value, this.dateTimePickerTo.Value, (double) this.numericUpDownULLatitude.Value, (double) this.numericUpDownULLongitude.Value, (double)this.numericUpDownLRLatitude.Value, (double) this.numericUpDownLRLongitude.Value, this.textBoxExportFile.Text); MessageBox.Show("data exported"); } catch(Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } }