Exemplo n.º 1
0
        private async void removeCalButtonClick(object sender, RoutedEventArgs e)
        {
            if (EventsListView.SelectedItems.Count <= 0)
            {
                return;
            }

            CalendarEvent item = EventsListView.SelectedItem as CalendarEvent;

            CalendarEvents calEvents = await CalendarEvents.CreateCalendarInstance();

            await calEvents.DeleteCalendarEvent(item.Id);

            DisplayCalendarEventsForDay(System.Convert.ToDateTime(item.Start));
        }
Exemplo n.º 2
0
        private async void DisplayCalendarEventsForDay(DateTime day)
        {
            CalendarEvents calEvents = await CalendarEvents.CreateCalendarInstance();

            var calResult =
                from t in (await calEvents.GetCalendarEvents(day))
                group t by t.StartDateTime into g
                orderby g.Key
                select g;

            EventsInfoCollection.Source = calResult;

            CalendarTitleString       = string.Format("Your day on: {0}", day.ToString("d"));
            CalendarTitle.DataContext = CalendarTitleString;
        }
Exemplo n.º 3
0
        private async void DropSessionEnd(object sender, DragEventArgs e)
        {
            try
            {
                if (null != DraggedSession)
                {
                    CalendarEvents calEvents = await CalendarEvents.CreateCalendarInstance();

                    await calEvents.AddOrUpdateCalendarEvent(DraggedSession.ToCalendarEvent());

                    DisplayCalendarEventsForDay(System.Convert.ToDateTime(DraggedSession.Start));
                }
            }
            catch { }
        }
Exemplo n.º 4
0
        private async void addCalButtonClick(object sender, RoutedEventArgs e)
        {
            if (SessionListView.SelectedItems.Count <= 0)
            {
                return;
            }

            Session item = SessionListView.SelectedItem as Session;

            CalendarEvents calEvents = await CalendarEvents.CreateCalendarInstance();

            CalendarEvent calendarEvent = item.ToCalendarEvent();
            await calEvents.AddOrUpdateCalendarEvent(calendarEvent);

            DisplayCalendarEventsForDay(System.Convert.ToDateTime(item.Start));
        }
        public static async Task <CalendarEvents> CreateCalendarInstance()
        {
            CalendarEvents calendarEvents = new CalendarEvents();

            // Obtain information for communicating with the service:
            calendarEvents._serviceInfo = await Office365ServiceInfo.GetExchangeServiceInfoAsync();

            if (!calendarEvents._serviceInfo.HasValidAccessToken)
            {
                await Office365Helper.ShowErrorMessageAsync("Unable to get Exchange ServiceInfo", string.Empty);

                return(null);
            }

            calendarEvents._httpClient = new HttpClient();

            return(calendarEvents);
        }