Beispiel #1
0
        private async void AddButton_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Appointment appointment = new Appointment();
                appointment.Subject = string.Format(CultureInfo.CurrentCulture,
                                                    LocalizableStrings.CALENDAR_APPOINTMENT_SUBJECT, newAppointmentCount++);
                appointment.StartTime = DateTime.Now.AddHours(1);
                appointment.Duration  = TimeSpan.FromHours(1);
                appointment.Location  = LocalizableStrings.CALENDAR_APPOINTMENT_LOCATION;
                appointment.Details   = LocalizableStrings.CALENDAR_APPOINTMENT_DETAILS;

                string appointmentId = await appointmentStore.ShowAddAppointmentAsync(appointment, new Rect());

                if (!string.IsNullOrEmpty(appointmentId))
                {
                    status.Log(LocalizableStrings.CALENDAR_APPOINTMENT_ADD_SUCCESS);
                    ShowAllAppointments();
                }
                else
                {
                    status.Log(LocalizableStrings.CALENDAR_APPOINTMENT_ADD_FAIL);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("CalendarPage.AddButton_Click: " + ex.ToString());
                status.Log(ex.GetType().ToString());
            }
        }