Пример #1
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            var navigation = new Navigator(/*ChangePortName is needed*/);
            var logger = new Logger(navigation);
            //var route1 = navigation.GetRoute(@"北京市鼓楼东大街46号", @"三里屯");
            //var routing = new Routing();
            var destination = @"独墅湖体育馆";
            if (args.Length > 0)
            {
                destination = args[0];
            }

            try
            {
                navigation.Connect();
                Stopwatch s = new Stopwatch();
                s.Start();

                while (s.Elapsed < TimeSpan.FromSeconds(600))
                {
                    var currentLocation = navigation.GetCurrentLocation();
                    if (!String.IsNullOrEmpty(currentLocation))
                    {
                        //var route1 = navigation.GetRoute(@"北京市鼓楼东大街46号", @"三里屯");
                        var route = navigation.GetRoute(currentLocation, destination);
                        Console.WriteLine(@"Current Location is :", navigation.GetCurrentLocation());
                    }

                }
            }

            catch
            {
                navigation.Disconnect();
            }

            finally
            {
                navigation.Disconnect();
            }
        }
Пример #2
0
        static void Main(string[] args)
        {
            Console.OutputEncoding = Encoding.UTF8;

            var navigation = new Navigator();
            var route1 = navigation.GetRoute(@"北京市鼓楼东大街46号", @"三里屯");
            var routing = new Routing();
            try
            {
                navigation.Connect();
                Stopwatch s = new Stopwatch();
                s.Start();

                while (s.Elapsed < TimeSpan.FromSeconds(600))
                {
                    var currentLocation = navigation.GetCurrentLocation();
                    if (!String.IsNullOrEmpty(currentLocation))
                    {
                        //var route1 = navigation.GetRoute(@"北京市鼓楼东大街46号", @"三里屯");
                        var route = navigation.GetRoute(currentLocation, @"三里屯");
                        Console.WriteLine(@"Current Location is :", navigation.GetCurrentLocation());
                    }

                }
            }

            catch
            {
                navigation.Disconnect();
            }

            finally
            {
                navigation.Disconnect();
            }
        }
Пример #3
0
 public Logger(Navigator nav, int duration = 500)
 {
     aTimer          = new Timer(500);
     aTimer.Elapsed += (sender, e) => { OnTimedEvent(nav); };
     aTimer.Enabled  = true;
 }