Beispiel #1
0
        private async void NavigateButton_Click(object sender, RoutedEventArgs e)
        {
            //Sunmart lat lon = 46.83321,-96.8198878
            // Home lat lon = 46.83016,-96.829341

            double latitude  = 0.0;
            double longitude = 0.0;
            string name      = "Fargo, ND";

            LocationDB loc = databaseMgr.FindLocation();

            if (loc != null)
            {
                latitude  = loc.Latitude;
                longitude = loc.Longitude;
            }

            #region This is using bing maps

            //latitude = 46.83321;
            //longitude = -96.8198878;

            ////// The URI to launch
            //string uriToLaunch = @"bingmaps:?cp="+ latitude + "~" + longitude + "&lvl=17";
            //var uri = new Uri(uriToLaunch);

            //// Launch the URI
            //var success = await Windows.System.Launcher.LaunchUriAsync(uri);
            //if (success)
            //{
            //    // URI launched
            //}
            //else
            //{
            //    // URI launch failed
            //}
            #endregion

            #region This is using any other app
            // Get the values required to specify the destination.
            //latitude = 46.8949507;
            //longitude = -96.8021357;

            if (loc != null)
            {
                // Assemble the Uri to launch.
                Uri uri = new Uri("ms-drive-to:?destination.latitude=" + latitude +
                                  "&destination.longitude=" + longitude + "&destination.name=" + name);

                // Launch the Uri.
                var success = await Windows.System.Launcher.LaunchUriAsync(uri);
            }

            #endregion
        }
Beispiel #2
0
        public LocationDB FindLocation()
        {
            SQLiteConnection conn   = new SQLiteConnection(DB_PATH);
            LocationDB       newLoc = null;

            List <LocationDB> retrievedTasks = conn.Table <LocationDB>().ToList <LocationDB>();

            foreach (LocationDB record in retrievedTasks)
            {
                newLoc = record;
            }

            return(newLoc);
        }
Beispiel #3
0
        public void AddLocation(double lat, double lon)
        {
            LocationDB newLocation = new LocationDB()
            {
                Latitude  = lat,
                Longitude = lon
            };

            SQLiteConnection conn = new SQLiteConnection(DB_PATH);

            // Delete any saved locations before inserting new one.
            conn.DeleteAll <LocationDB>();
            conn.Insert(newLocation);
        }