本文整理汇总了C#中Core.Run方法的典型用法代码示例。如果您正苦于以下问题:C# Core.Run方法的具体用法?C# Core.Run怎么用?C# Core.Run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Core
的用法示例。
在下文中一共展示了Core.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: attachConsoleDisplay
private static void attachConsoleDisplay(IDictionary<uint, AircraftBeaconSpeedAndTrack> beaconDisplayBuffer, Dictionary<string, List<AircraftTrackEvent>> events, Core.OGNAnalyser analyser)
{
analyser.AnalysisIntervalElapsed += lastBeacons => { beaconDisplayBuffer = lastBeacons; };
analyser.EventDetected += (airfieldKey, evt) =>
{
if (!events.ContainsKey(airfieldKey))
events.Add(airfieldKey, new List<AircraftTrackEvent>());
if (!events[airfieldKey].Contains(evt, new AircraftTrackEventComparer()))
events[airfieldKey].Add(evt);
};
analyser.Run();
var displayTimer = new Timer(5000);
displayTimer.Elapsed += (s, e) =>
{
if (beaconDisplayBuffer == null)
return;
Console.Clear();
Console.WriteLine("-- Analysis - Aircraft: -----------------------------------------------------------");
var nowUtc = DateTime.Now.ToUniversalTime();
foreach (var b in beaconDisplayBuffer)
Console.WriteLine($"\t{b.Key:X} {b.Value.AircraftType}\t: ({Math.Round(nowUtc.Subtract(b.Value.PositionTimeUTC).TotalSeconds, 1)}s ago) {b.Value.GroundSpeedMs}ms ({Math.Round(b.Value.GroundSpeedMs * 3.6f, 1)}km/h) - {b.Value.TrackDegrees}°");
if(events.Any())
{
Console.WriteLine("-- Last Events: -------------------------------------------------------------------");
foreach (var airfieldEvents in events)
{
Console.WriteLine(airfieldEvents.Key);
foreach (var evt in airfieldEvents.Value)
Console.WriteLine($"\t{evt.EventDateTimeUTC:HH:mm:ss}\t{evt.EventType}\t{evt.ReferenceBeacon.AircraftId:X}");
}
}
displayTimer.Start();
Console.WriteLine("-----------------------------------------------------------------------------------");
};
}
示例2: Main
private static void Main()
{
var worker = new Core();
worker.Run();
}