Windows phone Mango - Navigation in progress - windows-phone-7

One of the pages my in application lets a user take a picture and in the meanwhile, if image is being processed, later a NavigationService GoBack is called. Now, if user clicks power button on the phone, the phone goes to sleep, and then immediately clicks power again and navigate to app, it calls Navigation GoBack.
Sometimes it will throw an error saying "Navigation is in progress", because the first user interface thread is still finishing navigation.
I have overloaded NavigateTo and NavigateFrom method. In NavigationTO I check if NavigationMode.Back I will execute GoBack.
If user clicks sleep and waits for a second or two and click on sleep again, it won't cause any issue since first user interface thread has finished executing Go Back.

Try :
if(NavigationServive.CanGoBack)
NavigationService.GoBack()

Related

How Do I Do Cool Dialog Stuff (MFC)

Whether I have to use a dialog box or a message doesn't really matter but I need to somehow do the following:
I've got a dialog-based MFC application. The main dialog calls a procedure that creates a thread. The call to the procedure is inside while loop. (Basically it's a file processing program - spawning off a thread for doing the file saving. So, a thread is spawned for each file that is being saved.)
I am suspending and resuming the main thread properly. However, I don't know how to get a message box/dialog box to display saying something like "please wait" and still have the main dialog update... 0.o
Basically, I want to lock the main dialog from user interaction (like keeping them from selecting anything or clicking any buttons), but I want the progress bar on the dialog to update...
Any ideas?
A bit old but does the work:
microsoft.com/msj/0297/wicked/wicked0297.aspx
Well, this is very old app.
You do not need to follow this sample; however you can follow the idea.
You have two choices:
Create progress bar in the main dialog, disable all dialog but progress. Start thread passing dialog’s handle. From the thread use this handle to send a custom message to allow dialog advancing progress.
Another message would notify dialog that thread is done and enable all controls.
Another choice would be to spawn modeless dialog, start the thread passing modeless dialog’s handle and process as described above.
Pass main dialog pointer to the modeless dialog to be used to disable and enable main dialog upon modeless start (OnInitDialog) and enable upon receiving thread complete message, before destroying modeless dialog window.

How to make a messagebox disappear after 3 seconds?

I have a confirmation screen in my app where I tell the user that his item is saved succesfully. He can press OK and the messagebox will go, but if he does not, how can I make the messagebox disappear after 3 seconds if there is no response?
According to MSDN, there is no way to close a messagebox without user action (no method provided for this action)
http://msdn.microsoft.com/en-us/library/system.windows.messagebox_methods(v=vs.95).aspx
If your message box doesn't need a user action, use Toast Prompt from Coding4Fun toolkit.
http://coding4fun.codeplex.com/

Back button only return in Windows Phone application

Is it allowed by Windows Phone application certification rules, to only have users be able to return to a previous screen with the use of a hardware back button?
In my scenario, a user clicks on a setting button and lands at a settings page. He changes settings if he decides to, and all the changes get saved automatically, like in iOS.
But currently, the only way for the user to get out of the settings screen, is to press a hardware Back button on the phone.
Will such implementation of navigation functionality pass the Windows Phone certification?
Yes - leave the back button as the navigation method to get back to your main page after visiting the settings page. Not only is this allowed, but it is the desired method of back navigation, and it is what Windows Phone users expect. Here is a great article on the subject: http://blogs.msdn.com/b/ptorr/archive/2011/10/06/back-means-back-not-forwards-not-sideways-but-back.aspx
As far as I understand the terms of the navigation guideline is your usage the right way to go.
Back button
Pressing the back button from the first screen of an application must exit the application.
Pressing the back button must return the application to the previous page.
If the current page displays a context menu or a dialog, the pressing the Back button must close the menu or dialog and cancel the
backward navigation to the previous page.
You should only implement back button behaviors that navigate back or dismiss context menus or modal dialog boxes. All other
implementations are prohibited.
See this cheat sheet for more informations on the design guidelines.

Windows Phone 7 and Back button Guidelines

I'm reading the following sumission requirement:
To maintain a consistent user experience, the Back button must only be used for backwards navigation in the application.
a. Pressing the Back button from the first screen of an application must exit the application.
b. Pressing the Back button must return the application to the previous page.
c. If the current page displays a context menu or a dialog, the pressing of the Back button must close the menu or dialog and cancel the backward navigation to the previous page.
d. For games, when the Back button is pressed during gameplay, the game can choose to present a pause context menu or dialog or navigate the user to the prior menu screen. Pressing the Back button again while in a paused context menu or dialog closes the menu or dialog.
My application require LogIn the first time, before entering its MainPage.
The login data will not be asked again (the user can change account from the settings).
I would like to avoid user entering again in the login page by using the backstack.
Pressing back from MainPage will exit the application.
In particular I'm worried about:
a. I show as a first screen the login page which will navigate to the mainpage, but I'm exiting the app with a back from the mainpage
b. I'm skipping a page, so pressing back is not strictly going to the previouspage
Do you think it will satisfy the certification requirements ?
Thanks
This scenario is allowed, what you should do is:
upon entering the MainPage (OnNavigatedTo) - remove one page from the back stack:
NavigationService.RemoveBackEntry();
Read this thread on the Windows Phone forum
The most important part appears to be that you should never disable the back button but I do think that according to this thread that it is allowed to skip the login screen.
On the other hand you might want to rethink the flow of the application when you consider thombstoning and re-activating; should the user login again and what would a natural flow be?

Issues in "WP7" Sudden Tombstoning

I am facing some issues in WP7 tombstoning. My issue is application hangs when i try for a sudden tombstone and come back. ie, After loading the page i press device menu button and with in seconds i pressed back button( Pressed Back button before the actual page disappeared) In that time the page loads but the application hangs / its back key press is not working. and if we try for a slow thombstone it is working perfectly. And the pretty interesting thing is that, while tombstoning the loaded and unloaded events of APP working perfectly. Please any one help me to solve this issue.
It sounds like your App has been deactivated, but not tombstoned. This results in neither the App or Page contrusctor being called, causing your app to act in unexpected ways. I highly recommend reading the Windows Phone Silverlight Application Life Cycle document. The relevant extract for said article:
This case can occur if the user
presses the Start and Back buttons on
the phone in quick succession. In this
case, the application received a
Deactivate event and the system was
starting to save the state of the
application to perform an application
tombstone. Before this operation is
completed, the app Activated event is
received. The system knows that the
application was not removed from
memory, so the flow of execution is
different. Specifically:
• The app constructor is not called.
• The page constructor is not called.
The only way for the application to determine
if this condition has occurred is to
set a flag to indicate if the page
constructor has been called. If you
notice in the above section, this flag
was set in the page constructor, and
cleared in the OnNavigateFrom event.
In this case, we will receive the
OnNavigatedTo event, but we will see
that the page constructor was not
called. This tells us that our
application was not tombstoned.

Resources