GPS Navigation Service for Windows Phone 7 - windows-phone-7

I am writing application in WP7 for traveling. Is it possible to navigate to GPS coordinate with Bing Maps on WP7.
I mean I have GPS coordinate, button "travel to" and after clicking it I'll have route to that point (by Bing Service)?

I haven't tested this on Windows Phone 7, but judging by this MSDN article it also applies to WP 7.1.
Here's the sample:
BingMapsDirectionsTask bingMapsDirectionsTask = new BingMapsDirectionsTask();
// You can specify a label and a geocoordinate for the end point.
// GeoCoordinate spaceNeedleLocation = new GeoCoordinate(47.6204,-122.3493);
// LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", spaceNeedleLocation);
// If you set the geocoordinate parameter to null, the label parameter is used as a search term.
LabeledMapLocation spaceNeedleLML = new LabeledMapLocation("Space Needle", null);
bingMapsDirectionsTask.End = spaceNeedleLML;
// If bingMapsDirectionsTask.Start is not set, the user's current location is used as the start point.
bingMapsDirectionsTask.Show();

You can open Here Drive (by Nokia) with the following URI scheme:
guidance-drive://v2.0/navigate/destination/?latlon=52.53,13.41&title=Museum
This will switch app, then start navigating to 52.52/13.41. The title is optional.
Source: http://developer.nokia.com/resources/library/Lumia/maps-and-navigation/here-launchers/wp-uri-schemes-for-location-applications/drive-guidance.html

Related

CGDisplayCreateImageForRect: how to ignore a specific NSWindow

I'm looking to make a sample "lens" app which show what's is visible under the current mouse location. I've used CGDisplayCreateImageForRect to get a portion of the screen under the mouse location.
Now I would to attach a transparent window at the same location of the mouse and show this lens directly under the mouse position; however under this location there is...my transparent window with the result zoom... ops!
Is there a way to exclude a particular window from the snapshot or another method to get the current image at mouse position by ignoring something behind it?
You can't do it with that function. You can use the CGWindowList API to do it: either CGWindowListCreateImage() or CGWindowListCreateImageFromArray(). These let you specify criteria to select the windows to include or an explicit list of windows.
It's not clearly documented how to obtain the window ID of one of your own windows. The supported way is probably to query information about all on-screen windows using CGWindowListCopyWindowInfo() and then use the properties to identify yours. That said, I believe that the NSWindow property windowNumber does in fact correspond the Core Graphics window ID.
#ken-thomases point me to the right direction. The function I've used to include all windows and exclude my single one is CGWindowListCreateImageFromArray().
The code below is a small example:
// Get onscreen windows
CGWindowID windowIDToExcude = (CGWindowID)[myNSWindow windowNumber];
CFArrayRef onScreenWindows = CGWindowListCreate(kCGWindowListOptionOnScreenOnly, kCGNullWindowID);
CFMutableArrayRef finalList = CFArrayCreateMutableCopy(NULL, 0, onScreenWindows);
for (long i = CFArrayGetCount(finalList) - 1; i >= 0; i--) {
CGWindowID window = (CGWindowID)(uintptr_t)CFArrayGetValueAtIndex(finalList, i);
if (window == windowIDToExcude)
CFArrayRemoveValueAtIndex(finalList, i);
}
// Get the composite image
CGImageRef ref = CGWindowListCreateImageFromArray(myRectToGrab, finalList, kCGWindowListOptionAll);

Getting a notification when other app's window move / resize

I'm creating a screen scraping application. What I'm trying now is to fit a rectangle around the corners of the active windows of a given application (by PID).
I managed that by getting a reference to all the active windows in the workspace and using CGWindowListCopyWindowInfo to match the owner PID. Now I have an array of the active windows, but after showing the rectangle that incorporates all the windows as above stated, I didn't find a way to register to get notifications when those windows are moved and / or resized in order to resize and fit my drawn rectangle.
The following is a sample of the code I used to get the NSWindow's frames of the selected application.
pid_t pid = [selectedApplication processIdentifier];
CFArrayRef windowList = CGWindowListCopyWindowInfo(kCGWindowListOptionAll,kCGNullWindowID);
for (NSMutableDictionary* entry in (NSArray*)windowList) {
pid_t ownerPID = [[entry objectForKey:(id)kCGWindowOwnerPID] integerValue];
if (pid == ownerPID) {
// setting the bounds for each window of the application on match
CGRectMakeWithDictionaryRepresentation((CFDictionaryRef)[entry objectForKey:(id)kCGWindowBounds], &bounds);
.....
Is there any way in which I can register for updates from those NSwindows given a specific PID of an application I don't own ?
Currently this is a limitation of the APIs from Apple. Didn't find any other way to register for update NSNotifications from other applications NSWindows. Maybe this is treated as a security measure.

Wide Tile Windows Phone 7.1 using MangoPollo

I have a Windows Phone 7.1 app and I want to include a wide iconic tile. I found a library called MangoPollo:
http://mangopollo.codeplex.com/
I found this code within:
var tile = ShellTile.ActiveTiles.FirstOrDefault();
if (tile != null)
{
var tileData = new FlipTileData();
tileData.Title = "Start Debugging";
tileData.BackContent = "switch to windows phone, we've got candy";
tileData.BackgroundImage = new Uri("Assets/tileBackground.png", UriKind.Relative);
tileData.BackBackgroundImage = new Uri("Assets/tileBackBackground.png", UriKind.Relative);
tileData.WideBackContent = "switch to windows phone, we've got candy";
tileData.WideBackgroundImage = new Uri("Assets/wideTileBackground.png", UriKind.Relative);
tileData.WideBackBackgroundImage = new Uri("Assets/wideTileBackBackground.png", UriKind.Relative);
tile.Update(tileData);
}
The problem is there isn't any documentation included on Codeplex for the project so I'm not sure where to insert this code (i.e. which function) to change the tile size from normal to wide.
Another way of creating Wide Tile in Windows Phone 7. Tested it and it works.
Check this out.
http://www.supersmithbros.com/index.php/latest-news/93-how-to-create-a-wp8-wide-tile-in-wp7-xna
You may call it where you want and there is no code to change tile at the user screen, because it's not allowed.
If you look in the source code, in the link to MangoPollo which you supplied, the sample code places the tile code in a button click event. So what I would do in your app, is make an option to set up this new tile (settings page, maybe?) and when the user turns this setting on, you would run the code in that event handler.
This way, the code doesn't unnecessarily execute multiple times (as it would if it were in the constructor of a page or in app.xaml.cs).
Hope this helps!
Edit:
Based on your comment then, maybe you can put it in the constructor of your first page. Maybe, then, to prevent the code from executing more than necessary, you could check the existing tile to see if it already has a WideBackgroundImage, and if it doesn't, then set it and call Update() otherwise just continue.

Change the colour of WinJS.UI.BackButton (Win 8.1 back button)

I'm getting started with Windows 8 App development using WinJS. I'm using the Light UI theme but I have set up a darker area on the left of the page (where the black back button is) and the issue is: you can't see the button.
I've trawled through the MSDN pages and the most I could find is how to style a button which doesn't actually explain how to change the colour of an actual asset.
http://msdn.microsoft.com/en-us/library/windows/apps/jj835822.aspx
I've also tried adding: win-ui-light and win-ui-dark classes to the button with no success.
I wondered if someone could point me in the right direction?
Many thanks for your time
Chris
First of all you have to delete the link tag that contain UI css by default and add it to document head , Dynamically.see below code :
var uistyle;
// call when your app load or resume.
function onappopen(){
uistyle = document.createElement('link');
uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";
uistyle.rel = "stylesheet";
uistyle.id = "UIstyle";
document.head.appendChild(uistyle);}
// call when you want to change UI Style.
function UIstyle(UIbool){
if(UIbool=='light'){ uistyle.href = "//Microsoft.WinJS.2.0/css/ui-light.css";}
else {uistyle.href = "//Microsoft.WinJS.2.0/css/ui-dark.css";}}
Like: UIstyle('light'); for light UI in Windows 8 or "UIstyle()" for dark;
I used the DOM Explorer to find the buttons default values and overwrite them. It was the child element that needed to be overwritten: .win-back

position of ComboBox

I want to some kind of option list when i hold a selection in a listbox. And i didn't find something default that does this, so i'm trying to build one of my own. So first is there such a feature in windows phone 7?
If not, then i need to open a combo box of listbox at the specified position where the selection event happened, i found out how to get the coordinates of the event as follows:
System.Windows.Point position = e.GetPosition(this);
double pX = position.X;
double pY = position.Y;
Howerver, i can't find a way to set the coordinates of the combobox for example in the view to those coordinates or so.
Help please
Perhaps what you want is a ContextMenu - there is one available in the Silverlight Toolkit for Windows Phone.

Resources