Source code and ideas of a WP7 mobile app-yqball live video schedule

Source: Internet
Author: User
Document directory
  • The data requirement of this application is: we need to collect data from the Network (web page) as the data of our mobile phone program.
  • Will someone directly access the "target page" in the mobile phone program and then present the data after various regular expressions?
  • The practice here is:
  • Presentation of data by the WP7 client:
Preview

Background

This is a small application I made for myself when I first started WP7 at the beginning of the year. At that time, I wanted to check whether I could try different career directions (windowsphone mobile phone Development) while playing on my own. After all, windowsphone Mobile Phone development is still a new industry. Then... In less than a month, I gave up WP7 and switched to mvc3. Nearly half a year has passed, and now I have yqblog and yqcms. Although mvc4 is also available, compared with WP7 to WP8, I think it is right to give up at that time.

The general process of this small application is as follows:Web servers collect Network Data ---> Format as JSON data ---> WP7 client applications remotely obtain the data in JSON format ---> Rendering

The program that first collected data was written using webform, and then started to get MVC, so all the programs on the Web server were cleared. This small software has been quietly stuck in my cell phone, without any data updates. The current international situation is that the five major European league matches have successively started the new season. The NBA Preseason is also about to kick off, and the Champions League is also in full swing. So it's time to let this "sports event live timetable" be full of blood and revived. As a result, I sorted out the previous Code and changed the web-side collection to an mvc3 version. I will share it with you here.

Introduction

If I give myself a comment, it will be like this, Application> idea> program itself

1. Program

This is because WP7 lacks relevant knowledge and development experience. I learned it less than a month before and after work. I believe that the code is terrible. However, I still want to describe some of the knowledge points involved in the program, which is a reference value for beginners.
Web Part: Regular Expression "collect" webpage data. JSON serialization/deserialization, page generation.
WP7: obtains network data, jumps between pages, appliationbar, data binding, lifecycle control, and read/write of independent buckets.

2. Train of Thought: we need to collect data from the Internet (web page) as the data of our mobile phone program. Will someone directly access the "target page" in the mobile phone program and then present the data after various regular expressions?

The disadvantages of doing so are:

  1. Traffic fee, directly access the target page, you need to download the source code of the entire page, this volume is very large. Take my collection object for example, the page source code size is nearly 200 K.
  2. Slow speed
  3. The critical hidden danger caused by the change of the target. For example, a well-known website has a dispute between. CC and. com domain names. Or if the target page is greatly revised, your program will immediately become a zombie.
The practice here is:

A web program is used as an intermediary to collect and output formatted data.

Collect data (dynamic page): http://www.yqhome.net/ball/schedule
The collected data is also the source of our WP7 client: http://www.yqhome.net/content/schedule.html (less than 30 K)
Data processing on the WP7 client:

  1. Remote Acquisition of http://www.yqhome.net/content/schedule.html page data
  2. Save to an independent Bucket
  3. Read and present data from an independent bucket.

The relationship between the three is as follows:

            string scheduleData = ReadIsolatedStorageFile("schedule.txt");            if (scheduleData.Trim() == "")                GetWebData(webUrl);            else                ViewData(scheduleData);

Based on this process, the web page will be accessed only when the program is opened for the first time, resulting in network traffic, because scheduledata. Trim () = "". The next step is not to access the network, but to directly display the data in the independent storage space of the mobile phone.

If you need to update data in a timely manner. Click "refresh" to generate network traffic again. Refresh data:

        public void RefreshData()        {           GetWebData(webUrl);        }

Advantages:

  1. Reduce Traffic and directly access the target page. The larger the size of a page is, the smaller the size of the formatted JSON data is than 30 kb. At the same time, the traffic is basically generated by the user's active behavior. The program runs without potential traffic.
  2. If no network exists, you can also browse it offline.
  3. Strong reliability. The data required by mobile phone programs is for the interface interfaces of http://www.yqhome.net/content/schedule.html. You don't have to worry about data sources, data collection details, and so on. We only need to ensure that the data on this page is stable. If website a has changed, I will update the collection rules. Website A has closed down and I cannot collect website B. I have already entered the Rules manually.
Presentation of data by the WP7 client:

The WP7 end adopts the scheme to present data. For the data collected currently, there will be more than one month of competition forecast information each time. According to a single upload item every day, there will be 3 to 40 items for all presentations. This will undoubtedly lead to a very low loading efficiency for the pipeline. Here I have added the itemcount parameter. To control the maximum number of items displayed by limit. The default value is 10, which is the program forecast information for a maximum of 10 days. You can also change it in the program as needed.
Another constraint is to only display the data after "three hours before the current time. The program information of the past time is no longer displayed. In three hours, you should finish playing football or basketball. This constraint also makes the user feel that the application is giving data dynamically.

The idea of implementing the entire program is probably like this, and the self-feeling is still successful. The last step is the application.

3. Application

As a fan, I often want to know What matches are there tonight and what matches are there on weekends at unpredictable times and places? How many times does Manchester United play this week on Saturday or Saturday? You said you can open the UC browser to check the website,
However, yqball is undoubtedly the most direct and simple way. Besides, it can be used offline. In short, it's not bad, it's quite helpful.

Improvement

I think the following improvements can be made:

  1. Improvement in appearance
    You can set the background, font color, or change the image background.
  2. Functional improvements
    (1) You can filter the program information, such as football, basketball, tennis, NBA, and football. You can configure the display of content that he is interested in.
    (2) implement the follow reminder function. For example, you can set a future game as "follow ". Then, a "Reminder" will be given to the user before a certain period of time that the game is about to begin ".
  3. Design Improvements
    Currently, only the competition forecast information is provided. The time attribute of the past game is not so important, but more importantly, the score attribute. The audience of "Program Notice" is basically fans who love watching the ball. "Instant score information" will also attract those who don't watch the ball, but buy the ball, thus expanding the application audience.
Download

Source code and mobile app installation package

Deployment

Appendix: xap Application Deployment tutorial

 

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.