How to make a messagebox disappear after 3 seconds? - windows-phone-7

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/

Related

How to check if you clicked the close button on the window? (Ruby)

I just want to ask what command in Ruby allows you to check if an application made in Ruby or running application is about to be closed? For example, I have an executable file that i ran and I clicked the close button on the window. I want to make a pop up of a dialog that says "you are about to close". Once you pressed the OK button, the window finally closes.
How can you do this in Ruby?
I don't know how things work in Ruby, but in general, on Windows, when a window receives a request to close, its window procedure receives a WM_CLOSE message. This is the place to display prompts to the user. If the app then wants to block the window from closing (because the user wants to reject it, etc), the app can simply skip destroying the window, and not pass the message on to the default message handler (DefWindowProc()).
In the case where the user clicks on the window's close button, or chooses the "Close" option from the window's pop-up system menu, or presses ALT-F4 while the window is in focus, the window receives a WM_SYSCOMMAND(SC_CLOSE) message, and if the message is passed on to the default message handler, the window then receives the WM_CLOSE message.
Take that information and translate it to Ruby as needed.

Prompt a message "Press back button twice to return to app" in wp7

I am working on WP7 app.
In this am launching youtube url in Yotube app.
To return to my app from YouTube user will have to click back button twice, as per my research this is a known issue.
I need to show a message(inside youtube) to user like "Press back button again to return" whenever he presses back button.
How can I achieve this?
Welcome any comment!!
If I understand you correctly, you want to display a popup in another application? In your case a Youtube-app?
Unfortunately, you can not change the behavior of another app. There aren't any hooks in other apps from your own app.
That is not possible.

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.

Windows phone Mango - Navigation in progress

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()

Make MessageBox stay on top of other windows

I have a TimerProc which calls MessageBox. I want the MessageBox to stay on top of other windows. So for example, the parent window sets the timer, then I move another window on top of that. When the timer fires, I want to MessageBox to appear on top of the window that is covering the app. Is this possible, and how should I go about doing it?
I think you want to make it System Modal as MB_SYSTEMMODAL as described here.
And/or make the window that is on top be the owner of the MessageBox.
Do you need the same message box which is already open to go to the top? Or a new one to open up above the other windows?
If you want the same MessageBox which is already open just brought to the top:
I think you can get a MessageBox window handle if you use EnumThreadWindows but I've never tried it myself. So if that works you could use its window handle in a call to BringWindowToTop.
If getting the MessageBox handle isn't working for you, you can simply create your own window which looks like a message box instead and then call BringWindowToTop instead.
If you want to popup a new MessageBox on the top:
If you want a new MessageBox each time you can use the MB_SYSTEMMODAL flag as described in the MessageBox documentation. MB_TOPMOST is said to be ignored in Vista and above.

Resources