So, you might be asking… Lance, why would I cause my App to “PAUSE”? Well, very simple… Sort of? Ok, hear me out for a moment, try to follow along.
If you’re like me, any way to make your Microsoft Windows Phone 7 (WP7) App work more effectively and writing less code is usually ideal, IF IT WORKS RIGHT. In some worlds, not maybe in your App world but if you get a company who’d like to place an Ad or maybe you want to Bug your user to upgrade to “Pro Edition”, it might be a good idea to cause a halt in your program to either display the Ad (per your agreement) or recommend them to go Pro so they don’t have to see anymore Ad’s… Endless different purposes but let’s just get on with a simple task I was messing with and found accidentally…
Tip: The displayed digit set is equal to 1-Second, so for 5-Seconds you’d have “5000”.
So, choose where you’re going to want this Pause to occur… Maybe make a function that uses a time to detect xx minutes of actual usage to trigger another function that performs whatever task you want, with the intended halt. As I already made a post here about HOWTO make a timer, go check it out to help yourself. Now, I am making up a pretend scenario but you could even launch the function to sit in the background at startup (see below).
BackgroundAd(); // This will launch our AD/Background Function.
/* Say you wanted to play a prank on a friend, you could do…
MessageBox.Show(“I’m sorry, you’ve been an awful friend but I am going to let you remember that now.”, “ERROR: BAD FRIEND!”, MessageBoxButton.OKCancel); System.Threading.Thread.Sleep(8000); // Set to 8 seconds, could go longer but mean…
MessageBox.Show(“Going to be nicer next time, right?”); // Send a REAL message to the User & using the default MBox.
Now, in my case I am using this as a way to advertise those who pay to be in my App’s or my Client’s App’s and offer a clean, highly attentive/non-distracting and eye-catching Media Ad for Windows Phone 7… May also start making my paid-WP7 App’s the ability to let the user try the App for 5 Min’s straight and after every other Min’s get an Ad/Upgrade notice.
Hope this is useful in your future projects as it has been for me and remember to try #Speechy Pro, now with OCR and only for Windows Phone 7 (#WP7)!