public async Task <bool> AddAppointment(DataAgendaTelefoon agendaAfspraak) { var appointmentRcd = new Windows.ApplicationModel.Appointments.Appointment(); var date = agendaAfspraak.AgendaDatum; var time = agendaAfspraak.AgendaTijd; var timeZoneOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); var startTime = new DateTimeOffset(date.Year, date.Month, date.Day, time.Hours, time.Minutes, 0, timeZoneOffset); appointmentRcd.StartTime = startTime; // Subject appointmentRcd.Subject = agendaAfspraak.Titel; // Location appointmentRcd.Location = agendaAfspraak.WaarEnWanneer; // Details appointmentRcd.Details = agendaAfspraak.Beschrijving; // Duration appointmentRcd.Duration = TimeSpan.FromHours(1); // All Day appointmentRcd.AllDay = false; //Busy Status appointmentRcd.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.Busy; // Sensitivity appointmentRcd.Sensitivity = Windows.ApplicationModel.Appointments.AppointmentSensitivity.Public; Rect rect = new Rect(new Windows.Foundation.Point(10, 10), new Windows.Foundation.Size(100, 200)); string retVal = await AppointmentManager.ShowAddAppointmentAsync(appointmentRcd, rect, Windows.UI.Popups.Placement.Default); return(!string.IsNullOrEmpty(retVal)); }
public async void SaveWorkoutAsync(string workoutName, DateTime timeOfWorkout) { var appointment = new Windows.ApplicationModel.Appointments.Appointment() { StartTime = timeOfWorkout, Subject = workoutName }; await AppointmentManager.ShowEditNewAppointmentAsync(appointment); }
private static Windows.ApplicationModel.Appointments.Appointment getAppointment(Lecture l) { var a = new Windows.ApplicationModel.Appointments.Appointment(); a.Subject = l.summary; a.Location = l.location; a.StartTime = DateTime.Parse(l.dtstart); a.Duration = DateTime.Parse(l.dtend) - a.StartTime; a.DetailsKind = AppointmentDetailsKind.PlainText; a.Details = l.description; a.AllDay = false; a.BusyStatus = AppointmentBusyStatus.Free; return(a); }
private static Windows.ApplicationModel.Appointments.Appointment getAppointment(Deadline e) { var a = new Windows.ApplicationModel.Appointments.Appointment(); Regex re = new Regex("&[^;]+;"); a.Subject = re.Replace(e.name, " "); a.Location = re.Replace(e.course, " "); a.StartTime = DateTime.Parse(e.ddl + " 23:59"); a.AllDay = false; a.BusyStatus = e.hasBeenFinished? AppointmentBusyStatus.Free: AppointmentBusyStatus.Tentative; if (e.hasBeenFinished) { a.Reminder = null; } else { a.Reminder = TimeSpan.FromHours(6); } a.Details = e.id; return(a); }
private static Windows.ApplicationModel.Appointments.Appointment getAppointment(Event e) { var a = new Windows.ApplicationModel.Appointments.Appointment(); a.Subject = e.nr; a.Location = e.dd; a.StartTime = DateTime.Parse(e.nq + " " + e.kssj); a.Duration = DateTime.Parse(e.nq + " " + e.jssj) - a.StartTime; // 修正考试时间 12 小时制 if (e.fl == "考试") { if (a.StartTime.Hour < 8) { a.StartTime += TimeSpan.FromHours(12); } a.Subject += "考试"; } a.AllDay = false; return(a); }
public async Task <bool> SaveAppointment(CalendarDetails calendar, DateTime dateTime, string title, string Description, string location = "") { var appointment = new Windows.ApplicationModel.Appointments.Appointment(); appointment.StartTime = dateTime; appointment.Duration = TimeSpan.FromHours(1); appointment.Location = location; appointment.Subject = title; appointment.Details = Description; Rect rect = new Rect(new Point(10, 10), new Size(100, 200)); try { String appointmentId = await Windows.ApplicationModel.Appointments.AppointmentManager.ShowEditNewAppointmentAsync(appointment); return(!string.IsNullOrEmpty(appointmentId)); } catch (Exception ex) { return(false); } }
private async void addApointment(object sender) { Appointment appointment = new Windows.ApplicationModel.Appointments.Appointment(); appointment.Subject = this.name; appointment.Location = this.location; int month = Array.IndexOf(months, con.month); month++; appointment.StartTime = new DateTimeOffset(new DateTime(Convert.ToInt32(con.year), month, con.days[0])); try { await Windows.ApplicationModel.Appointments.AppointmentManager.ShowEditNewAppointmentAsync(appointment); } catch(Exception ex) { System.Diagnostics.Debug.Write(ex); } }
private async void addCalButton_Click(object sender, RoutedEventArgs e) { clientName = clientNameTextBox.Text; venueName = venueNameTextBox.Text; clientNotes = clientNotesTextBox.Text; startDate = startDatePicker.Date.ToString("D"); startTime = startTimePicker.Time.ToString(@"hh\:mm"); totalHours = endTimePicker.Time - startTimePicker.Time; if (totalHours < TimeSpan.FromDays(0)) { totalHours += TimeSpan.FromDays(1); } var cal = new Windows.ApplicationModel.Appointments.Appointment(); var date = (DateTimeOffset)startDatePicker.Date; var time = (TimeSpan)startTimePicker.Time; var timeZoneOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); var calTime = new DateTimeOffset(date.Year, date.Month, date.Day, time.Hours, time.Minutes, 0, timeZoneOffset); cal.StartTime = calTime; cal.Duration = totalHours; cal.Location = venueName; cal.Subject = clientName; cal.Details = "CrewOnCall::" + ((ComboBoxItem)skillPicker.SelectedItem).Content.ToString() +"\n" + clientNotes; cal.AllDay = false; cal.Reminder = TimeSpan.FromHours(2); String ID = await Windows.ApplicationModel.Appointments.AppointmentManager.ShowAddAppointmentAsync(cal, new Rect(), Windows.UI.Popups.Placement.Default); }
private static List <Windows.ApplicationModel.Appointments.Appointment> getAppointments(Semester s) { var l = new List <Windows.ApplicationModel.Appointments.Appointment>(); DateTime start = DateTime.Parse(s.startDate); if (start.DayOfWeek != DayOfWeek.Monday) { //TODO return(l); } DateTime end; if (s.endDate != null) { end = DateTime.Parse(s.endDate).AddDays(-1); if (end < start) { throw new Exception(); } } else { //try to auto-complete, assuming 18 weeks per semester if (s.semesterEname.IndexOf("Autumn") != -1 || s.semesterEname.IndexOf("Spring") != -1) { end = start.AddDays(18 * 7 - 1); } else { return(l); } } int i = 0; var day = start; while (233 > 0) { i++; if (day > end) { break; } var a = new Windows.ApplicationModel.Appointments.Appointment(); a.Subject = $"校历第{i}周"; a.Details = s.semesterEname .Replace("Summer", "夏季学期") .Replace("Spring", "春季学期") .Replace("Autumn", "秋季学期"); a.StartTime = day; a.AllDay = true; a.BusyStatus = AppointmentBusyStatus.Free; l.Add(a); day = day.AddDays(7); } return(l); }
public static async Task <String> GetResponse(string question) { //AIService aiService; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(URL); client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", clientAccessToken); string query = question; urlParameters += "?v=" + v + queryString + query + language + sessionId; HttpResponseMessage response = client.GetAsync(urlParameters).Result; string responseBody = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { dynamic json = JObject.Parse(responseBody); answer = json.result.fulfillment.speech; if ((string)json["result"]["action"] == "ScheduleEvent") { if ((string)json["result"]["parameters"]["startTime"] != null) { startTime = (string)json["result"]["parameters"]["startTime"]; } if ((string)json["result"]["parameters"]["endTime"] != null) { endTime = (string)json["result"]["parameters"]["endTime"]; } if ((string)json["result"]["parameters"]["title"] != null) { title = (string)json["result"]["parameters"]["title"]; } if ((string)json["result"]["parameters"]["date"] != null) { date = (string)json["result"]["parameters"]["date"]; } } if ((string)json["result"]["action"] == "getCalendarEvents") { if ((string)json["result"]["parameters"]["date"] != null) { date = (string)json["result"]["parameters"]["date"]; } } if ((bool)json["result"]["actionIncomplete"] == false && (string)json["result"]["action"] == "ScheduleEvent") { // Create an Appointment that should be added the user' s appointments provider app. var appointment = new Windows.ApplicationModel.Appointments.Appointment(); string dateTime = AiResponse.date + " " + AiResponse.startTime; DateTime myDate = DateTime.ParseExact(dateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) + TimeSpan.FromDays(1); appointment.StartTime = myDate; if (AiResponse.endTime != "") { DateTime dt = DateTime.Parse(endTime); endTime = dt.ToString("HH:mm"); string start = startTime.Substring(0, 2); string end = endTime.Substring(0, 2); int startT = Convert.ToInt32(start); int endT = Convert.ToInt32(end); int duration = endT - startT; appointment.Duration = TimeSpan.FromHours(duration); } else { appointment.Duration = TimeSpan.FromHours(1); } appointment.Subject = AiResponse.title; appointment.Reminder = TimeSpan.FromMinutes(20); String appointmentId = await AppointmentManager.ShowEditNewAppointmentAsync(appointment); //if (appointmentId != String.Empty) //{ // appoint = "Appointment Id: " + appointmentId; //} //else //{ // appoint = "Appointment not added."; //} } if ((bool)json["result"]["actionIncomplete"] == false && (string)json["result"]["action"] == "getCalendarEvents") { AppointmentStore appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly); //var dateToShow = DateTime.Now.AddDays(0); string dateT = AiResponse.date; DateTime myDate = DateTime.ParseExact(dateT, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) + TimeSpan.FromDays(0); var duration = TimeSpan.FromHours(24); var appCalendars = await appointmentStore.FindAppointmentsAsync(myDate, duration); } } urlParameters = ""; return(answer); }
private async void calendar_DoubleTapped(object sender, RoutedEventArgs e) { if (_calTask != null) { // if there is already opened task, cancel it first _calTask.Cancel(); _calTask.Close(); _calTask = null; } // show the list of appointments for the bolded day FrameworkElement fel = e.OriginalSource as FrameworkElement; if (fel != null) { DaySlot slot = fel.DataContext as DaySlot; if (slot != null) { DateTime date = slot.Date; string message = date.ToString(); if (slot.DataSource == null || slot.DataSource.Count == 0) { if (UseAppointmentManager) { // create new appointment and fill initial properties Windows.ApplicationModel.Appointments.Appointment app = new Windows.ApplicationModel.Appointments.Appointment(); app.StartTime = date; app.AllDay = true; app.Subject = Strings.DeviceAppointmentSubject; // Show the Appointments provider Add Appointment UI, to enable the user to add an appointment. // The returned id can be used later to edit or remove existent appointment. _calTask = AppointmentManager.ShowEditNewAppointmentAsync(app); string id = await _calTask; Refresh(calendar.DisplayDate); _calTask = null; return; } else { if (!Device.IsWindowsPhoneDevice()) { DataTemplate boldedDaySlotTemplate = this.Resources["BoldedDaySlotTemplate"] as DataTemplate; calendar.BoldedDaySlotTemplate = boldedDaySlotTemplate; Appointment app = new Appointment(); app.Start = calendar.SelectedDate; app.Duration = TimeSpan.FromDays(1); app.Subject = Strings.AppointmentSubject + " " + app.Start.ToString(); _appointments.Add(app); calendar.DataSource = _appointments; return; } else { message += "\r\n" + Strings.Message; } } } else { if (!UseAppointmentManager) { foreach (Appointment app in slot.DataSource) { message += "\r\n" + app.Subject; } } else { foreach (Windows.ApplicationModel.Appointments.Appointment app in slot.DataSource) { message += "\r\n" + app.Subject; } } var dialog = new MessageDialog(message); dialog.ShowAsync(); } } } }
public static async Task <String> GetResponse(string question) { //AIService aiService; HttpClient client = new HttpClient(); client.BaseAddress = new Uri(URL); //AppointmentStore appointmentStore; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", clientAccessToken); string query = question; urlParameters += "?v=" + v + queryString + query + language + sessionId; HttpResponseMessage response = client.GetAsync(urlParameters).Result; string responseBody = await response.Content.ReadAsStringAsync(); if (response.IsSuccessStatusCode) { dynamic json = JObject.Parse(responseBody); answer = json.result.fulfillment.speech; string temp = (string)json["result"]["parameters"]["createEvent"]; if (temp == "create" || temp == "make" || temp == "new" || temp == "put in" || temp == "add an" || temp == "put on" || temp == "I will be busy" || temp == "can I schedule" || temp == "I have an event") { if ((bool)json["result"]["actionIncomplete"] == false && (string)json["result"]["action"] == "ScheduleEvent") { if ((string)json["result"]["parameters"]["startTime"] != null) { startTime = (string)json["result"]["parameters"]["startTime"]; } if ((string)json["result"]["parameters"]["endTime"] != null) { endTime = (string)json["result"]["parameters"]["endTime"]; } if ((string)json["result"]["parameters"]["title"] != null) { title = (string)json["result"]["parameters"]["title"]; } if ((string)json["result"]["parameters"]["date"] != null) { date = (string)json["result"]["parameters"]["date"]; } var appointment = new Windows.ApplicationModel.Appointments.Appointment(); if (AiResponse.startTime == "in the morning" || AiResponse.startTime == "morning") { startTime = "08:00:00"; } else if (AiResponse.startTime == "in the afternoon" || AiResponse.startTime == "afternoon") { startTime = "12:00:00"; } else if (AiResponse.startTime == "in the evening" || AiResponse.startTime == "evening") { startTime = "17:00:00"; } else if (AiResponse.startTime == "night") { startTime = "20:00:00"; } string dateTime = AiResponse.date + " " + AiResponse.startTime; DateTime myDate = DateTime.ParseExact(dateTime, "yyyy-MM-dd HH:mm:ss", System.Globalization.CultureInfo.InvariantCulture) + TimeSpan.FromDays(1); appointment.StartTime = myDate; if (AiResponse.endTime != "") { DateTime dt = DateTime.Parse(endTime); endTime = dt.ToString("HH:mm"); string start = startTime.Substring(0, 2); string end = endTime.Substring(0, 2); int startT = Convert.ToInt32(start); int endT = Convert.ToInt32(end); int duration = endT - startT; appointment.Duration = TimeSpan.FromHours(duration); } else { appointment.Duration = TimeSpan.FromHours(1); } appointment.Subject = AiResponse.title; appointment.Reminder = TimeSpan.FromMinutes(20); String appointmentId = await AppointmentManager.ShowEditNewAppointmentAsync(appointment); } else if ((bool)json["result"]["actionIncomplete"] == false && (string)json["result"]["action"] == "getCalendarEvents") { if ((string)json["result"]["parameters"]["date"] != null) { date = (string)json["result"]["parameters"]["date"]; } AppointmentStore appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly); //var dateToShow = DateTime.Now.AddDays(0); string dateT = AiResponse.date; DateTime myDate = DateTime.ParseExact(dateT, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) + TimeSpan.FromDays(0); var duration = TimeSpan.FromHours(24); //appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly); var appCalendars = await appointmentStore.FindAppointmentsAsync(myDate, duration); //answer = appCalendars.ToString(); if (appCalendars.Count == 0) { answer = "You have no events on that date"; } else { answer += "\n"; foreach (var item in appCalendars) { string dur = ""; dur = item.Duration.TotalMinutes + " minutes"; answer += "Event Start Time: " + item.StartTime.LocalDateTime.TimeOfDay + "\nDuration: " + dur + "\n"; } } } } else { List <string> responses = new List <string>(); //answer = "I am not sure if I understand the question or request"; string four = "I am not sure if I understand the question or request"; string one = "I am a bit confused"; string two = " Not sure if I am understanding"; string three = "I did not understand that"; responses.Add(four); responses.Add(one); responses.Add(two); responses.Add(three); Random rnd = new Random(); int n = rnd.Next(0, 4); var value = responses.ElementAt(n); answer = value; urlParameters = ""; return(answer); } } urlParameters = ""; return(answer); }
private void btnExecuta_Click(object sender, RoutedEventArgs e) { bool isAppointmentValid = true; var appointment = new Windows.ApplicationModel.Appointments.Appointment(); // StartTime var date = StartTimeDatePicker.Date; var time = StartTimeTimePicker.Time; var timeZoneOffset = TimeZoneInfo.Local.GetUtcOffset(DateTime.Now); var startTime = new DateTimeOffset(date.Year, date.Month, date.Day, time.Hours, time.Minutes, 0, timeZoneOffset); appointment.StartTime = startTime; // Subject appointment.Subject = SubjectTextBox.Text; if (appointment.Subject.Length > 255) { isAppointmentValid = false; ResultTextBlock.Text = "The subject cannot be greater than 255 characters."; } // Location appointment.Location = LocationTextBox.Text; if (appointment.Location.Length > 32768) { isAppointmentValid = false; ResultTextBlock.Text = "The location cannot be greater than 32,768 characters."; } // Details appointment.Details = DetailsTextBox.Text; if (appointment.Details.Length > 1073741823) { isAppointmentValid = false; ResultTextBlock.Text = "The details cannot be greater than 1,073,741,823 characters."; } // Duration if (DurationComboBox.SelectedIndex == 0) { // 30 minute duration is selected appointment.Duration = TimeSpan.FromMinutes(30); } else { // 1 hour duration is selected appointment.Duration = TimeSpan.FromHours(1); } // All Day appointment.AllDay = AllDayCheckBox.IsChecked.Value; // Reminder if (ReminderCheckBox.IsChecked.Value) { switch (ReminderComboBox.SelectedIndex) { case 0: appointment.Reminder = TimeSpan.FromMinutes(15); break; case 1: appointment.Reminder = TimeSpan.FromHours(1); break; case 2: appointment.Reminder = TimeSpan.FromDays(1); break; } } //Busy Status switch (BusyStatusComboBox.SelectedIndex) { case 0: appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.Busy; break; case 1: appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.Tentative; break; case 2: appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.Free; break; case 3: appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.OutOfOffice; break; case 4: appointment.BusyStatus = Windows.ApplicationModel.Appointments.AppointmentBusyStatus.WorkingElsewhere; break; } // Sensitivity switch (SensitivityComboBox.SelectedIndex) { case 0: appointment.Sensitivity = Windows.ApplicationModel.Appointments.AppointmentSensitivity.Public; break; case 1: appointment.Sensitivity = Windows.ApplicationModel.Appointments.AppointmentSensitivity.Private; break; } // Uri if (UriTextBox.Text.Length > 0) { try { appointment.Uri = new System.Uri(UriTextBox.Text); } catch (Exception) { isAppointmentValid = false; ResultTextBlock.Text = "The Uri provided is invalid."; } } // Organizer // Note: Organizer can only be set if there are no invitees added to this appointment. if (OrganizerRadioButton.IsChecked.Value) { var organizer = new Windows.ApplicationModel.Appointments.AppointmentOrganizer(); // Organizer Display Name organizer.DisplayName = OrganizerDisplayNameTextBox.Text; if (organizer.DisplayName.Length > 256) { isAppointmentValid = false; ResultTextBlock.Text = "The organizer display name cannot be greater than 256 characters."; } else { // Organizer Address (e.g. Email Address) organizer.Address = OrganizerAddressTextBox.Text; if (organizer.Address.Length > 321) { isAppointmentValid = false; ResultTextBlock.Text = "The organizer address cannot be greater than 321 characters."; } else if (organizer.Address.Length == 0) { isAppointmentValid = false; ResultTextBlock.Text = "The organizer address must be greater than 0 characters."; } else { appointment.Organizer = organizer; } } } // Invitees // Note: If the size of the Invitees list is not zero, then an Organizer cannot be set. if (InviteeRadioButton.IsChecked.Value) { var invitee = new Windows.ApplicationModel.Appointments.AppointmentInvitee(); // Invitee Display Name invitee.DisplayName = InviteeDisplayNameTextBox.Text; if (invitee.DisplayName.Length > 256) { isAppointmentValid = false; ResultTextBlock.Text = "The invitee display name cannot be greater than 256 characters."; } else { // Invitee Address (e.g. Email Address) invitee.Address = InviteeAddressTextBox.Text; if (invitee.Address.Length > 321) { isAppointmentValid = false; ResultTextBlock.Text = "The invitee address cannot be greater than 321 characters."; } else if (invitee.Address.Length == 0) { isAppointmentValid = false; ResultTextBlock.Text = "The invitee address must be greater than 0 characters."; } else { // Invitee Role switch (RoleComboBox.SelectedIndex) { case 0: invitee.Role = Windows.ApplicationModel.Appointments.AppointmentParticipantRole.RequiredAttendee; break; case 1: invitee.Role = Windows.ApplicationModel.Appointments.AppointmentParticipantRole.OptionalAttendee; break; case 2: invitee.Role = Windows.ApplicationModel.Appointments.AppointmentParticipantRole.Resource; break; } // Invitee Response switch (ResponseComboBox.SelectedIndex) { case 0: invitee.Response = Windows.ApplicationModel.Appointments.AppointmentParticipantResponse.None; break; case 1: invitee.Response = Windows.ApplicationModel.Appointments.AppointmentParticipantResponse.Tentative; break; case 2: invitee.Response = Windows.ApplicationModel.Appointments.AppointmentParticipantResponse.Accepted; break; case 3: invitee.Response = Windows.ApplicationModel.Appointments.AppointmentParticipantResponse.Declined; break; case 4: invitee.Response = Windows.ApplicationModel.Appointments.AppointmentParticipantResponse.Unknown; break; } appointment.Invitees.Add(invitee); } } } if (isAppointmentValid) { ResultTextBlock.Text = "The appointment was created successfully and is valid."; } }
//Met à jour un calendrier Windows custom avec les données de planning de l'API Arel. //On peut par la suite ouvrir l'appli calendrier Windows sur ce cal. custom. public async void UpdateWindowsCalendar(string start, string end, string calendarName) { string apiUrl = "api/planning/slots?start=" + start + "&end=" + end; string planningXML = await GetInfo(apiUrl); System.Xml.XmlDocument doc = new System.Xml.XmlDocument();//creation d'une instance xml try { doc.LoadXml(planningXML); //chargement de la variable } catch (Exception) { return; //Pas très catholique tout ça } //On a le XML, on ouvre le calendrier custom // 1. get access to appointmentstore var appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AppCalendarsReadWrite); // 2. get calendar AppointmentCalendar calendar = (await appointmentStore.FindAppointmentCalendarsAsync()) .FirstOrDefault(c => c.DisplayName == calendarName); if (calendar == null) { calendar = await appointmentStore.CreateAppointmentCalendarAsync(calendarName); } //Et c'est parti pour la boucle de la folie foreach (System.Xml.XmlNode node in doc.DocumentElement.ChildNodes) { // 3. create new Appointment var appo = new Windows.ApplicationModel.Appointments.Appointment(); DateTime startDate = DateTime.Parse(node.ChildNodes[0].InnerText); DateTime endDate = DateTime.Parse(node.ChildNodes[1].InnerText); // appointment properties appo.AllDay = false; appo.Location = node.ChildNodes[6].InnerText; appo.StartTime = startDate; appo.Duration = new TimeSpan(0, (int)(endDate - startDate).TotalMinutes, 0); //Récup non complet rel (aka matière/sujet) string idRel = node.ChildNodes[2].InnerText; string xmlr = await GetInfo("/api/rels/" + idRel); string relName = getRelName(xmlr, node.ChildNodes[11].InnerText); //Récup nom complet prof string idProf = node.ChildNodes[3].InnerText; string xmlj = await GetInfo("/api/users/" + idProf); string profName = GetUserFullName(xmlj, node.ChildNodes[4].InnerText); appo.Organizer = new Windows.ApplicationModel.Appointments.AppointmentOrganizer(); appo.Organizer.DisplayName = profName; appo.Subject = relName + " - " + profName; //Est-ce que cet appointment exact existe déjà //On regarde les appointments sur ce créneau Appointment apCheck = (await calendar.FindAppointmentsAsync(appo.StartTime, appo.Duration)).FirstOrDefault(a => a.Subject == appo.Subject); //Si il en existe un sur ce créneau, on l'efface avant d'ajouter le nouveau if (apCheck != null) { await calendar.DeleteAppointmentAsync(apCheck.LocalId); } await calendar.SaveAppointmentAsync(appo); } }