summaryrefslogtreecommitdiff
path: root/Data/Program.cs
blob: 0b7b3cc9dce03767d3c7d2b1f117d1052ff3bd1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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<string, List<AircraftPosition>> listOfAircrafts)
        {
            count++;
            Console.WriteLine("Vue updatee pour la " + count + "ème fois");
            if ((count % 100) == 0)
            {
                Console.WriteLine("Hour : " + app.getHour() + ":" + app.getMinute() + ":" + app.getSecond());
            }
        }
    }
}