2013-02-13 78 views
0

我有一個簡單的Windows 8應用程序,當定時器達到0時顯示通知。 現在我希望這些通知僅在APP出現在背景上時顯示。背景通知+ Windows 8

我該如何檢查?

protected void Back_Tick(object sender, object e) 
     { 
      if (stageSequence.Current.RemainningTime == TimeSpan.Zero) 
      { 
       if(stageSequence.MoveNext() == true) 
       { 
        var typeOfNotification = TypeOfNotification.EndOfStage; 
        // Check If it is on background 
        ToastAlarmNotification(lblStage.Text, typeOfNotification); 
        lblStage.Text = stageSequence.Current.Name; 
        lblTime.Text = stageSequence.Current.RemainningTime.ToString(); 
        mediaElementEndOfStage.Play(); 
       } 
       else 
       { 
        var typeOfNotification = TypeOfNotification.EndOfStage; 
        dispatcherTimer.Stop(); 
        // Check If it is on background 
        ToastAlarmNotification(lblStage.Text, typeOfNotification); 
        typeOfNotification = TypeOfNotification.EndOfList; 
        ToastAlarmNotification(lblStage.Text, typeOfNotification); 
        mediaElementFinal.Play(); 
        return; 
       } 
      } 

      stageSequence.Current.RemainningTime = stageSequence.Current.RemainningTime.Subtract(TimeSpan.FromSeconds(1)); 
      lblTime.Text = stageSequence.Current.RemainningTime.ToString(); 
     } 

感謝

回答