0

タイマーが 0 に達したときに通知を表示する単純な Windows 8 アプリケーションがあります。APP がバックグラウンドにある場合にのみ、これらの通知を表示したいと考えています。

どうすればそれを確認できますか?

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();
        }

ありがとう

4

1 に答える 1