Windows Phone development and learning-toast notification on local implementation

Source: Internet
Author: User

In Windows Phone development, you can use the MessageBox. Show () method to implement message reminders. However, the interface is really ugly. After each pop-up, you need to click the OK button to disappear. In contrast, the toast method in Windows Phone SDK is good. Unfortunately, toast needs to interact with the server and cannot be called locally as if it was MessageBox. Fortunately, the coding4fun class library implements the local toastprompt control, which is very convenient.

First, as shown below, clicking the button will trigger the pop-up box above. This is just a local call :(CodeDownload the example here:

Http://www.windowsphonegeek.com/upload/articles/WP7SampleProject20.zip)

To achieve this effect, follow these steps:

1, download coding4fun class library, address http://coding4fun.codeplex.com/

2. decompress the downloaded file, find coding4fun. Phone. Controls. dll, create a DLL folder, and add it to the project.

3. Add DLL references to the Project

4. Remember to rebuild the project. Otherwise, the Assembly file may not be found during running.

5. Add the using coding4fun. Phone. Controls namespace to the backend CS code of the page where the control is to be used.

6. Add the following code to the event function that needs to use the pop-up message (here I select the first effect. For other effect codes, see the example)

VaR toast = new toastprompt {Title = "simple usage", message = "message", imagesource = new bitmapimage (New uri (".. \ applicationicon.png ", urikind. relativeorabsolute)}; toast. show ();

In fact, in many cases, toast does not need to contain so many things. It usually requires only one message, so it is generally written as follows:

 
Private void button_click (Object sender, routedeventargs e) {var toast = new toastprompt {message = "Diaoyu Islands are from China, and AOI is from the World",}; toast. Show ();}

Finally

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.