ErgCompetePM/Program.cs
/// <summary>
/// Refreshes the display with the latest poll data
/// </summary>
/// <param name="args">The poll data</param>
Refreshes the display with the latest poll data
Refreshes the display with the latest poll data
private void RefreshScreen(object? _, EventArgs args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }
            if (args is not PollEventArgs pollArgs)
            {
                throw new Exception("Unexpected event arguments.");
            }
            lock (_displayLock) 
            { 
                Console.Clear();
                if (pollArgs.Data == null)
                {
                    throw new Exception("Empty poll data");
                }
                Console.WriteLine("HubConnection: " + _hubConnection?.State);
                Console.WriteLine("Serial Number: " + pollArgs.SerialNumber);
                Console.WriteLine("Stroke State: " + pollArgs.Data.StrokeState);
                Console.WriteLine("Calories: " + pollArgs.Data.AccumulatedCalories);
                Console.WriteLine("Horizontal Distance: " + pollArgs.Data.HorizontalDistance);
                Console.WriteLine("Stroke Rate: " + pollArgs.Data.Cadence);
                Console.WriteLine("Drag Factor: " + pollArgs.Data.DragFactor);
            }
        }
private void RefreshScreen ( object ? _ , EventArgs args ) { if ( args == null ) { throw new ArgumentNullException ( nameof ( args ) ) ; } if ( args is not PollEventArgs pollArgs ) { throw new Exception ( " " ) ; } lock ( _displayLock ) { Console . Clear ( ) ; if ( pollArgs . Data == null ) { throw new Exception ( " " ) ; } Console . WriteLine ( " " + _hubConnection ? . State ) ; Console . WriteLine ( " " + pollArgs . SerialNumber ) ; Console . WriteLine ( " " + pollArgs . Data . StrokeState ) ; Console . WriteLine ( " " + pollArgs . Data . AccumulatedCalories ) ; Console . WriteLine ( " " + pollArgs . Data . HorizontalDistance ) ; Console . WriteLine ( " " + pollArgs . Data . Cadence ) ; Console . WriteLine ( " " + pollArgs . Data . DragFactor ) ; } }
Refreshes the display with the latest poll data
Refreshes the display with the latest poll data
_
object?
args
EventArgs
The poll data
The poll data