Windows8 App2013. 7. 5. 11:23

 

 

void detectScreenType()
 {
     double dpi = DisplayProperties.LogicalDpi;
     var bounds = Window.Current.Bounds;
     double h;
     switch (ApplicationView.Value)
     {
         case ApplicationViewState.Filled:
             h = bounds.Height;
             break;
 
         case ApplicationViewState.FullScreenLandscape:
             h = bounds.Height;
             break;
 
         case ApplicationViewState.Snapped:
             h = bounds.Height;
             break;
 
         case ApplicationViewState.FullScreenPortrait:
             h = bounds.Width;
             break;
 
         default:
             return;
     }
     double inches = h / dpi ;
     string screenType = "Slate";
     if (inches < 10)
     {
         screenType = "Slate";
     } else if (inches < 14) {
         screenType = "WorkHorsePC";
     }
     else 
     {
         screenType = "FamilyHub";
     }
     ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
     localSettings.Values["screenType"] = screenType;
 }

 

머 거창해 보이지만 실제로는

 

var bounds = Window.Current.Bounds;

 

이렇게만 얻어오면 된다.

 

참조 : http://stackoverflow.com/questions/10828179/how-to-get-the-resolution-of-screen-for-a-winrt-app

'Windows8 App' 카테고리의 다른 글

TextBlock에서 라인 띄우는 법  (0) 2013.11.22
T Generic 리턴하기  (0) 2013.10.15
[winrt] dispatcher의 활용  (0) 2013.07.23
[windows8] 셋팅 페이지 보이게 하기  (0) 2013.07.11
[win8] 윈8 앱 종료 이벤트  (0) 2013.06.17
Posted by 동동(이재동)