windows-phone-7

Why Microsoft Windows Phone 7 Team didn't use the same semantics of ActiveControl for Winform ?

On Windows Phone 7 to get the current control one would use FocusManager.GetFocusedElement() Wherea on Winform it is just ActiveControl. Why use 2 semantics which is a nuisance for portability ? Is there any difference of behavior you can see between the two ? If yes that makes sense, otherwise that doesn't. ...

I am trying to run Mars Image Viewer Sample from OCT 2010 MSDN Magazine but running into some errors?

Here is the code- private void getImageIDs() { Uri serviceUri = new Uri("https://api.sqlazureservices.com/NasaService.svc/MER/Images?missionId=1&amp;$format=raw"); WebClient recDownloader = new WebClient(); recDownloader.Headers["$accountKey"] = "<enter your key>"; recDownloader.He...

Dispatcher.BeginInvoke lambda capture thread-safe?

In Windows Phone 7 / Silverlight, is the following code safe or is it a race condition? //Snippet 1 foreach(var item in list) { Deployment.Current.Dispatcher.BeginInvoke( () => { foo(item); }); } Surely (?) this alternative is racy? //Snippet 2 Deployment.Current.Dispatcher.BeginInvoke( () => { foreach(var item in li...

How can I update Azure Table Storage resource by implementing IDataServiceUpdateProvider?

I am trying to expose an editable Azure Table Storage table. (If it matters: to Win Phone 7 via the OData Client Lib CTP.) On the server side, I have a DataServiceContext : TableServiceContext, IDataServiceUpdateProvider I can add and delete objects, but when I try to update a resource, SaveChanges() does not appear to "pick up" the val...

Navigation in Application Activated Windows Phone 7 (Tombstoning)

Hi there, Whenever my program is closed via tombstoning, when it is reactivated I would like the application to Navigate back to the start screen. I would like to do something like this private void Application_Activated(object sender, ActivatedEventArgs e) { NavigationService.Navigate(new Uri("/Start.xaml", UriKind.Relative)); } but...

Windows Phone 7 - Deselecting ListBoxItem in nested ListBoxes

I have a ListBox with dates. Each ListBoxItem (date) have another ListBox with that date's events. When I select an event it gets highlighted (SelectedIndex/SelectedItem) and I navigate to another Pivot. This works fine. My problem is that every ListBox has it's own SelectedItem. I want to clear the SelectedItem from each ListBox, but ...

WP7 Using TransitioningContentControl for different forward and back animations

I'm using the TransitioningContentControl to create animations for navigating between pages. I used this blog post as my guide: http://wildermuth.com/2010/07/16/Bring_Back_Page_Transitions_to_the_Windows_Phone_List_Application_Template I also found this post that does something very similar: http://www.slickthought.net/post/2010/04/26/S...

Open Windows Phone 7 App from URL

I need to launch my WP7 application from the phone's browser and pass some arguments. For example, the following url would be a link on an html page. Clicking the link would start my application. iPhone and Android both have these capabilites by the name of 'url schemes'. appName://my.arguments.here How can I accomplish this on WP7...

Where do I catch an EndpointNotFoundException for an Async WCF call?

I'm having some difficulty trapping an exception during my testing. I actually disconnect the service so that the endpoint is not available, and I am attempting to modify my application to handle that possibility. The problem is that no matter where I put try/catch blocks, I can't seem to catch this thing before it gets to unhandled. ...

How do I get estimated battery life on Windows Phone 7

Back in the good ol' Windows Mobile day (CE based) one good get a rough estimate of battery life using the CE CoreDll.dll. Well sometimes at least depending on your hardware. This was exposed via GetSystemPowerStatusEx. WP7 being SilverLight based I'm assuming these sorts of Interop approaches will no longer work. Is there an API that e...

How do I use the icons provided with the WP7 sdk properly?

Icons have been provided in the SDK for either "Light" or "Dark" depending on the theme set on the phone. On the application bar when the theme changes the icons automatically change with it. Also, when you press the button the image is reversed (so it's still visible) no matter which theme you're on. I can easily figure out how to chang...

Can I prevent screen timeout on Windows Phone 7?

In the CE based Windows Mobile you could prevent the screen back-light from timing out using the SetPowerRequirement and ReleasePowerRequirement API's like so: IntPtr handle = SetPowerRequirement("BKL1:", PowerState.FULL, 1, IntPtr.Zero, 0); // screen won't timeout while you do stuff in here ReleasePowerREquirement(handle); Is a simil...

How do I embed and read a text file ina WP7 app??

I'm trying to include a text file that contains some static data that I need to read in when the app starts up. I've added the file and marked the Build Action to "Resource" but I'm unsure of how to actually read it in as a stream. Anyone know how to do this? ...

Linq search result by closest match

I have an ObservableCollection, which holds a Person object. I have a search feature in my application, and would like to display the most relevant results at the top. What would be the most efficient way of doing this? My current search method simply calls the contains method: var results = (from s in userList where s.N...

Horizontal scroll inside WP7 pivot page

Hi! I'm having problems with horizontal scrolling inside Pivot control in WP7. I have a Grid with ScrollViewer and ten or more buttons inside. Since all buttons don't fit on the screen i need to be able to horizontally scroll. But when i click and drag on buttons the whole Pivot page starts moving and eventually switches to next pivot pa...

phone7, silverlight, move copy or rename files?

Is there any way in Phone7 to rename a file? I don't see anything in IsolatedStorageFile that exposes this functionality but perhaps I'm missing something? It seems like the best way to rename a file is to read its contents and write them to another file and then delete the original. ...

Expression Blend 4 on Windows Phone 7: Difficulty with scrolling

I'm using Expression Blend 4 to prototype a Windows Phone 7 app. I have a page that is supposed to display a news story. I'm having difficulty getting it to scroll down all the way in the emulator. I can only scroll the see some of the text box. Sometimes, when I make the ScrollViewer taller, I can actually scroll less in the emulator. ...

How to get CPU and memory usage statistics in WIndows Phone 7?

Hi! How can I get CPU and memory usage statistics in Windows Phone 7? Well any statistics about particular WP7 device would be helpful. ...

Windows phone7 emulator requires constant refresh

I have the tools installed for windows phone 7 development. But, when I run the any of the sample apps I have to manually refresh my emulator's app window to see any changes. Any ideas what I'm doing wrong? Or maybe a setting is wrong? Thanks ...

XNA Game failing to deploy to WP7 Emulator

This use to work, I can't tell what I broke... but I suspect it is something to do with the WMAAppManifest / Guid... When I attempt to Deply/Debug to the WP7 Emulator from VS I get the following popup message: "The application could not be launched for debugging. Verify that the application is installed on the target device." What I ac...