private void buttonStartServer_Click(object sender, EventArgs e) { if (nmeaServer == null || !nmeaServer.Started) { nmeaServer = new NMEAServer(ref boatData, Convert.ToInt32(numericUpDownPort.Value), Convert.ToInt32(numericUpDownRate.Value)); nmeaServer.Start(); buttonStartServer.Text = "Stop server"; } else { nmeaServer.Stop(); buttonStartServer.Text = "Start server"; } numericUpDownPort.Enabled = !nmeaServer.Started; numericUpDownRate.Enabled = !nmeaServer.Started; }
public void StopSelectedBoatDataRefreshTask() { if (SelectedBoatCancellationTokenSource != null) { SelectedBoatCancellationTokenSource.Cancel(); NmeaServer.Stop(); MessageHub.PublishAsync(new BoatDataServiceStatusChanged(Global.Instance, false)); } }