2014-04-14 3 views
0

WP 8 앱에 푸시 알림 서비스에 등록했습니다.ShellToastNotificationReceived UI를 변경할 수 없습니다.

토스트 알림으로 포 그라운드에서 실행 내 애플이 업데이트 occut 때 토스트 알림으로 배경에서 실행 내 응용 프로그램은이

의 반면에 MVVM뿐만 아니라 보기 (UI)뿐만 아니라 업데이트 받았을 때 만 토스트 위의 이벤트가 발생되어 발생하는 내가 수동으로 페이지

pushChannel.ShellToastNotificationReceived += new EventHandler<NotificationEventArgs>(PushChannel_ShellToastNotificationReceived); 

를 새로 고칠 때 MVVM 그 순간에 UI를 업데이트 할 수 없습니다, 그것은 업데이트 할 수 있습니다

코드 :

/// <summary> 
    /// this method runs when user Click to the incoming toast 
    /// </summary> 
    /// <param name="sender"></param> 
    /// <param name="e"></param> 
    void PushChannel_ShellToastNotificationReceived(object sender, NotificationEventArgs e) 
    { 

     ApplicationSetting _App = new ApplicationSetting(); 
     _App.Load_TaskRefresh(); 
    } 
+0

Model/ViewModel에 INotifyPropertyChanged를 구현 했습니까? – csharpwinphonexaml

+0

예 ........................ –

+0

더 많은 코드를 게시 할 수 있습니까? – csharpwinphonexaml

답변

0

나는 UI 스레드에서 ShellToastNotificationReceived 이벤트가 발생하지 않는다고 생각합니다. 따라서 UI 변경 사항이 필요한 내부의 모든 항목은 운영자의 안내에 따라 처리해야합니다. 이 같은 시도 할 수 있습니다 ". 대상 앱이 포 그라운드에서 실행 중일 때 8 업데이트 3, 토스트 알림이 표시되지 윈도우 폰없이 장치에"

Deployment.Current.Dispatcher.BeginInvoke(() => { 
    ApplicationSetting _App = new ApplicationSetting(); 
    _App.Load_TaskRefresh(); 
}); 
+0

친구 없음, 작동하지 않음 –

0

link 여기 을 말한다을, 어쨌든 토스트 알림은 이미 앱에서 사용자 정의 메시지가 포 그라운드에 없을 때주의를 환기시키는 것입니다.