通过c#代码打开windows phone 8的windows日历
本文关键字:windows phone 日历 代码 通过 | 更新日期: 2023-09-27 18:11:17
一旦用户按下按钮,我想通过c#代码打开windows 8日历。可以打开日历吗?如果是这样,如何实现这一目标?
提前感谢:)
如果你有一个Windows Phone应用程序,其中有一个名为ButtonAppointments的按钮页面。
private void ButtonAppointments_Click(object sender, RoutedEventArgs e)
{
Appointments appts = new Appointments();
//Identify the method that runs after the asynchronous search completes.
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
DateTime start = DateTime.Now;
DateTime end = start.AddDays(7);
int max = 20;
//Start the asynchronous search.
appts.SearchAsync(start, end, max, "Appointments Test #1");
}
void Appointments_SearchCompleted(object sender, AppointmentsSearchEventArgs e)
{
//Do something with the results.
MessageBox.Show(e.Results.Count().ToString());
}
引自:How to access calendar data for Windows Phone 8
试试这个
private void ButtonAppointments_Click(object sender, RoutedEventArgs e)
{
Appointments appts = new Appointments();
appts.SearchCompleted += new EventHandler<AppointmentsSearchEventArgs>(Appointments_SearchCompleted);
DateTime start = DateTime.Now;
DateTime end = start.AddDays(7);
int max = 10;
//Start the asynchronous search.
appts.SearchAsync(start, end, max, "Appointment");
}
还可以添加这个来显示结果
MessageBox.Show(e.Results.Count().ToString());