Windows Phone 18, Compass

Source: Internet
Author: User

magnetometer Overview

Devices with magnetometer hardware support can determine the angle relative to the Arctic according to the magnetometer

The magnetometer access API is defined in the Compass class

Call mode is similar to the accelerometer

1     <GridBackground= "White">2         <ImageSource= "Compass.png"Rendertransformorigin= "0.5,0.5">3             <Image.rendertransform>4                 <Compositetransformx:name= "Rotate"Rotation= "1"/>5             </Image.rendertransform>6         </Image>7     </Grid>
1         protected Override voidonnavigatedto (NavigationEventArgs e)2         {3Compass C =Compass.getdefault ();4             if(c = =NULL)5             {6                 //Compass not supported7                 return;8             }9C.readingchanged + =Async(P1, p2) =Ten             { One                 //Modify the rotation angle of the picture; A System.Diagnostics.Debug.WriteLine (p2. Reading.HeadingTrueNorth.Value); -                 await  This. Dispatcher.runasync (Windows.UI.Core.CoreDispatcherPriority.Normal, () = -                 { theRotate. Rotation =-P2. Reading.HeadingTrueNorth.Value; -                 }); -             }; -C.reportinterval = C.minimumreportinterval *Ten; +}

Windows Phone 18, Compass

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.