void DrawRoute(RunData item)
        {
            JustRunDataContext db = new JustRunDataContext(JustRunDataContext.ConnectionString);
            GeoCoordinateCollection geoCollection = new GeoCoordinateCollection();
            var geoCords = db.GeoCords.Where(p => p.No == item.No);
            foreach(var gc in geoCords)
            {
                GeoCoordinate _geoCord=new GeoCoordinate();
                _geoCord.Longitude=gc.Longitude;
                _geoCord.Latitude=gc.Latitude;
                geoCollection.Add(_geoCord);
            }
            if (geoCollection.Count != 0)
                Map.Center = geoCollection[0];
            else
            {
                MessageBox.Show(AppResources.NoGeoFoundMsg);
                NavigationService.GoBack();
                return;
            }
            Map.ZoomLevel = 16;
            Time.Text = item.Datetime.ToShortTimeString();
            Date.Text = item.Datetime.ToShortDateString();
            foreach (var geoCord in geoCollection)
            {
                _line.Path.Add(geoCord);
            }
            MapOverlay myLocationOverlay = new MapOverlay();
            BitmapImage tn = new BitmapImage();
            tn.SetSource(Application.GetResourceStream(new Uri(@"Assets/finishflag.png", UriKind.Relative)).Stream);
            Image img = new Image();
            img.Source = tn;
            img.Height = 80;
            img.Width = 80;
            myLocationOverlay.Content = img;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = geoCollection[geoCollection.Count - 1];

            MapLayer myLocationLayer = new MapLayer();
            myLocationLayer.Add(myLocationOverlay);

            myLocationOverlay = new MapOverlay();
            tn = new BitmapImage();
            tn.SetSource(Application.GetResourceStream(new Uri(@"Assets/GreenBall.png", UriKind.Relative)).Stream);
            img = new Image();
            img.Source = tn;
            img.Height = 25;
            img.Width = 25;
            myLocationOverlay.Content = img;
            myLocationOverlay.PositionOrigin = new Point(0.5, 0.5);
            myLocationOverlay.GeoCoordinate = geoCollection[0];

            myLocationLayer.Add(myLocationOverlay);
            Map.Layers.Add(myLocationLayer);
            Map.Center = geoCollection[geoCollection.Count / 2];
        }
        public void Save()
        {
            try
            {
                int TimeCount = 0;
                string _duration;
                _duration = Regex.Replace(Duration, @"[^\d]", " ");
                _duration = Regex.Replace(_duration, @"\s+", " ");
                string[] time = _duration.Trim().Split(' ');
                for (int i = 0; i < 3; i++)
                {
                    int baseNum = i == 0 ? 3600 : i == 1 ? 60 : 1;
                    TimeCount += int.Parse(time[i]) * baseNum;
                }

                IsolatedStorageSettings data = IsolatedStorageSettings.ApplicationSettings;
                if (AvgSpeed == 0 || double.IsNaN(this.AvgSpeed))
                    if (TimeCount != 0)
                        AvgSpeed = (Distance / TimeCount) * 3.6;
                    else AvgSpeed = 0;

                if (AvgPace == 0 || double.IsNaN(this.AvgPace))
                    if (Distance != 0)
                        AvgPace = ((float)TimeCount / 60) / (Distance);
                    else
                        AvgPace = 0;
                if (double.IsNaN(this.BurnedCalories)) this.BurnedCalories = 0;
                if (double.IsNaN(this.Distance)) this.Distance = 0;

                RunData runData = new RunData();
                runData.AvgPace = AvgPace;
                runData.AvgSpeed = AvgSpeed;
                runData.BurnedCalories = BurnedCalories;
                runData.Datetime = datetime;
                runData.Distance = Distance;
                runData.Duration = Duration;
                db.RunDatas.InsertOnSubmit(runData);
                db.SubmitChanges();
                var max = db.RunDatas.Max(p => p.No);

                ARunData.ToGeoCordTable(geoCollection, max);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 partial void DeleteRunData(RunData instance);
 partial void UpdateRunData(RunData instance);
 partial void InsertRunData(RunData instance);
        public static void ToIsoDatabase()
        {
            try
            {
                JustRunDataContext db = new JustRunDataContext(JustRunDataContext.ConnectionString);
                db.CreateIfNotExists();
                db.LogDebug = true;

                var data = (List<ARunData>)IsolatedStorageSettings.ApplicationSettings["RunData"];

                foreach (var item in data)
                {
                    RunData runData = new RunData();
                    runData.Duration = item.Duration;
                    runData.Distance = item.Distance;
                    runData.AvgPace = item.AvgPace;
                    runData.AvgSpeed = item.AvgSpeed;
                    runData.BurnedCalories = item.BurnedCalories;
                    runData.Datetime = item.datetime;
                    db.RunDatas.InsertOnSubmit(runData);
                    db.SubmitChanges();
                    var max = db.RunDatas.Max(p => p.No);

                    ARunData.ToGeoCordTable(item.geoCollection, max);

                }

            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
            }

        }