public void DisconnectWarThunder() { lock (lockWarThunder) { if (currentAircraft != null) { try { Utils.SetProperty<Label, String>(labelCurrentAircraft, "Text", DISABLEDOPTION); currentAircraft.StopPoll(); currentAircraft = null; } catch { Debug.Print("DisconnectWarThunder error"); } } } }
public void ConnectWarThunder() { lock (lockWarThunder) { if (!_settings.warThunderTrackAircraft) { Utils.SetProperty<Label, String>(labelCurrentAircraft, "Text", DISABLEDOPTION); return; } else { if (currentAircraft == null) { currentAircraft = new WTAircraft(); currentAircraft.OnError += new EventHandler<EventArgsString>(currentAircraft_OnError); currentAircraft.AircraftChange += new EventHandler<EventArgsString>(wtCurrentAircraft_AircraftChange); currentAircraft.StartPoll(); } Utils.SetProperty<Label, String>(labelCurrentAircraft, "Text", WAITSPAWN); } } }