public AvansAstrandTest(RealBike bike, bool isMan, int age, IAvansAstrandTestConnector connector) { this.displayTimer = new Timer(1000); this.displayTimer.Elapsed += DisplayTimer_Elapsed; this.timeSpan = new TimeSpan(0, 7, 0); this.testTimer = new Timer(); this.testTimer.Elapsed += Timer_Elapsed; this.state = State.NONE; this.elapsedSeconds = 0; this.heartrates = new List <int>(); this.currentResistance = 10; this.bike = bike; this.isMan = isMan; this.age = age; this.maxHF = GetMaxHeartrate(); this.workload = 0; this.hasSteadyState = false; this.connector = connector; this.connector?.OnAstrandTestLogStateAndCountdown(this.state, this.timeSpan.ToString()); this.connector?.OnAstrandTestSetResistance(this.currentResistance); }
private async void ConnectToBike_Click(object sender, RoutedEventArgs e) { if (!String.IsNullOrEmpty(txf_BikeId.Value)) { this.bike = new RealBike(txf_BikeId.Value, this.dataManager); if (await this.bike.ConnectToBike()) { txf_BikeId.IsEnabled = false; btn_ConnectToBike.IsEnabled = false; btn_ConnectToBike.Foreground = Brushes.Gray; this.bikeIsConnected = true; } else { txf_BikeId.IsEnabled = true; btn_ConnectToBike.IsEnabled = true; btn_ConnectToBike.Foreground = Brushes.White; MessageBox.Show("Kon geen verbinding maken met de fiets!"); } } else { MessageBox.Show("FietsId veld mag niet leeg zijn!"); } }
private bool ConnectToBike() { if (!String.IsNullOrEmpty(txf_BikeId.Value)) { this.bike = new RealBike(txf_BikeId.Value, this.dataManager); this.bikeIsConnected = true; return(true); } MessageBox.Show("FietsId veld mag niet leeg zijn!"); return(false); }