public static void Sample() { var iracing = new iRacingConnection(); var ieventRacing = new iRacingEvents(); ieventRacing.Connected += ieventRacing_Connected; ieventRacing.Disconnected += ieventRacing_Disconnected; ieventRacing.StartListening(); iracing.Connected += iracing_Connected; iracing.Disconnected += iracing_Disconnected; try { var i = 0; foreach (var d in iracing.GetDataFeed()) { if (i++ % 600 == 0) Trace.WriteLine(string.Format("Data Stream IsConnected = {0}", d.IsConnected)); } } finally { ieventRacing.StopListening(); } }
public static void Sample() { var ieventRacing = new iRacingEvents(1.Seconds()); ieventRacing.Connected += ieventRacing_Connected; ieventRacing.Disconnected += ieventRacing_Disconnected; ieventRacing.NewData += ieventRacing_NewData; Trace.WriteLine("This sample show how to access game data through an event paradigm."); //The following statement would be best in your form_load handler ieventRacing.StartListening(); //Simulate a form opened for 10 seconds. Thread.Sleep(10000); //Stop listening when your app shuts down (say inside your form_unload handler). ieventRacing.StopListening(); Trace.WriteLine("Sample finished."); }
public static void Sample() { var instance1 = new iRacingEvents(); instance1.NewData += instance1_NewData; instance1.StartListening(); var iracingInstance = new iRacingConnection(); var start = DateTime.Now; foreach (var data in iracingInstance.GetDataFeed()) { if (DateTime.Now - start > TimeSpan.FromSeconds(1)) break; traceMessages.Enqueue(string.Format("Enumerable Data Tick {0}", data.Telemetry.TickCount)); } instance1.StopListening(); foreach (var m in traceMessages) Trace.WriteLine(m); }
static iRacing() { instance = new iRacingConnection(); eventInstance = new iRacingEvents(); }
public Main() { iracingEvents = new iRacingEvents(); InitializeComponent(); }