Monitoring pal Windows Phone 7 Client

Source: Internet
Author: User

Cloudmonitor is an excellent server monitoring service in China. It supports HTTP, ping, DNS, FTP, SMTP, Pop, IMAP, TCP, etc, the SNMP protocol is also used to monitor server performance and capacity. It supports various servers, including Linux, windows, BSD, Mac, Solaris, And Aix. It also supports service layer monitoring, including Apache, Lighttpd, nginx, and MySQL. Wpmind naturally uses this service to monitor the service status of the website at all times, so as to better serve the readers.

On the fifth mobiledev day in May 22, I showed you a monitoring client based on Windows Phone 7. You can use it on your Windows Phone 7 mobile phone (of course... Please wait for at least half a year, and now you can only use simulators) to monitor the running status of your server. TheProgramThe API provided by monitoring Bao is used to obtain the server status information.

To use this API, we only need to pay attention to two key points.

1. That is, the server data is obtained. We will use the WebClient object for asynchronous data acquisition. For a trial of WebClient objects, we can only use asynchronous loading on Windows Phone 7. Similarly, WebService can only be asynchronously loaded on Windows Phone 7. We also need to pay attention to the fact that basic authentication is also required for accessing the monitoring treasure API. RelatedCodeThe snippets are as follows:

Basic Identity Authentication:

Code snippet
  1. WC =New WebClient();
  2. StringUsername = GetUserName ();
  3. StringPassword = GetPassword ();
  4. StringUsernamepassword = username +":"+ Password;
  5. WC. Credentials =New Networkcredential(Username, password );
  6. WC. headers ["Authorization"] ="Basic"+Convert. Tobase64string (system. Text.Encoding. Utf8.getbytes (usernamepassword ));

For the data obtained by asynchronous loading, we bind the data directly to the interface list through XML to LINQ:

Code snippet
  1. VoidWcrefreshall_downloadstringcompleted (ObjectSender,DownloadstringcompletedeventargsE)
  2. {
  3. If(E. Error! =Null)
  4. {
  5. MessageBox. Show (E. Error. Message,"Error",Messageboxbutton. OK );
  6. Return;
  7. }
  8. XelementXmlallstatus =Xelement. Parse (E. Result );
  9. Console. Write (xmlallstatus. value );
  10. Statuslist. itemssource =FromTaskInXmlallstatus. Elements ("Task")
  11. Select New Taskstatus
  12. {
  13. Id = task. element ("Task_id"). Value,
  14. Name = task. element ("Task_name"). Value,
  15. Summary = task. element ("Task_summary"). Value,
  16. Type = task. element ("Task_type"). Value,
  17. Createtime = task. element ("Task_create_time"). Value,
  18. Frequency = task. element ("Frequency"). Value,
  19. Lastresponsetime = task. element ("Last_resp_time"). Value,
  20. Lastresponseresult = task. element ("Last_resp_result"). Value,
  21. Lastresponsestatus = task. element ("Last_resp_status"). Value,
  22. Checktime = task. element ("Last_check_time"). Value,
  23. Tag = task. element ("Task_id"). Value +","+ Task. element ("Task_name"). Value
  24. };
  25. }

2. Of course, in addition to viewing the current system status, it can also view the status curve so that you can understand the server's response changes. Currently, there is no line chart control in the SDK for Windows Phone 7. Here I use a control transplanted by someone else based on the Silverlight toolkit. Of course, if you want to have other controls, you can use:

PairSource codeInterested friends, please go to the Forum to download: http://bbs.wpmind.com/thread-267-1-1.html

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.