我想使用Windows Phone 8.1的保存约会任务。 我可以选择保存Windows Phone 8的预约任务,如下所示
SaveAppointmentTask saveAppointmentTask = new SaveAppointmentTask();
saveAppointmentTask.StartTime = timeconversion.AddMinutes(-10);
saveAppointmentTask.Location = sharingProgramTime; // appointment location
saveAppointmentTask.Subject = sharingProgramName; // appointment subject
saveAppointmentTask.Details = sharingProgramName + sharingProgramTime; // appointment details
saveAppointmentTask.IsAllDayEvent = false;
saveAppointmentTask.Reminder = Reminder.TenMinutes;
saveAppointmentTask.AppointmentStatus = Microsoft.Phone.UserData.AppointmentStatus.Busy;
saveAppointmentTask.Show();
如上所述,如何在Windows Phone 8.1中实现保存约会任务。任何有关这方面的帮助将不胜感激
答案 0 :(得分:1)
当您从Silverlight迁移到Windows运行时,您需要更改为使用AppointmentManager
class
有a sample in the documentation,但您的代码大致相当于:
private async void Add-Click(object sender, RoutedEventArgs e)
{
// Create an Appointment that should be added the user's appointments provider app.
var appointment = new Windows.ApplicationModel.Appointments.Appointment();
appointment.StartTime = timeconversion.AddMinutes(-10);
appointment.Location = sharingProgramTime; // appointment location
appointment.Subject = sharingProgramName; // appointment subject
appointment.Details = sharingProgramName + sharingProgramTime; // appointment details
appointment.IsAllDayEvent = false;
appointment.Reminder = new TimeSpan(0,10,0); // Ten minutes
appointment.BusyStatus = AppointmentBusyStatus.Busy;
// Get the selection rect of the button pressed to add this appointment
var rect = GetElementRect(sender as FrameworkElement);
// ShowAddAppointmentAsync returns an appointment id if the appointment given was added to the user's calendar.
// This value should be stored in app data and roamed so that the appointment can be replaced or removed in the future.
// An empty string return value indicates that the user canceled the operation before the appointment was added.
String appointmentId = await Windows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync(
appointment, rect, Windows.UI.Popups.Placement.Default);
}