开发者

Alarm feature in Windows Phone 7

I am trying to controll the snooze and dismiss button when the alarm sound in windows phone 7.

But i couldnt find any source code example on it.

Can anyone help me with it?

What i want is like when i clicked on the snooze or dimiss button it will do something such as the dismiss button will naviagte to another page.

And one more thing is that when the alarm is triggered can i set it to play some music?? Because the one that i have tried out does not play any music.

    private static void CreateAlarm(string title, string time)
    {
        var alarm = new Alarm(title)
        {
            Content = "You have a meeting with your team now.",
            BeginTime = Convert.ToDateTime(time),                 
        };

        ScheduledActionService.Add(alarm);
    }

    private static void ResetAlarm()
    {
        Sched开发者_如何学CuledActionService.Remove("MyAlarm");
    }

    private void SetAlarm_Click(object sender, RoutedEventArgs e)
    {
        string time = Convert.ToString(timePicker1.ValueString);
        CreateAlarm(txtTitle.Text, time);

    }

    private void ResetAlarm_Click(object sender, RoutedEventArgs e)
    {
        ResetAlarm();
    }
}


The Alarm class has a .Sound property to controls the sound file that is played.

To use it, say you have Alarm.mp3 in your project under the Sounds folder with it's build action set to Content.

var alarm = new Alarm() {
  Sound = new Uri('Sounds/Alarm.mp3', UriKind.Relative)
}

There is no way to respond to snooze or dismiss that I have seen.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜