Esempio n. 1
0
        public async Task <bool> AddAppointment(MyAppointmentType appointment)
        {
            var eventStore = new EKEventStore();
            var granted    = await eventStore.RequestAccessAsync(EKEntityType.Event);

            if (granted.Item1)
            {
                EKEvent newEvent = EKEvent.FromStore(eventStore);
                newEvent.StartDate = DateTimeToNSDate(appointment.ExpireDate);
                newEvent.EndDate   = DateTimeToNSDate(appointment.ExpireDate.AddHours(1));
                newEvent.Title     = appointment.Title; newEvent.Notes = appointment.WhereWhen;
                newEvent.Calendar  = eventStore.DefaultCalendarForNewEvents;
                return(eventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out NSError e));
            }
            return(false);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new Calendars.Plugin.Abstractions.CalendarEvent from an EKEvent
        /// </summary>
        /// <param name="ekEvent">Source EKEvent</param>
        /// <returns>Corresponding Calendars.Plugin.Abstraction.CalendarEvent</returns>
        public static CalendarEvent ToCalendarEvent(this EKEvent ekEvent)
        {
            return(new CalendarEvent
            {
                Name = ekEvent.Title,
                Description = ekEvent.Notes,
                Start = ekEvent.StartDate.ToDateTime(),

                // EventKit treats a one-day AllDay event as starting/ending on the same day,
                // but WinPhone/Android (and thus Calendars.Plugin) define it as ending on the following day.
                //
                End = ekEvent.EndDate.ToDateTime().AddSeconds(ekEvent.AllDay ? 1 : 0),
                AllDay = ekEvent.AllDay,
                ExternalID = ekEvent.EventIdentifier
            });
        }
Esempio n. 3
0
        private void AddEventForReal(DateTime startDate, DateTime endDate, string title, string location, string description, Action <bool> callback, string id)
        {
            var store    = EventStore;
            var calendar = store.DefaultCalendarForNewEvents;

            if (calendar == null)
            {
                callback(false);
                EnsureInvokedOnMainThread(() =>
                                          new UIAlertView("No Calendars", "This is rather embarrassing for us to tell you, but you don't seem to have a calendar. Please configure a calendar to add session.", null, "OK", null).Show()
                                          );
                return;
            }

            if (EventExists(startDate, title, id))
            {
                callback(true);
                return;
            }

            var newEvent = EKEvent.FromStore(store);

            newEvent.Title        = title;
            newEvent.Notes        = description;
            newEvent.Calendar     = calendar;
            newEvent.TimeZone     = NSTimeZone.FromName("US/Eastern");
            newEvent.StartDate    = startDate.ToNSDate();
            newEvent.EndDate      = endDate.ToNSDate();
            newEvent.AllDay       = true;
            newEvent.Location     = location;
            newEvent.Availability = EKEventAvailability.Busy;
            NSError error;

            store.SaveEvent(newEvent, EKSpan.ThisEvent, true, out error);

            if (error == null)
            {
                callback(true);
            }
            else
            {
                callback(false);
                EnsureInvokedOnMainThread(() =>
                                          new UIAlertView("Sorry about the mess.", "Something went berserk and we couldn't add the session to your calendar, but it should be fixed now. Try again, please!", null, "OK", null).Show()
                                          );
            }
        }
Esempio n. 4
0
        public void Add(int actionResult, DateTime inputDStart, DateTime inputDEnd, string inputTitle, string inputLocation)
        {
            App.Current.EventStore.RequestAccess(EKEntityType.Event,
                                                 (bool granted, NSError e) => {
                if (granted)
                {
                    EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore);
                    // make the event start 20 minutes from now and last 30 minutes
                    newEvent.StartDate = DateTimeToNSDate(inputDStart);
                    newEvent.EndDate   = DateTimeToNSDate(inputDEnd);
                    newEvent.Title     = inputTitle;
                    newEvent.Location  = inputLocation;

                    EKReminder reminder = EKReminder.Create(App.Current.EventStore);
                    reminder.Title      = "Do something awesome!";
                    reminder.Calendar   = App.Current.EventStore.DefaultCalendarForNewReminders;

                    if (actionResult == 0)
                    {
                        newEvent.Calendar = App.Current.EventStore.DefaultCalendarForNewEvents;
                        App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                    }
                    else if (actionResult == 1)
                    {
                        NSError ee;
                        App.Current.EventStore.SaveReminder(reminder, true, out ee);
                    }
                    else if (actionResult == 2)
                    {
                        newEvent.Calendar = App.Current.EventStore.DefaultCalendarForNewEvents;
                        App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                    }
                    this.InvokeOnMainThread(() => {
                        var av = new UIAlertView("QR Code Scan Results:", "Successfully Added event!", null, "ok", null);
                        av.Show();
                    });
                }
                else
                {
                    this.InvokeOnMainThread(() => {
                        var av = new UIAlertView("Access Denied", "User Denied Access to Calendar Data", null, "ok", null);
                        av.Show();
                    });
                }
            });
        }
Esempio n. 5
0
        private void agregaEventoaCalendario()
        {
            NSPredicate query = App.Current.EventStore.PredicateForEvents(funciones.ConvertDateTimeToNSDate(fechainicio), funciones.ConvertDateTimeToNSDate(fechafin), null);

            EKCalendarItem[] events = App.Current.EventStore.EventsMatching(query);

            if (events != null)
            {
                foreach (EKCalendarItem ev in events)
                {
                    if (ev.Title.Equals(titulo))
                    {
                        funciones.MessageBox("Error", "Ya tiene un evento con este titulo y a esa hora en su calendario");
                        return;
                    }
                }
            }


            EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore);

            // set the alarm for 10 minutes from now
            DateTime fechaalarma = fechainicio.AddMinutes(-10);

            newEvent.AddAlarm(EKAlarm.FromDate(funciones.ConvertDateTimeToNSDate(fechaalarma)));
            // make the event start 20 minutes from now and last 30 minutes
            newEvent.StartDate = funciones.ConvertDateTimeToNSDate(fechainicio);
            newEvent.EndDate   = funciones.ConvertDateTimeToNSDate(fechafin);
            newEvent.Title     = titulo;
            newEvent.Notes     = notas;
            newEvent.Calendar  = App.Current.EventStore.DefaultCalendarForNewEvents;

            NSError e;

            App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);

            if (e != null)
            {
                funciones.MessageBox("Error al guardar el evento", e.ToString());
                return;
            }
            else
            {
                funciones.MessageBox("Evento guardado", "Se ha guardado el evento en tu calendario!!");
            }
        }
        private CalendarItem calendarItemFromEvent(EKEvent ev)
        {
            var startDate = ev.StartDate.ToDateTimeOffset();
            var endDate   = ev.EndDate.ToDateTimeOffset();
            var duration  = endDate - startDate;

            return(new CalendarItem(
                       ev.EventIdentifier,
                       CalendarItemSource.Calendar,
                       startDate,
                       duration,
                       ev.Title,
                       CalendarIconKind.Event,
                       ev.Calendar.CGColor.ToHexColor(),
                       calendarId: ev.Calendar.CalendarIdentifier
                       ));
        }
Esempio n. 7
0
        private void GenerarEvento()
        {
            RequestAccess(EKEntityType.Event, () =>
            {
                CLLocation location = new CLLocation();
                if (SucursalModel.Sucursal_Id == "1")
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                else
                {
                    location = new CLLocation(20.6766, -103.3812);
                }
                var structuredLocation         = new EKStructuredLocation();
                structuredLocation.Title       = SucursalModel.Sucursal_Domicilio;
                structuredLocation.GeoLocation = location;

                NSDateFormatter dateFormat = new NSDateFormatter();
                dateFormat.DateFormat      = "E, d MMM yyyy HH:mm";
                NSDate newFormatDate       = dateFormat.Parse(this.FechaReservacion);
                EKEvent newEvent           = EKEvent.FromStore(AppHelper.Current.EventStore);

                DateTime myDate      = ((DateTime)newFormatDate).ToLocalTime();
                var HoraAntesReunion = myDate.AddHours(1 * -1);
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(30))));
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(HoraAntesReunion.AddMinutes(45))));
                if (myDate != null)
                {
                    newEvent.StartDate = DateTimeToNSDate(myDate);
                    newEvent.EndDate   = DateTimeToNSDate(myDate.AddHours(1));
                }
                newEvent.Title = "Visita de invitados en " + SucursalModel.Sucursal_Descripcion;
                newEvent.Notes = "Invitados: ";
                foreach (UsuarioModel Invitado in InvitadosCalendar)
                {
                    newEvent.Notes = newEvent.Notes + Invitado.Usuario_Nombre + " " + Invitado.Usuario_Apellidos + ". ";
                }
                newEvent.Notes              = newEvent.Notes + " Asunto: " + Asunto;
                newEvent.Calendar           = AppHelper.Current.EventStore.DefaultCalendarForNewEvents;
                newEvent.Location           = SucursalModel.Sucursal_Domicilio;
                newEvent.StructuredLocation = structuredLocation;
                NSError e;
                AppHelper.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
            });
        }
Esempio n. 8
0
        // Increases the vote count
        public void IncreaseVoteOnEvent(EKEvent e)
        {
            // We will not overwrite the notes field if it cannot be parsed as an int.
            if (AreNotesInteger(e))
            {
                int numVotes = EventNumberOfVotes(e);
                EventSetNumberOfVotes(e, numVotes + 1);
            }

            // Save the event since we modified the notes field.
            NSError err;
            bool    success = EventStore.SaveEvent(e, EKSpan.ThisEvent, true, out err);

            if (!success)
            {
                Console.WriteLine("There was an error updating the vote count on an event: " + err);
            }
        }
Esempio n. 9
0
        public void deleteCalendarIOS(string event_id)
        {
            try{
                // to retrieve the event you can call
                EKEvent mySavedEvent = Apps.Current.EventStore.EventFromIdentifier(event_id);
                Console.WriteLine("Retrieved Saved Event: " + mySavedEvent.Title);

                // to delete, note that once you remove the event, the reference will be null, so
                // if you try to access it you'll get a null reference error.
                NSError e;
                Apps.Current.EventStore.RemoveEvent(mySavedEvent, EKSpan.ThisEvent, true, out e);
                Console.WriteLine("Event Deleted.");
                App.Database.deleteCalendar(event_id);
            }
            catch (Exception ex) {
                Services.Logs.Insights.Send("deleteCalendarIOS", ex);
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Called when an event is double tapped
        /// </summary>
        /// <returns>The double tap event view.</returns>
        /// <param name="sender">Sender.</param>
        /// <param name="AnEvent">An event.</param>
        /// <param name="CalendarView">Calendar view.</param>
        public void DidDoubleTapEventView(object CalendarView, object sender, DSCalendarEvent AnEvent)
        {
            if (CalendarView is DSCalendarView)
            {
                EKEvent mySavedEvent = EventStore.EventFromIdentifier(AnEvent.EventID);

                if (mySavedEvent != null)
                {
                    ShowEventEditor(mySavedEvent, CalendarView as DSCalendarView, sender);
                }

                var parentVC = CalendarView as DSCalendarView;

                if (parentVC.ParentViewController != null)
                {
                }
            }
        }
        public void CreateCalendarEntry(LocalCalendarEvent localCalendarEvent)
        {
            eventStore.RequestAccess(EKEntityType.Event,
                                     (bool granted, NSError e) => {
                if (granted)
                {
                    UIApplication.SharedApplication.InvokeOnMainThread(() => {
                        EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController();

                        eventController.EventStore = eventStore;

                        // wire up a delegate to handle events from the controller
                        var eventControllerDelegate      = new CreateEventEditViewDelegate(eventController, eventStore);
                        eventController.EditViewDelegate = eventControllerDelegate;

                        EKEvent newEvent = EKEvent.FromStore(eventStore);

                        newEvent.StartDate = (NSDate)(DateTime.SpecifyKind(localCalendarEvent.StartDate, DateTimeKind.Local));
                        if (localCalendarEvent.EndDate.HasValue)
                        {
                            newEvent.EndDate = (NSDate)(DateTime.SpecifyKind(localCalendarEvent.EndDate.Value, DateTimeKind.Local));
                        }

                        newEvent.Title    = localCalendarEvent.Subject;
                        newEvent.Notes    = localCalendarEvent.Description;
                        newEvent.Location = localCalendarEvent.Location;

                        if (localCalendarEvent.ReminderDate.HasValue)
                        {
                            newEvent.AddAlarm(EKAlarm.FromDate((NSDate)(DateTime.SpecifyKind(localCalendarEvent.ReminderDate.Value, DateTimeKind.Local))));
                        }

                        eventController.Event = newEvent;

                        // show the event controller
                        UIApplication.SharedApplication.Windows[0].RootViewController.PresentViewController(eventController, true, null);
                    });
                }
                else
                {
                    new UIAlertView("Access Denied", "User Denied Access to Calendar Data", null, "ok", null).Show();
                }
            });
        }
        /// <summary>
        /// Creates a new Calendars.Plugin.Abstractions.CalendarEvent from an EKEvent
        /// </summary>
        /// <param name="ekEvent">Source EKEvent</param>
        /// <returns>Corresponding Calendars.Plugin.Abstraction.CalendarEvent</returns>
        public static CalendarEvent ToCalendarEvent(this EKEvent ekEvent)
        {
            return(new CalendarEvent
            {
                Name = ekEvent.Title,
                Description = ekEvent.Notes,
                Start = ekEvent.StartDate.ToDateTime(),

                // EventKit treats a one-day AllDay event as starting/ending on the same day,
                // but WinPhone/Android (and thus Calendars.Plugin) define it as ending on the following day.
                //
                End = ekEvent.EndDate.ToDateTime().AddSeconds(ekEvent.AllDay ? 1 : 0),
                AllDay = ekEvent.AllDay,
                Location = ekEvent.Location,
                ExternalID = ekEvent.EventIdentifier,
                Reminders = ekEvent.Alarms?.Select(alarm => alarm.ToCalendarEventReminder()).ToList()
                            ?? new List <CalendarEventReminder>()
            });
        }
Esempio n. 13
0
        public void AddEventWithStartTime(NSDate startDate)
        {
            // Create a new EKEvent and then set the properties on it.
            var e = EKEvent.FromStore(EventStore);

            e.Title     = DefaultEventTitle;
            e.TimeZone  = NSTimeZone.LocalTimeZone;
            e.StartDate = startDate;
            e.EndDate   = startDate.AddSeconds(60 * 60);            // 1 hour
            e.Calendar  = SelectedCalendar;

            // Save our new EKEvent
            NSError err;
            bool    success = EventStore.SaveEvent(e, EKSpan.FutureEvents, true, out err);

            if (!success)
            {
                Console.WriteLine("There was an error saving a new event: " + err);
            }
        }
Esempio n. 14
0
        public void AddEventToCalendar(CultureInfo ci, DateTime from, DateTime until, string name, string location)
        {
            try
            {
                EventStore.RequestAccess(EKEntityType.Event,
                                         (granted, e) =>
                {
                    if (granted)
                    {
                        UIApplication.SharedApplication.InvokeOnMainThread(() =>
                        {
                            var eventController = new EKEventEditViewController
                            {
                                EventStore = EventStore
                            };

                            var eventControllerDelegate      = new CreateEventEditViewDelegate(eventController);
                            eventController.EditViewDelegate = eventControllerDelegate;

                            var newEvent       = EKEvent.FromStore(EventStore);
                            newEvent.StartDate = DateTimeToNsDate(from);
                            newEvent.EndDate   = DateTimeToNsDate(until);
                            newEvent.AllDay    = true;
                            newEvent.Location  = location;
                            newEvent.Title     = name;
                            newEvent.Calendar  = EventStore.DefaultCalendarForNewEvents;

                            eventController.Event = newEvent;

                            UIApplication.SharedApplication.Windows[0].RootViewController
                            .PresentViewController(eventController, true, null);
                        });
                    }
                });
            }
            catch (Exception)
            {
                // shht
            }
        }
Esempio n. 15
0
        public string AddEvent(string Title, string Description, DateTime StartDate, DateTime EndDate, string StartTimeZone, string EndTimeZone)
        {
            try
            {
                EKEvent newEvent = EKEvent.FromStore(AppMain.Self.EventStore);
                // set the alarm for 10 minutes from now
                newEvent.AddAlarm(EKAlarm.FromDate(DateTimeToNSDate(StartDate.AddMinutes(10))));
                // make the event start 20 minutes from now and last 30 minutes
                newEvent.StartDate = DateTimeToNSDate(StartDate.AddMinutes(20));
                newEvent.EndDate   = DateTimeToNSDate(EndDate.AddMinutes(50));
                newEvent.Title     = Title;
                newEvent.Notes     = Description;

                EKCalendar[] calendars = AppMain.Self.EventStore.GetCalendars(EKEntityType.Event);
                if (calendars.Length > 0)
                {
                    newEvent.Calendar = calendars.FirstOrDefault();
                }
                else
                {
                    newEvent.Calendar = AppMain.Self.EventStore.DefaultCalendarForNewEvents;
                }

                //saving the event
                NSError errorEvent;
                AppMain.Self.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out errorEvent);

                if (errorEvent != null)
                {
                    throw new Exception(errorEvent.ToString());
                }


                return("event added: " + newEvent.CalendarItemIdentifier);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 16
0
        public async Task <(bool result, CalendarEventModel model)> CreateCalendarEvent(CalendarEventModel calEvent)
        {
            (bool result, CalendarEventModel model)response = (false, calEvent);

            var result = await RequestAccess(EKEntityType.Event);

            if (result.granted)
            {
                var newEvent         = EKEvent.FromStore(CalendarEvent.EventStore);
                var selectedCalendar = CalendarEvent.EventStore.DefaultCalendarForNewEvents;
                if (calEvent.DeviceCalendar != null)
                {
                    selectedCalendar = CalendarEvent.EventStore.GetCalendar(calEvent.DeviceCalendar.Id);
                }

                newEvent.StartDate = calEvent.StartTime.ToNSDate();
                newEvent.EndDate   = calEvent.EndTime.ToNSDate();
                newEvent.Title     = calEvent.Title;
                newEvent.Notes     = calEvent.Description;
                newEvent.Calendar  = selectedCalendar;

                if (calEvent.HasReminder)
                {
                    var offset = calEvent.StartTime.AddMinutes(-calEvent.ReminderMinutes).ToNSDate();
                    newEvent.AddAlarm(EKAlarm.FromDate(offset));
                }

                NSError e;

                CalendarEvent.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, true, out e);

                if (e == null)
                {
                    response.result   = true;
                    response.model.Id = newEvent.EventIdentifier;
                }
            }

            return(response);
        }
Esempio n. 17
0
        public void CreateCalendarEvent(CalendarEventModel calEvent)
        {
            if (CalendarEvent.eventStore == null)
            {
                CalendarEvent.eventStore = new EKEventStore();
            }

            RequestAccess(EKEntityType.Event, () =>
            {
                EKEvent newEvent = EKEvent.FromStore(CalendarEvent.eventStore);

                if (calEvent.HasReminder)
                {
                    newEvent.AddAlarm(EKAlarm.FromDate(ToNSDate(calEvent.StartTime.AddHours(-1))));
                }

                newEvent.StartDate = ToNSDate(calEvent.StartTime);
                newEvent.EndDate   = ToNSDate(calEvent.EndTime);
                newEvent.Title     = calEvent.Title;
                newEvent.Notes     = calEvent.Description;
                newEvent.Calendar  = CalendarEvent.eventStore.DefaultCalendarForNewEvents;

                NSError e;
                CalendarEvent.eventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                if (e != null)
                {
                    new UIAlertView("Error Saving Event", e.ToString(), null, "ok", null).Show();
                    return;
                }
                else
                {
                    new UIAlertView("Event Saved", "Event ID: " + newEvent.EventIdentifier, null, "ok", null).Show();
                    Console.WriteLine("Event Saved, ID: " + newEvent.EventIdentifier);
                }

                // to retrieve the event you can call
                EKEvent mySavedEvent = CalendarEvent.eventStore.EventFromIdentifier(newEvent.EventIdentifier);
                Console.WriteLine("Retrieved Saved Event: " + mySavedEvent.Title);
            });
        }
Esempio n. 18
0
        public async void AddAppointment(DateTime startTime, DateTime endTime, String subject, String location, String details, Boolean isAllDay, AppointmentReminder reminder, AppointmentStatus status)
        {
            var granted = await RequestAccessAsync();

            if (granted)
            {
                EKEvent newEvent = EKEvent.FromStore(this.EventStore);
                newEvent.StartDate = (NSDate)DateTime.SpecifyKind(startTime, DateTimeKind.Utc);
                newEvent.EndDate   = (NSDate)DateTime.SpecifyKind(endTime, DateTimeKind.Utc);
                newEvent.Title     = subject;
                newEvent.Location  = location;
                newEvent.Notes     = details;
                newEvent.AllDay    = isAllDay;
                newEvent.AddAlarm(ConvertReminder(reminder, startTime));
                newEvent.Availability = ConvertAppointmentStatus(status);

                NSError error;
                this.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out error);

                Console.WriteLine("Event Saved, ID: " + newEvent.CalendarItemIdentifier);
            }
        }
Esempio n. 19
0
 public bool AddToCalendar(CalendarModel calendarModel)
 {
     //var granted = EventStore.RequestAccessAsync(EKEntityType.Event);
     EventStore.RequestAccess(EKEntityType.Event, (bool granted, NSError e) =>
     {
         if (granted)
         {
             EKEvent newEvent   = EKEvent.FromStore(EventStore);
             newEvent.Title     = calendarModel.Title;
             newEvent.Notes     = calendarModel.Description;
             newEvent.StartDate = (NSDate)calendarModel.Start;
             newEvent.EndDate   = (NSDate)calendarModel.End;
             newEvent.Location  = calendarModel.Location;
             newEvent.Calendar  = EventStore.DefaultCalendarForNewEvents;
             EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
             return;
         }
         new UIAlertView("Access Denied,", "User Denied Access to Calendar Data", null, "ok", null).Show();
         Debug.WriteLine(e);
     });
     return(true);
 }
Esempio n. 20
0
        private string CreateCalendarEvent(Task task)
        {
            EKEvent ekEvent = EKEvent.FromStore(App.CurrentApp.EventStore);

            ekEvent.StartDate = task.DateAndTime;
            ekEvent.EndDate   = Extensions.DateTimeToNSDate(Extensions.NSDateToDateTime(task.DateAndTime).AddHours(task.Duration));
            ekEvent.Title     = task.Name;
            ekEvent.Notes     = task.ShortLabel;
            ekEvent.Calendar  = App.CurrentApp.EventStore.DefaultCalendarForNewEvents;

            App.CurrentApp.EventStore.SaveEvent(ekEvent, EKSpan.ThisEvent, true, out NSError error);
            if (error != null)
            {
                Console.WriteLine(error);
                return(null);
            }
            else
            {
                Console.WriteLine("event was added into calendar");
                return(ekEvent.EventIdentifier);
            }
        }
Esempio n. 21
0
        private void AddEvent(string title, string addInfo, DateTime startDate, DateTime alertDate)
        {
            var newEvent = EKEvent.FromStore(EventStore);

            newEvent.AddAlarm(EKAlarm.FromDate(alertDate.LocalDateTimeToNSDate()));
            newEvent.StartDate = startDate.LocalDateTimeToNSDate();
            newEvent.EndDate   = startDate.AddHours(1).LocalDateTimeToNSDate();
            newEvent.Title     = title;
            newEvent.Notes     = addInfo;
            newEvent.Calendar  = EventStore.DefaultCalendarForNewEvents;
            NSError err;

            EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out err);
            if (err != null)
            {
                _logger.LogMessage("Err Saving Event : " + err);
            }
            else
            {
                _logger.LogMessage("Event Saved,  ID: " + newEvent.EventIdentifier);
            }
        }
Esempio n. 22
0
        public void CreateCalendarEvent(CalendarEventModel calEvent, Action <bool> callback)
        {
            if (CalendarEvent.eventStore == null)
            {
                CalendarEvent.eventStore = new EKEventStore();
            }

            RequestAccess(EKEntityType.Event, () =>
            {
                EKEvent newEvent = EKEvent.FromStore(CalendarEvent.eventStore);

                if (calEvent.HasReminder)
                {
                    newEvent.AddAlarm(EKAlarm.FromDate(ToNSDate(calEvent.StartTime.AddHours(-1))));
                }

                newEvent.StartDate = ToNSDate(calEvent.StartTime);
                newEvent.EndDate   = ToNSDate(calEvent.EndTime);
                newEvent.Title     = calEvent.Title;
                newEvent.Notes     = calEvent.Description;
                newEvent.Calendar  = CalendarEvent.eventStore.DefaultCalendarForNewEvents;

                NSError e;
                CalendarEvent.eventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                if (e != null)
                {
                    callback?.Invoke(false);
                }
                else
                {
                    callback?.Invoke(true);
                }

                // to retrieve the event you can call
                EKEvent mySavedEvent = CalendarEvent.eventStore.EventFromIdentifier(newEvent.EventIdentifier);
                Console.WriteLine("Retrieved Saved Event: " + mySavedEvent.Title);
            });
        }
Esempio n. 23
0
        /// <summary>
        /// This method illustrates how to save and retrieve events programmatically.
        /// </summary>
        protected void SaveAndRetrieveEvent()
        {
            EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore);

            // set the alarm for 5 minutes from now
            newEvent.AddAlarm(EKAlarm.FromDate(DateTime.Now.AddMinutes(5)));
            // make the event start 10 minutes from now and last 30 minutes
            newEvent.StartDate = DateTime.Now.AddMinutes(10);
            newEvent.EndDate   = DateTime.Now.AddMinutes(40);
            newEvent.Title     = "Appt. to do something Awesome!";
            newEvent.Notes     = "Find a boulder, climb it. Find a river, swim it. Find an ocean, dive it.";
            newEvent.Calendar  = App.Current.EventStore.DefaultCalendarForNewEvents;

            // save the event
            NSError e;

            App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
            if (e != null)
            {
                new UIAlertView("Err Saving Event", e.ToString(), null, "ok", null).Show();
                return;
            }
            else
            {
                new UIAlertView("Event Saved", "Event ID: " + newEvent.EventIdentifier, null, "ok", null).Show();
                Console.WriteLine("Event Saved, ID: " + newEvent.EventIdentifier);
            }

            // to retrieve the event you can call
            EKEvent mySavedEvent = App.Current.EventStore.EventFromIdentifier(newEvent.EventIdentifier);

            Console.WriteLine("Retrieved Saved Event: " + mySavedEvent.Title);

            // to delete, note that once you remove the event, the reference will be null, so
            // if you try to access it you'll get a null reference error.
            App.Current.EventStore.RemoveEvent(mySavedEvent, EKSpan.ThisEvent, true, out e);
            Console.WriteLine("Event Deleted.");
        }
Esempio n. 24
0
        // Implementación de la interfaz
        public async Task <string> CreateEventCalendar(string titulo, string descripcion, DateTime inicioEvento, DateTime finEvento)
        {
            TaskCompletionSource <string> tcs = new TaskCompletionSource <string>();

            if (permisoOtorgado)
            {
                EKEvent newEvent = EKEvent.FromStore(eventStore);
                newEvent.StartDate = inicioEvento.ToNSDate();
                newEvent.EndDate   = finEvento.ToNSDate();
                newEvent.Title     = titulo;
                newEvent.Notes     = descripcion;
                newEvent.AllDay    = true;
                newEvent.Calendar  = eventStore.DefaultCalendarForNewEvents;
                NSError e;
                eventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                tcs.SetResult("true");
            }
            else
            {
                tcs.SetResult(string.Empty);
            }
            return(await tcs.Task);
        }
Esempio n. 25
0
 public CalendarDayEventView(EKEvent theEvent)
 {
     if (theEvent != null) {
         eventIdentifier = theEvent.EventIdentifier;
         theCal = theEvent.Calendar;
         nsStartDate = theEvent.StartDate;
         nsEndDate = theEvent.EndDate;
         startDate = Util.NSDateToDateTime (theEvent.StartDate);
         endDate = Util.NSDateToDateTime (theEvent.EndDate);
         TimeSpan dateDif = endDate - startDate;
         AllDay = theEvent.AllDay;
         if (dateDif.Minutes < 30 && dateDif.Minutes > 1) {
             endDate = endDate.AddMinutes (30 - dateDif.Minutes);
         }
         Title = theEvent.Title;
         location = theEvent.Location;
         if (theEvent.Calendar != null) {
             color = new UIColor (theEvent.Calendar.CGColor);
         }
     }
     Frame = new RectangleF (0, 0, 0, 0);
     setupCustomInitialisation ();
 }
Esempio n. 26
0
        /// <summary>
        /// This method illustrates how to save and retrieve events programmatically.
        /// </summary>
        private void SaveAndRetrieveEvent()
        {
            var newEvent = EKEvent.FromStore(EventStore);

            // set the alarm for 5 minutes from now
            newEvent.AddAlarm(EKAlarm.FromDate((NSDate)DateTime.Now.AddMinutes(5)));
            // make the event start 10 minutes from now and last 30 minutes
            newEvent.StartDate = (NSDate)DateTime.Now.AddMinutes(10);
            newEvent.EndDate   = (NSDate)DateTime.Now.AddMinutes(40);
            newEvent.Title     = "Appt. to do something Awesome!";
            newEvent.Notes     = "Find a boulder, climb it. Find a river, swim it. Find an ocean, dive it.";
            newEvent.Calendar  = EventStore.DefaultCalendarForNewEvents;

            // save the event
            EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out NSError error);
            if (error != null)
            {
                var alert = UIAlertController.Create("Error", error.ToString(), UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                base.PresentViewController(alert, true, null);
            }
            else
            {
                var alert = UIAlertController.Create("Event Saved", $"Event ID: {newEvent.EventIdentifier}", UIAlertControllerStyle.Alert);
                alert.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));
                base.PresentViewController(alert, true, null);

                // to retrieve the event you can call
                var savedEvent = EventStore.EventFromIdentifier(newEvent.EventIdentifier);
                Console.WriteLine($"Retrieved Saved Event: {savedEvent.Title}");

                // to delete, note that once you remove the event, the reference will be null, so
                // if you try to access it you'll get a null reference error.
                EventStore.RemoveEvent(savedEvent, EKSpan.ThisEvent, true, out error);
                Console.WriteLine("Event Deleted.");
            }
        }
Esempio n. 27
0
        public static void Add(int actionResult, DateTime inputDStart, DateTime inputDEnd, string inputTitle, string inputLocation)
        {
            App.Current.EventStore.RequestAccess(EKEntityType.Event,
                                                 (bool granted, NSError e) => {
                if (granted)
                {
                    EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore);
                    // make the event start 20 minutes from now and last 30 minutes
                    newEvent.StartDate = DateTimeToNSDate(inputDStart);
                    newEvent.EndDate   = DateTimeToNSDate(inputDEnd);
                    newEvent.Title     = inputTitle;
                    newEvent.Location  = inputLocation;

                    if (actionResult == 0)
                    {
                        newEvent.Calendar = App.Current.EventStore.DefaultCalendarForNewEvents;
                        App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                    }

                    else if (actionResult == 1)
                    {
                    }

                    else if (actionResult == 2)
                    {
                        newEvent.Calendar = App.Current.EventStore.DefaultCalendarForNewEvents;
                        App.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                    }
                    new UIAlertView("QR Code Scan Results:", "Successfully Added event!", null, "ok", null).Show();
                }
                else
                {
                    new UIAlertView("Access Denied", "User Denied Access to Calendar Data", null, "ok", null).Show();
                }
            });
        }
Esempio n. 28
0
        public void SaveAndRetrieveEvent(string Title, string Desc, string Date, string Time, string location, int reservation_id)
        {
            try{
                EKEvent newEvent = EKEvent.FromStore(Apps.Current.EventStore);
                // set the alarm for 5 minutes from now
                newEvent.AddAlarm(EKAlarm.FromDate(ConvertDateTimeToNSDate(Date, Time, -120)));
                // make the event start 10 minutes from now and last 30 minutes
                newEvent.StartDate = (ConvertDateTimeToNSDate(Date, Time, 0));
                newEvent.EndDate   = (ConvertDateTimeToNSDate(Date, Time, 120));
                newEvent.Title     = Title;
                newEvent.Notes     = Desc;
                newEvent.Location  = location;
                newEvent.Calendar  = Apps.Current.EventStore.DefaultCalendarForNewEvents;

                // save the event
                NSError e;
                Apps.Current.EventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                if (e != null)
                {
                    //new UIAlertView ("Err Saving Event", e.ToString (), null, "ok", null).Show ();
                    return;
                }
                else
                {
                    //new UIAlertView ("Event Saved", "Event ID: " + newEvent.EventIdentifier, null, "ok", null).Show ();
                    Console.WriteLine("Event Saved, ID: " + newEvent.EventIdentifier);
                }

                App.Database.saveCalendar(reservation_id, newEvent.EventIdentifier.ToString(), Date);
                var calendar = App.Database.getCalendar("-1");
            }
            catch (Exception ex)
            {
                Services.Logs.Insights.Send("GetDateTimeMS", ex);
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Creates new reminder about medicine
        /// </summary>
        /// <param name="Name">Name of medicine</param>
        /// <param name="time">Time of taking medicine</param>
        public void AddReminder(string Name, NSDate time)
        {
            /*
             * EKReminder reminder = EKReminder.Create(eventStore);
             * reminder.Title = Name;
             * NSError e = new NSError();
             * EKAlarm timeToRing = new EKAlarm();
             * timeToRing.AbsoluteDate = time;
             * reminder.Calendar = eventStore.DefaultCalendarForNewReminders;
             * reminder.AddAlarm(timeToRing);
             * //reminder.Calendar = eventStore.DefaultCalendarForNewReminders;
             * eventStore.SaveReminder(reminder, true, out e);
             */
            eventStore.RequestAccess(EKEntityType.Event,
                                     (bool granted, NSError e) =>
            {
                if (granted)
                {
                    EKEvent newEvent   = EKEvent.FromStore(eventStore);
                    newEvent.StartDate = (NSDate)DateTime.Now;
                    newEvent.EndDate   = (NSDate)DateTime.Now.AddMinutes(5);
                    newEvent.Title     = Name;
                    newEvent.Calendar  = eventStore.DefaultCalendarForNewEvents;
                    eventStore.SaveEvent(newEvent, EKSpan.ThisEvent, out e);
                }
                //do something here
                else
                {
                    var okAlertController = UIAlertController.Create("Error", "Application doesnt have permission for calendar.", UIAlertControllerStyle.Alert);

                    okAlertController.AddAction(UIAlertAction.Create("OK", UIAlertActionStyle.Default, null));

                    PresentViewController(okAlertController, true, null);
                }
            });
        }
Esempio n. 30
0
		public bool AreNotesInteger (EKEvent e)
		{
			try {
				if (e.Notes != null) 
					int.Parse (e.Notes);
				return true;

			} catch (System.FormatException) {
				return false;
			}
		}
Esempio n. 31
0
		// Increases the vote count
		public void IncreaseVoteOnEvent (EKEvent e)
		{
			// We will not overwrite the notes field if it cannot be parsed as an int.
			if (AreNotesInteger (e)) { 
				int numVotes = EventNumberOfVotes (e);
				EventSetNumberOfVotes (e, numVotes + 1);
			}
			
			// Save the event since we modified the notes field.
			NSError err;
			bool success = EventStore.SaveEvent (e, EKSpan.ThisEvent, true, out err);
			
			if (!success) 
				Console.WriteLine ("There was an error updating the vote count on an event: " + err);
		}
Esempio n. 32
0
		public void EventSetNumberOfVotes (EKEvent evt, int newVote)
		{
			// Since vote count is stored in notes, only allow voting if the notes field is empty or only contains the vote count,
			// so that we don't accidentally delete important data in the notes field.
			if (evt.Notes == null || evt.Notes == "" || newVote == EventNumberOfVotes (evt) + 1) 
				evt.Notes = newVote.ToString ();
		}
Esempio n. 33
0
		public int EventNumberOfVotes (EKEvent evt)
		{
			if (evt.Notes == null || evt.Notes == "") 
				return 0;
			return int.Parse (evt.Notes);
		}
Esempio n. 34
0
        public async Task PushMeetingsToCalendarAsync(List <Meeting> meetings)
        {
            try
            {
                using (await _PushMeetingsToCalendarAsyncLock.LockAsync())
                {
                    if (!(await _eventStore.RequestAccessAsync(EKEntityType.Event)).Item1)
                    {
                        return;
                    }

                    var     calendar   = _eventStore.GetCalendar(AcraCalendarIdentifier);
                    CGColor colorToUse = null;
                    if (calendar != null)
                    {
                        colorToUse = calendar.CGColor;
                        NSError errorToDelete;;
                        _eventStore.RemoveCalendar(calendar, true, out errorToDelete);
                    }

                    var otherToDelete = _eventStore.GetCalendars(EKEntityType.Event).Where(c => c.Title.StartsWith("ACRA"));
                    foreach (var item in otherToDelete)
                    {
                        NSError errorToDelete;
                        _eventStore.RemoveCalendar(item, true, out errorToDelete);
                    }

                    // now recreate a calendar !
                    calendar       = EKCalendar.FromEventStore(_eventStore);
                    calendar.Title = "ACRA du " + DateTime.Now.ToString("g", new System.Globalization.CultureInfo("fr"));
                    if (colorToUse != null)
                    {
                        calendar.CGColor = colorToUse;
                    }

                    EKSource[] sources     = _eventStore.Sources;
                    var        sourceToSet = sources
                                             .FirstOrDefault(s => s.SourceType == EKSourceType.CalDav && s.Title.Equals("iCloud", StringComparison.InvariantCultureIgnoreCase));

                    if (sourceToSet == null)
                    {
                        sourceToSet = sources.FirstOrDefault(s => s.SourceType == EKSourceType.Local);
                    }

                    if (sourceToSet == null)
                    {
                        sourceToSet = _eventStore.DefaultCalendarForNewEvents.Source;
                    }

                    calendar.Source = sourceToSet;
                    NSError error;
                    _eventStore.SaveCalendar(calendar, true, out error);
                    AcraCalendarIdentifier = calendar.CalendarIdentifier;

                    var toSaves = meetings.OrderByDescending(ap => ap.StartDate).ToArray();

                    var howMuch = toSaves.Length;
                    for (int index = 0; index < howMuch; index++)
                    {
                        var appointData = toSaves[index];

                        var toSave = EKEvent.FromStore(_eventStore);

                        //if (!string.IsNullOrEmpty(appointData.))
                        //{
                        //    toSave.Location = appointData.Location;
                        //}
                        toSave.StartDate = ConvertDateTimeToNSDate(appointData.StartDate);
                        toSave.AllDay    = appointData.AllDayEvent;

                        if (appointData.IsRecurrent && appointData.AllDayEvent)
                        {
                            var end  = EKRecurrenceEnd.FromEndDate(ConvertDateTimeToNSDate(appointData.EndDate));
                            var rule = new EKRecurrenceRule(EKRecurrenceFrequency.Weekly, 1, end);
                            toSave.RecurrenceRules = new[] { rule };
                        }
                        else
                        {
                            toSave.EndDate = ConvertDateTimeToNSDate(appointData.EndDate);
                        }

                        // If set to AllDay and given an EndDate of 12am the next day, EventKit
                        // assumes that the event consumes two full days.
                        // (whereas WinPhone/Android consider that one day, and thus so do we)
                        //
                        if (appointData.AllDayEvent)
                        {
                            toSave.EndDate = ConvertDateTimeToNSDate(appointData.EndDate.AddDays(-1));
                        }

                        if (!appointData.IsHoliday)
                        {
                            if (appointData.Duration.TotalDays > 1 && !appointData.IsRecurrent)
                            {
                                toSave.Title = ((int)appointData.Duration.TotalDays + 1) + " " + appointData.Title;
                            }
                            else
                            {
                                toSave.Title = appointData.Title;
                            }
                        }
                        else
                        {
                            //TODO : localisation
                            toSave.Title = "[FERIE] " + appointData.Title;
                        }

                        toSave.Notes = appointData.Type.ToString();

                        toSave.Calendar = calendar;

                        NSError errorCommit;
                        _eventStore.SaveEvent(toSave, EKSpan.ThisEvent, out errorCommit);
                    }
                }

                NSError errorEvent;

                _eventStore.Commit(out errorEvent);
            }
            catch (Exception e)
            {
                //TODO : localisation
                await App.Instance.AlertService.ShowExceptionMessageAsync(e, "Impossible de renseigner votre calendrier iOS");
            }
        }
 void AddEvent(EKEvent calendarEvent)
 {
     UserMeetings userMeetings = new UserMeetings ();
     if (!AppDelegate.IsFromRR) {
         userMeetings.Id = 0;
         userMeetings.LeadId = AppDelegate.CurrentLead.LEAD_ID;
         userMeetings.UserId = AppDelegate.UserDetails.UserId;
         userMeetings.Subject = calendarEvent.Title;
         userMeetings.StartDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.StartDate.ToString()),DateTimeKind.Local).ToString();
         userMeetings.EndDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.EndDate.ToString()),DateTimeKind.Local).ToString();
         userMeetings.CustomerName = AppDelegate.CurrentLead.LEAD_NAME;
         userMeetings.City = AppDelegate.CurrentLead.CITY;
         userMeetings.State = AppDelegate.CurrentLead.STATE;
         userMeetings.Status = "";
         userMeetings.Comments = "";
         userMeetings.SFDCLead_ID = AppDelegate.CurrentLead.SFDCLEAD_ID;
     } else {
         userMeetings.Id = 0;
         userMeetings.LeadId = (int) AppDelegate.CurrentRR.LeadID;
         userMeetings.UserId = AppDelegate.CurrentRR.SellerUserID;
         userMeetings.Subject = calendarEvent.Title;
         userMeetings.StartDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.StartDate.ToString()),DateTimeKind.Local).ToString();
         userMeetings.EndDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.EndDate.ToString()),DateTimeKind.Local).ToString();
         userMeetings.CustomerName = AppDelegate.CurrentRR.Prospect;
         userMeetings.City = AppDelegate.CurrentRR.City;
         userMeetings.State = AppDelegate.CurrentRR.State;
         userMeetings.Status = "";
         userMeetings.Comments = "";
         userMeetings.SFDCLead_ID = "";
     }
     AppDelegate.leadsBL.SaveMeetingEvent (userMeetings);
     AppDelegate.UserDetails.MeetingCount = AppDelegate.UserDetails.MeetingCount + 1;
     //Xamarin Insights tracking
     Insights.Track ("SaveMeetingEvent", new Dictionary <string,string> {
         { "LeadId", userMeetings.LeadId.ToString () },
         { "UserId", userMeetings.UserId.ToString () },
         { "Subject", userMeetings.Subject },
         { "CustomerName", userMeetings.CustomerName }
     });
     //				var notification = new UILocalNotification();
     //
     //				notification.AlertBody = AppDelegate.CurrentLead.LEAD_ID.ToString();
     //				// set the fire date (the date time in which it will fire)
     //				notification.FireDate = NSDate.FromTimeIntervalSinceNow(100);
     //				// configure the alert
     ////				notification.AlertAction = "View Alert";
     ////				notification.AlertBody = "Your one minute alert has fired!";
     //
     //				// modify the badge
     //				notification.ApplicationIconBadgeNumber = 1;
     //
     //				// set the sound to be the default sound
     //				notification.SoundName = UILocalNotification.DefaultSoundName;
     //
     //				// schedule it
     //				UIApplication.SharedApplication.ScheduleLocalNotification(notification);
 }
			void AddEvent(EKEvent calendarEvent)
			{
				UserMeetings userMeetings = new UserMeetings ();
				userMeetings.Id = 0;
				userMeetings.LeadId = AppDelegate.CurrentLead.LEAD_ID;
				userMeetings.UserId = AppDelegate.UserDetails.UserId;
				userMeetings.Subject = calendarEvent.Title;
				userMeetings.StartDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.StartDate.ToString()),DateTimeKind.Local).ToString();
				userMeetings.EndDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.EndDate.ToString()),DateTimeKind.Local).ToString();
				userMeetings.CustomerName = AppDelegate.CurrentLead.LEAD_NAME;
				userMeetings.City = AppDelegate.CurrentLead.CITY;
				userMeetings.State = AppDelegate.CurrentLead.STATE;
				userMeetings.Status = "";
				userMeetings.Comments = "";
				userMeetings.SFDCLead_ID = AppDelegate.CurrentLead.SFDCLEAD_ID;

				AppDelegate.leadsBL.SaveMeetingEvent (userMeetings);
				AppDelegate.UserDetails.MeetingCount = AppDelegate.UserDetails.MeetingCount + 1;
				//Xamarin Insights tracking
				Insights.Track ("SaveMeetingEvent", new Dictionary <string,string> {
					{ "LeadId", userMeetings.LeadId.ToString () },
					{ "UserId", userMeetings.UserId.ToString () },
					{ "Subject", userMeetings.Subject },
					{ "CustomerName", userMeetings.CustomerName }
				});
			}
Esempio n. 37
0
            void AddEvent(EKEvent calendarEvent)
            {
                UserMeetings userMeetings = new UserMeetings ();
                userMeetings.Id = 0;
                userMeetings.LeadId = (int) AppDelegate.CurrentRR.LeadID;
                userMeetings.UserId = AppDelegate.CurrentRR.SellerUserID;
                userMeetings.Subject = calendarEvent.Title;
                userMeetings.StartDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.StartDate.ToString()),DateTimeKind.Local).ToString();
                userMeetings.EndDate = DateTime.SpecifyKind(DateTime.Parse(calendarEvent.EndDate.ToString()),DateTimeKind.Local).ToString();
                userMeetings.CustomerName = AppDelegate.CurrentRR.Prospect;
                userMeetings.City = AppDelegate.CurrentRR.City;
                userMeetings.State = AppDelegate.CurrentRR.State;
                userMeetings.Status = "";
                userMeetings.Comments = "";
                userMeetings.SFDCLead_ID = "";//AppDelegate.CurrentRR.SFDCLead_ID;
                AppDelegate.leadsBL.SaveMeetingEvent (userMeetings);
                AppDelegate.UserDetails.MeetingCount = AppDelegate.UserDetails.MeetingCount + 1;
                //Xamarin Insights tracking
                Insights.Track ("SaveMeetingEvent", new Dictionary <string,string> {
                    { "LeadId", userMeetings.LeadId.ToString () },
                    { "UserId", userMeetings.UserId.ToString () },
                    { "Subject", userMeetings.Subject },
                    { "CustomerName", userMeetings.CustomerName }
                });

                myObject.AlertSubViewRequestMeeting.Hidden = true;
                myObject.ViewReferralRequestMade.Hidden = false;
                AppDelegate.referralRequestBL.UpdateReferralRequest(myObject.refferalRequests.ID,4);
                if(AppDelegate.CurrentRRList.Contains(myObject.refferalRequests))
                    AppDelegate.CurrentRRList.Remove(myObject.refferalRequests);
            }
 private bool isValidEvent(EKEvent ev)
 => !ev.AllDay;
Esempio n. 39
0
		protected static void UpdateEvents(EKEvent myevent)
		{
			NSError e;
			NSDate startT = myevent.StartDate;
			List<LHRemindItem> events = BRemind.GetLHRemind (SQLite_iOS.GetConnection(),ItemLH.IDLH);
			foreach (var item in events) {
				try
				{
				EKEvent mySavedEvent = App.Current.EventStore.EventFromIdentifier (item.EventID);
					if (mySavedEvent.StartDate.Compare(startT)>0)
					{
						mySavedEvent.Notes= myevent.Notes;
						App.Current.EventStore.SaveEvent(mySavedEvent,EKSpan.ThisEvent,out e);
					}

				}
				catch {
				}
			}


		}