Last year, we compared the Windows Phone pop-up box with coding4fun [http://blog.csdn.net/fengyarongaa/article/details/7077031133 ]. Today, I will post all the operation classes.
1. Download a coding4fun DLL file and reference it to the project, you know!
Http://coding4fun.codeplex.com/
2. directly add the code.
[CSHARP]View plaincopyprint?
- Using system;
- Using system. net;
- Using system. windows;
- Using system. Windows. controls;
- Using system. Windows. documents;
- Using system. Windows. Ink;
- Using system. Windows. input;
- Using system. Windows. Media;
- Using system. Windows. Media. animation;
- Using system. Windows. shapes;
- Using coding4fun. Phone;
- Using coding4fun. Phone. controls;
- // @ Yr. Feng
- Namespace microblogforwp7.classes. util
- {
- /// <Summary>
- /// Dialog box
- /// </Summary>
- Public class msg
- {
- /// <Summary>
- /// Message prompt box with the "OK" and "cancel" buttons. Return Value: bool type
- /// </Summary>
- /// <Param name = "content"> message content </param>
- /// <Param name = "title"> title </param>
- /// <Returns> true or false </returns>
- Public bool returnconfirfmsg (string content, String title)
- {
- Messageboxresult M = MessageBox. Show (content, title, messageboxbutton. okcancel );
- If (M = messageboxresult. OK)
- {
- Return true;
- }
- Else
- {
- Return false;
- }
- }
- /// <Summary>
- /// Message prompt box with the "OK" button. Return Value: bool type
- /// </Summary>
- /// <Param name = "content"> message content </param>
- /// <Param name = "title"> title </param>
- /// <Returns> true or false </returns>
- Public bool returnconfirfmsgbyok (string content, String title)
- {
- Messageboxresult M = MessageBox. Show (content, title, messageboxbutton. OK );
- If (M = messageboxresult. OK)
- {
- Return true;
- }
- Else
- {
- Return false;
- }
- }
- /// <Summary>
- /// Message prompt box with the "OK" button. No return value
- /// </Summary>
- /// <Param name = "content"> message content </param>
- /// <Param name = "title"> title </param>
- Public void confirfmsgforok (string content, String title)
- {
- MessageBox. Show (content, title, messageboxbutton. OK );
- }
- /// <Summary>
- /// Message prompt box with "OK" and "cancel" buttons. No return value
- /// </Summary>
- /// <Param name = "content"> message content </param>
- /// <Param name = "title"> title </param>
- Public void confirfmsgforokcancel (string content, String title)
- {
- MessageBox. Show (content, title, messageboxbutton. okcancel );
- }
- /// <Summary>
- /// Use the fade-in and fade-out dialog box of the coding4fun component. No return value
- /// </Summary>
- /// <Param name = "content"> message content </param>
- /// <Param name = "title"> title </param>
- /// <Param name = "timeout"> displays the message expiration time. Unit: milliseconds </param>
- Public void coding4funformsg (string content, String title, int timeout)
- {
- Solidcolorbrush white = new solidcolorbrush (colors. White );
- Solidcolorbrush Red = new solidcolorbrush (colors. Brown );
- Toastprompt toast = new toastprompt
- {
- Background = red,
- Istimerenabled = true,
- Isappbarvisible = true,
- Millisecondsuntilhidden = timeout,
- Foreground = white,
- };
- Toast. Title = title;
- Toast. Message = content;
- Toast. textorientation = system. Windows. Controls. Orientation. horizontal;
- Toast. Show ();
- }
- }
- }