Windows Phone Application - Start page depends on FileExist in isolated storage - windows-phone-7

I'm developing application that start page depends on file existing in isolated storage.
If file doesn't exist my application shows some form to setup configuration, but if it exist I wish this page will not be diesplayed.
For now I just load configutarion page but if file exist i use NavigationService to navigate to proper page on pageloaded event. The problem is that after I play with my app and hit back button it goes to configuration setup and because file exist it navigates me stright to my app again. I despite the fact that setup screen blinks on the application launching.
So my question is - how to setup startup page depends on some condition ?

The advice that I've heard is to use a UserControl on your startup page - then toggle the visibility depending on the condition you have. That way you don't end up with an unwanted page in the backstack and you get to fully control the UX.
The example I heard it with was a login page - not something you want on the backstack usually - but something you can easily check a bool to hide/show the user control.
The place I heard it was this video from Mix 11: Expert Lessons: Top Tips for Building a Successful Windows Phone Application. You can download the code to the demo (it is the first demo in that video) from the bottom of his blog entry here (which gives some more detail): Demos from my Mix 2011 session - Part 1: Navigation Tips

There is no way to launch different page on some conditions.
There are methods to manipulate Page Stack in NavigationService class, so you can remove setup page from history and app not will be navigated to it when user tap back button.
For fighting with page blinking you can put an image (the same image as splashscreen) above your page, and hide it when right content loaded

Related

App Inventor 2 - WebViewer detecting changes

I am trying to integrate MobPartner ads in my app, the ads from MobPartner can be displayed from "Pools" which contain several ads which automaticly scroll sideways and are set which an individual click link. The page with the ads looks like this, when I set the URL of the WebViewer in AI2, the ads display and scroll as they should.
The problem I have is detecting a click on one of the ads, this is the best I got to:
If a user would click on one of the ads via the WebViewer it will redirect them to the automatic URL set by the advertiser. I will then use the link and set ActivityStarter to WebViewer1.CurrentUrl and start the website full screen instead of the ad resolution (320x48).
I would like to know if there is a way to detect any clicks within WebViewer so that I can start ActivityStarter faster with the link. If not, is there a way to check the URL of the link clicked in WebViewer before the target website loads. In my opinion the timer (set to 1000 interval) is an inefficient way of checking if an ad is clicked. Anyone able to answer my questions above or provide a way of improving this code? Much appreciated.
PS: The HomeUrl for WebViewer has been pre-defined in the designer as well as the ActivityStarter "Action".
Thank you!
There is no possibility to detect any clicks within the Webviewer. The only thing you can detect is an URL change with the Clock component, and this is what you are already doing.
What you could do is to reduce the timer interval or instead of opening the webpage with the Activity Starter, just stay in the Webviewer and set its height and width to fill parent, which is -2 in the Blocks Editor, and hide all the other components on the screen to be able to view only that webpage in full screen.

Non Linear Navigation Service

I'm creating an app that has start button which brings you to start page from anywhere in app.
However back navigation stack hurts when I just navigate to start page.
Looking for solution I found NonLinearNavigationService. The trouble is that download links are target to app hub, which (now, as we have new better app hub) redirects me to main page and nowhere further. Also I failed to find it on app hub using build in search engine.
Anyone knows where from can I get it?
Or maybe another solution for navigation loops?
If you use RemoveBackEntry(), the entries are programmatically cleared from the backstack so you don't have to deal with the side effects of actually navigating back through the pages to pop them off the stack.
The NonLinear Navigation Service effectively does what you have tried. It calls GoBack() to traverse back up the stack. What it additionally does to prevent the flicker is to make the root frame transparent. See this question:
Skip a page when the back button is pressed, WP7
I don't want to call your question a duplicate because I think before Mango came out, that was probably the solution that needed to be used. Now that RemoveBackEntry() has been added to NavigationService, I think using that would probably be the better approach.
No linear navigation in WP7 is generally not recommended, because of the hardware back button and the UX on the rest of the phone, so you should probably structure your app to avoid this. However it should pass the certification process.
Here's another similar question In-App Home Button to Navigate to MainPage allowed? and an article about circular navigation which mentions the NonLinearNavigationService you are talking about http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/12/13/solving-circular-navigation-in-windows-phone-silverlight-applications.aspx.
If the only non-linear part of the navigation is the home button, you could use NavigationService.RemoveBackEntry() in a loop untill it raises an InvalidOperationException in the home button event. When the InvalidOperationException is raised the BackStack is empty and the next click on the back button exits the application.

WP7: Is it possible to intercept the backstack before the journal thumbnail is created/stored

You all know the Windows Phone backstack right. If you go through some apps, tap the Home key after starting each app. Now tap and hold the Backkey to see the Backstack. You can now see some small images of your apps, and can pick which one to go to right.
Question:
Is it possible to intercept before the backstack image is created? I have tried to blur my page in various events (include OnNavigatingFrom) to no avail.
My guess is some other event (probably something we don't have access to) is triggered and a bitmap is created, because when you use the Backstack to navigate you can just see a slight transition from the saved image to a real page IMO.
Does anyone know if its possible to intercept or manipulate these images on the backstack?
Example screenshot from WP emulator of the Backstack thumbnails
Following my comment, I've just tried this:
Set a breakpoint anywhere in the code
Start the app with the debugger attached, then let it reach the breakpoint
While the execution is stopped by the debugger, long press on the back button
The task switching UI is displayed even though the managed code execution is stopped
From there, I think we can safely conclude that the task switching and the thumbnail are handled entirely by native code. Therefore, there's nothing you can do.
I recently wrote a blogpost in which I discuss the ways I tried to hide data from the application snapshot. (You can read it here: http://corstianboerman.com/trying-to-hide-crucial-data-from-an-application-snapshot/)
The outcome: You just can't hide it.

How Can I navigate back to home screen in Windows Phone 7.1

I have a created an app which has a Homescreen/landing page,Now whenever user navigates till last page and clicks the device back button he is redirected back to Homescreen. Now the issue is I have written code to clear all the backstack whenever user lands on the Homescreen in Homescreen OnNavigatedTo block. So whenever user clicks device back button of last page he is navigated to homescreen by creating a new instance of HomeScreen page.
On Homescreen the backstack is cleared, so the user can exit the app from homescreen when he clicks the device back button.
But according to Microsoft marketplace policy, backbutton must go back or go to previous page in backstack and not navigate to new page.
So the question here is should I clear all my backstack and go to homescreen or what I am doing is right?
As far as I know, they are not so strict as that. They just want you to handle the back button.
I had blocked the back button in some pages of my application and the certification failed. I changed the behavior of the application, to either close the application when navigating back or jump a couple of pages back, and it passed certification.
Just make sure the back button does something...
The reason they dis-advise you from doing this is because you are using the wrong organisation.
Going deeper usually means you get too more specific data, in a way you can go back up one page.
Going to the side usually means that you get more data, eg. Panorama / Pivot
I can't see a case where going deeper would disallow the user from going back to pages in between, I would not use your application if I had to start it every time again or when it would go deeper when it is actually supposed to let me scroll through the content.
Trying to surround their certification is definitely not the way you should be going, but rather embrace it.
See this page for layout tips and tricks for the Panorama and Pivot controls.
As per the comments, you might find it a lot easier to ditch having to learn all platforms.
A jQuery Mobile application can do that for you.
jQuery mobile framework takes the "write less, do more" mantra to the next level: Instead of writing unique apps for each mobile device or OS, the jQuery mobile framework allows you to design a single highly-branded web site or application that will work on all popular smartphone, tablet, and desktop platforms.

Mango Secondary Live Tile issue

I have a panorama application and I have successfully created secondary live tile with URI pointing to the desired xaml.cs. Now the xaml part which is separate from mainpage.xaml is of no use to me so what happens is when user goes to the secondary live tile, code from desired.xaml.cs is seen by the user. But when he presses the back button, he goes to an empty page and then goes to homepage and I am aware it is not possible to jump directly to home screen. So how do I solve this issue? If you are wondering how this works - try network dashboard for Windows phone. Quite similar.
Can't reproduce. When you are navigated from a Live Tile, and presses back, you'll exit the application, since there are no other pages in the navigation stack.
The Network Dashboard works the same way.
If you somehow managed to have other pages in your navigation-stack , consider removing them using NavigationService.RemoveBackEntry

Resources