2016-07-02 4 views
1

테스트 앱을 만들었고 토스트 알림을 통해 앱을 시작할 수는 있지만 실제 앱에서는 작동하지 않습니다. ???토스트 알림에서 활성화하면 실행시 앱 충돌이 발생합니다.

내 메인 페이지에는 2 개의 프레임이있는 페이지로 이동하는 프레임이 있습니다. Toast Notification (토스트 알림)을 클릭하면 두 번째 프레임에 특정 페이지가로드되기를 원합니다.

여기에 그냥 벌금 OnActivated에서 작동하는 내 OnLaunched 코드

 protected override void OnLaunched(LaunchActivatedEventArgs e) 
    { 

     Frame rootFrame = Window.Current.Content as Frame; 

     // Do not repeat app initialization when the Window already has content, 
     // just ensure that the window is active 
     if (rootFrame == null) 
     { 
      // Create a Frame to act as the navigation context and navigate to the first page 
      rootFrame = new Frame(); 

      rootFrame.NavigationFailed += OnNavigationFailed; 

      if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) 
      { 
       //TODO: Load state from previously suspended application 
      } 

      // Place the frame in the current Window 
      Window.Current.Content = rootFrame; 
     } 

     // Otherwise an action is provided 
     if (e.Arguments != "") 
     { 
      rootFrame.Navigate(typeof(MainPage)); 
      FramePage.Instance.setSecondFrame("Email"); 
     } 
     else 
     { 
      if (rootFrame.Content == null) 
       rootFrame.Navigate(typeof(MainPage)); 
     } 

     // Ensure the current window is active 
     Window.Current.Activate(); 

입니다. 어떤 아이디어?

+0

Microsoft에 문의 해보십시오. 때로는 휴대 전화와 Windows PC에서 모두 자신의 앱과 관련하여 문제가 있었기 때문에 문의하십시오. –

답변

3

게시 한 코드를 작성하면 OnLaunched 방법으로 축배 알림에서 활성화를 처리하고있는 것으로 보입니다. ToastNotification을 - 건배 (또는 토스트 내부 작업을) 전경 활성화를 트리거 할 때, OnActivated 새로운 정품 인증 종류, 대신 OnLaunched의 호출되도록 그러나

윈도우 10에서, Microsoft는 토스트 활성화 동작을 업데이트했습니다. 따라서 우리는 토스트 활성화를 쉽게 구별하고 이에 따라 작업을 수행 할 수 있습니다.

적응 형 템플릿과 사용자 지정 동작이 추가 된 Windows 10에는 응용 프로그램에서 처리해야 할 3 가지 종류의 정품 인증이 있습니다.

  1. Windows 10 적응 형 템플릿을 사용하여 토스트 알림에서 전경 활성화.
  2. Windows 10 적응 형 템플리트를 사용하여 토스트 알림에서 백그라운드 활성화.
  3. 레거시 : 레거시 템플리트를 사용하여 축배 알림에서 포어 그라운드 활성화.

첫 번째 종류의 경우 OnActivated method이 아닌 OnLaunched method을 재정 의하여 처리해야합니다. 레거시 템플릿을 사용하는 경우에만 활성화를 처리하려면 OnLaunched 메서드를 사용해야합니다. 그러나 새로운 Windows 10 범용 응용 프로그램을 개발하는 경우 새로운 적응 형 템플릿을 사용하는 것이 좋습니다.

모든 기존 토스트 템플릿은 새로운 적응 형 템플릿을 사용하여 쉽게 얻을 수 있습니다. 새로운 적응 형 템플릿을 사용하면 일관된 방식으로 토스트 활성화를 처리 할 수 ​​있습니다.

더 많은 정보 Quickstart: Sending a local toast notification and handling activations from it (Windows 10)에 토스트 알림에서 활성화를 처리 참조하십시오. 또한 code sample on GitHub도 있습니다.