Connect() public méthode

public Connect ( ) : void
Résultat void
Exemple #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();
            }
        }
Exemple #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();
            }
        }