// Loads data from the database and binds it to the datagrid private void LoadData() { try { Cursor = Cursors.WaitCursor; tspbLoad.Visible = true; Enabled = false; neoFlyData.LoadStarted += NeoFlyData_LoadStarted; neoFlyData.LoadProgress += NeoFlyData_LoadProgress; neoFlyData.Load(); dgvLog.DataSource = neoFlyData.TableLog; dgvLog.Columns["Id"].Visible = false; foreach (DataGridViewColumn col in dgvLog.Columns) { col.ReadOnly = col.Name != "Export"; } dgvLog.AutoResizeColumns(); Enabled = true; } finally { tspbLoad.Visible = false; Cursor = Cursors.Default; } }
static void Main() { if (CommandLine.Arguments.Count == 0) { SearchExternalViewers(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new MainForm()); } else { try { NeoFlyData neoFlyData = new NeoFlyData(); neoFlyData.Load(); neoFlyData.ExportToGPXFile(CommandLine.Arguments); } catch (Exception ex) { MessageBox.Show(ex.Message, "NeoFlyExport error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }