Implementation of Windows phone Beijing Metro software

Source: Internet
Author: User
Tags split visual studio visual studio 2010

Beijing's subway line has added a few, but Windows Phone software update is not to force, many lines are not. That's the only thing you can do. The effect of doing well is shown below:

Software Description:

Development tool: Visual Studio 2010 where the pop-up has a codig4fun third-party control.

Support drag-and-drop map location, query site location, query all lines and all sites, scale map size and other functions.

Subway line and site information stored in the XML file, if added new lines, in the XML to add new lines and all site information, software can automatically draw a new line in the interface.

See more highlights of this column: http://www.bianceng.cnhttp://www.bianceng.cn/OS/extra/

Main code Description:

1.XML file:<lines> node declares all metro lines and colors,<nodes> include site name, site coordinates, and line information.

<SubWay>
  <Lines>
    <line name= "line Line 1" color= "255, 255, 0, 0"/> <line name=
    "line Line 2" Color= "255, 0, 183"  /> <line name=
    "line Line 4" color= "255, 0, 255, 255"/>
    <.....>
  </Lines>
  <nodes name= "line Line 4" >
    <node name= "an river bridge North" x= " -15" y= "450" linename= "line Line 4" >
    < /node>
    <node name= "North Palace" x= "y=" "450" linename= "line Line 4" >
    </Node>
    <node name= "Xiyuan" x= " y= "450" linename= "line Line 4" >
    <.....>
  </nodes name= "line Line 4" >
</Lines>

2. Reading of data:

Read the color:

<summary>
        ///Converts a string description of color in XML to a color type
        ///</summary>
        ///<param name= "s" >< /param>
        ///<returns></returns> public
        Color GetColor (string s)
        {
            byte B1 = byte. Parse (S.split (', ') [0]);
            byte B2 = byte. Parse (S.split (', ') [1]);
            byte B3 = byte. Parse (S.split (', ') [2]);
            byte b4 = byte. Parse (S.split (', ') [3]);
            Color MyColor = Color.FromArgb (B1, B2, B3, B4);
            return mycolor;
        }

Site Information read: (with LINQ, where subnode is the site class, including site name name, site coordinates point, site-owned node Linename)

Gets the site collection
                    var nodes = from S in root. Elements ("Nodes"). Elements ("Node")
                              select New subnode                              
                              {
                                  name = S.attribute ("Name"). Value,
                                  point=new Point (double). Parse (S.attribute ("X"). Value), double. Parse (S.attribute ("Y"). Value)),
                                  linename=s.attribute ("Linename"). Value
                              };
    
                    Listsubnode = nodes. Tolist<subnode> ();

3. View all lines and the sites they contain: This binds the Metro collection to the control and displays the information as the site name

<combobox x:name= "Cobline" itemssource= "{Binding}" margin= 12,12,295,29 "selectionchanged=" Cobline_ SelectionChanged ">
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <textblock text=" { Binding Name} "></TextBlock>
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ Combobox>

At last:

Software still has a lot of deficiencies, because the time is hasty many places of implementation is not very good, such as pop-up form search site I want to use Autocompletebox to implement smart prompts, but by the Codig4fun control effect is not good (this I put in the "settings"); Scaling the map and then querying for a site location will not be accurate; Set the location of a site name separately based on layout.

Code Download: Http://files.cnblogs.com/infly123/PhoneSubWay.rar

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.