From 42dc1d36235292786322d28340a81c6cb3fd46c0 Mon Sep 17 00:00:00 2001 From: hurter Date: Wed, 31 Aug 2011 16:25:05 +0000 Subject: --- Data/Program.cs | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 Data/Program.cs (limited to 'Data/Program.cs') diff --git a/Data/Program.cs b/Data/Program.cs new file mode 100644 index 0000000..0b7b3cc --- /dev/null +++ b/Data/Program.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using IvyBus; + +namespace Data +{ + class Program + { + + private const string ivy_domain = "127.255.255.255:2010"; + + static void Main(string[] args) + { + IvyControl TheIvyBus = new IvyControl(); + // + // TheIvyBus + // + TheIvyBus.AppName = "AppDatabase"; + TheIvyBus.Culture = new System.Globalization.CultureInfo("en-US"); + TheIvyBus.ivy.Start(ivy_domain); + //TheIvyDomain.DomainChanged += new EventHandler(TheIvyDomain_DomainChanged); + AppDatabase database = new AppDatabase(TheIvyBus); + + database.addAircraftView(new ConsoleAircraftView(database)); + + + + /** Console.WriteLine("Affichage de la liste des beacons : "); + Beacon[] beacons = database.getBeacons(); + foreach (Beacon b in beacons) + { + Console.WriteLine(b.Code + " : " + b.Lat + " " + b.Lon); + } + + Console.WriteLine("\n\nAffichage des secteurs : "); + Sector[] sectors = database.getSectors(); + foreach (Sector s in sectors) + { + Console.WriteLine(s.Name); + } + + Console.WriteLine("\n\nAffichage des Routes : "); + Route[] routes = database.getRoutes(); + foreach (Route r in routes) + { + Console.WriteLine(r.B1 + " -> " + r.B2); + } + * */ + } + } + + class ConsoleAircraftView : IAircraftView + { + private int count; + private AppDatabase app; + public ConsoleAircraftView(AppDatabase app) + { + count = 0; + this.app = app; + } + public void updateView(Dictionary> listOfAircrafts) + { + count++; + Console.WriteLine("Vue updatee pour la " + count + "ème fois"); + if ((count % 100) == 0) + { + Console.WriteLine("Hour : " + app.getHour() + ":" + app.getMinute() + ":" + app.getSecond()); + } + } + } +} -- cgit v1.1