메뉴 건너뛰기

app

[WP7] 앱 설정 tip 2가지와 현재 위치 가져오기

suritam92013.03.03 08:34조회 수 2083댓글 0

    • 글자 크기

1. 시스템 트레이 가리기로 풀 스크린 모드 사용


MainPage.xaml 에 


shell:SystemTray.IsVisible="False"


위의 부분을 설정해 준다.


기본적으로 True로 되어 있어서 배터리나 안테나 정보를 보여주는데 필요 없을 경우는 가려준다.


2. 기본 출력을 가로 모드로 하기


SupportedOrientations="Landscape" Orientation="Landscape"




현재 위치를 가져와 지도에 설정하는 방법은 아래와 같다.

using System.Device.Location;


        public MainPage()

        {


            InitializeComponent();

             // GPS init

                watcher = new GeoCoordinateWatcher();

                watcher.MovementThreshold = 20;

                watcher.PositionChanged += new EventHandler<GeoPositionChangedEventArgs<GeoCoordinate>>(watcher_PositionChanged);

                watcher.Start();

.......................

}


         void watcher_PositionChanged(object sender, GeoPositionChangedEventArgs<GeoCoordinate> e)

            {

                //throw new NotImplementedException();

                // non-UI thread 에서 실행되므로 UI thread 와의 연동을 위해 Dispatcher를 사용

                Deployment.Current.Dispatcher.BeginInvoke(() => MyPositionChanged(e));

            }

     

            void MyPositionChanged(GeoPositionChangedEventArgs<GeoCoordinate> e)

            {

                // throw new NotImplementedException();

                Double a = e.Position.Location.Latitude;

                Double b = e.Position.Location.Longitude;


                GeoCoordinate mapCenter = new GeoCoordinate(a, b);

                bloodMap.SetView(mapCenter, 13);

                //MessageBox.Show("My lat long is:"+a+", "+b);

                watcher.Stop(); // for battery issue

            }

suritam9 (비회원)
    • 글자 크기
[WP7] 전역변수의 array(dicionary)와 map의 pushpin 제어하기 (by suritam9) [WP7] 애플리케이션바 제어하기, pushpin icon (by suritam9)

댓글 달기

suritam9
2012.06.22 조회 2448
suritam9
2012.06.24 조회 2403
suritam9
2012.06.24 조회 2580
suritam9
2012.06.24 조회 2235
suritam9
2012.09.14 조회 2387
suritam9
2013.04.04 조회 2018
suritam9
2013.04.25 조회 5867
이전 1 ... 4 5 6 7 8 9 10 11 12 13 14다음
첨부 (0)
위로