コード例 #1
0
        //Showed calculate how long you have run and how long you have left.
        public void MeterLeftToRun(MKMapView map, CLLocation pointA,
                                   UIKit.UILabel LeftOnRunlabel, double LengthOfTheRun)
        {
            CLLocation pointB = new CLLocation(map.UserLocation.Location.Coordinate.Latitude,
                                               map.UserLocation.Location.Coordinate.Longitude);

            var distanceToB = pointB.DistanceFrom(pointA);


            //The connection an the information to the server.



            //string text = "You have left" + distanceToB;
            //UserClient.Connect("10.0.1.5", text);
            string testRegistrationOFAUser = "******";

            UserClient.Connect("10.0.1.5", testRegistrationOFAUser);



            Console.WriteLine("THIS IS THE Destination between A and B" + distanceToB.ToString());
            Console.WriteLine("INTERNET IS ON" + UserClient.CheckConnectivity());


            if (LengthOfTheRun <= distanceToB)
            {
                Console.WriteLine("END OF RUN");
                audioManager.PlaySound("Finished.mp3");
            }
            double length = Math.Round(distanceToB, 2);

            Console.WriteLine(LengthOfTheRun - distanceToB);
            LeftOnRunlabel.Text = "YOU HAVE RUN: " + length.ToString();
        }