private void GPSA_BurstReceived(NmeaBurst b) { if (checkMeta && b.IsValid) { if (b.CalcRealZone() != currentZone) { MessageBox.Show("The current UTM zone does not match the set metadata zone.", "Zone mismatch", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } checkMeta = false; } if (logging) { logged++; NmeaData.Add(b); } recieved++; this.GuiInvoke(() => { lblRecieved.Text = recieved.ToString(); lblLogged.Text = logged.ToString(); }); }
private void GPSA_BurstReceived(NmeaBurst data) { if (calcBursts) { data.CalcRealZone(); if(data.IsValid) bursts.Add(data); if (bursts.Count > 4) { double mag = 0; int zone = 0; foreach (NmeaBurst b in bursts) { mag += b._magVar; zone = b._utm_zone; } mag /= bursts.Count; this.GuiInvoke(() => { Current.magDec = mag; Current.Zone = zone; txtZone.Text = zone.ToString(); txtMagDec.Text = mag.ToString(); TtUtils.HideWaitCursor(); }); Changed(); Values.GPSA.BurstReceived -= GPSA_BurstReceived; DelInit = false; TtUtils.HideWaitCursor(); if (!Values.Settings.DeviceOptions.KeepGpsOn) { Values.GPSA.CloseGps(); } calcBursts = false; } } }