2013-02-13 73 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(); 
     } 

感谢

回答