Ejemplo n.º 1
0
 public static IObservable <UserCredential> AuthorizeTestGoogle(this XafApplication application, bool aquireToken = true)
 {
     if (aquireToken)
     {
         application.ObjectSpaceProvider.NewAuthentication();
     }
     return(aquireToken ? application.AuthorizeGoogle() : application.GoogleNeedsAuthentication()
            .Select(b => b ? Observable.Throw <UserCredential>(new Exception(nameof(AuthorizeTestGoogle)))
                     : application.AuthorizeGoogle()).Merge());
 }
Ejemplo n.º 2
0
        public static async Task <global::Google.Apis.Calendar.v3.CalendarService> CalendarService(this XafApplication application, bool deleteAll = false)
        {
            application.ObjectSpaceProvider.NewAuthentication();
            var calendarService = await application.AuthorizeGoogle().NewService <global::Google.Apis.Calendar.v3.CalendarService>();

            if (deleteAll)
            {
                var calendar = await calendarService.GetCalendar(CalendarName);

                await calendarService.DeleteAllEvents(calendar.Id);
            }
            return(calendarService);
        }