private void TryEnableAvl() { if (enableButt.InvokeRequired) { // this is worker thread UIDel del = new UIDel(this.TryEnableAvl); enableButt.Invoke(del, new object[] { }); } else { if (this.enabled) { if (this.gpsManager.HasGPS && this.gpsManager.HasFix) { EnableSend(); } else { this.enableButt.Enabled = false; this.statusPictureBox.Image = Properties.Resources.Orange_Ball; if (!this.gpsManager.HasGPS) { this.statusLabel.Text = "Waiting for GPS"; } DisableSend(); } } else { this.enableButt.Enabled = false; DisableSend(); DisableSendUI(); } } }
/// <summary> /// Disables the send UI. /// </summary> private void DisableSendUI() { if (this.enableButt.InvokeRequired) { UIDel del = new UIDel(this.DisableSendUI); enableButt.Invoke(del, new object[] { }); } else { this.enableButt.Enabled = true; this.statusPictureBox.Image = Properties.Resources.Red_Ball; gpsLabel.Text = this.gpsManager.GPSName; statusLabel.Text = "Reporting Disabled"; } }
/// <summary> /// Enables the send. /// </summary> private void EnableSend() { if (enableButt.InvokeRequired) { // this is worker thread UIDel del = new UIDel(this.EnableSend); enableButt.Invoke(del, new object[] { }); } else { // this is UI thread this.enableButt.Enabled = false; statusLabel.Text = "Reporting Enabled"; this.sender.Start(); this.statusPictureBox.Image = Properties.Resources.Green_Ball; gpsLabel.Text = this.gpsManager.GPSName; log.Info("Sending Enabled"); } }