/// <summary> /// Launchs the create new event controller. /// </summary> protected void LaunchModifyEvent() { // first we need to create an event it so we have one that we know exists // in a real world scenario, we'd likely either a) be modifying an event that // we found via a query, or 2) we'd do like this, in which we'd automatically // populate the event data, like for say a dr. appt. reminder, or something EKEvent newEvent = EKEvent.FromStore(App.Current.EventStore); // set the alarm for 10 minutes from now newEvent.AddAlarm(EKAlarm.FromDate((NSDate)DateTime.Now.AddMinutes(10))); // make the event start 20 minutes from now and last 30 minutes newEvent.StartDate = (NSDate)DateTime.Now.AddMinutes(20); newEvent.EndDate = (NSDate)DateTime.Now.AddMinutes(50); newEvent.Title = "Get outside and do some exercise!"; newEvent.Notes = "This is your motivational event to go and do 30 minutes of exercise. Super important. Do this."; // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController(); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = App.Current.EventStore; eventController.Event = newEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate(eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller PresentViewController(eventController, true, null); }
/// <summary> /// Launchs the create new event controller. /// </summary> protected void LaunchModifyEvent() { // first we need to create an event it so we have one that we know exists // in a real world scenario, we'd likely either a) be modifying an event that // we found via a query, or 2) we'd do like this, in which we'd automatically // populate the event data, like for say a dr. appt. reminder, or something EKEvent newEvent = EKEvent.FromStore(CalendarParam.Current.EventStore); // set the alarm for 10 minutes from now newEvent.AddAlarm(EKAlarm.FromDate((NSDate)DateTime.FromFileTime(wkBooking.starting.ToFileTime()))); // make the event start 20 minutes from now and last 30 minutes newEvent.StartDate = (NSDate)DateTime.Now.AddMinutes(20); newEvent.EndDate = (NSDate)DateTime.Now.AddMinutes(50); newEvent.Title = wkBooking.topic; newEvent.Location = AppParam.campusName; newEvent.Notes = wkBooking.description; // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController(); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = CalendarParam.Current.EventStore; eventController.Event = newEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate(eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller PresentViewController(eventController, true, null); }
public void SetReminder(string title) { EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController(); eventStore = new EKEventStore(); eventStore.RequestAccess(EKEntityType.Reminder, (bool granted, NSError i) => { if (granted) { accessGranted = true; } else { accessGranted = false; } }); eventController.EventStore = eventStore; EKReminder reminder = EKReminder.Create(eventController.EventStore); reminder.Title = title; reminder.Calendar = eventController.EventStore.DefaultCalendarForNewReminders; // save the reminder NSError e; eventController.EventStore.SaveReminder(reminder, true, out e); }
protected void LaunchCreateNewEvent(string name, DateTime startTime, DateTime endTime) { // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = ((AppDelegate)UIApplication.SharedApplication.Delegate).EventStore; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; eventController.Event.Title = name; eventController.Event.StartDate = DateTimeToNSDate (startTime); eventController.Event.EndDate = DateTimeToNSDate (endTime); // show the event controller UIViewController topVc = UIApplication.SharedApplication.KeyWindow.RootViewController; topVc.PresentViewController (eventController, true, null); /* EKEventStore store = ((AppDelegate)UIApplication.SharedApplication.Delegate).EventStore; EKEvent newEvent = EKEvent.FromStore (store); newEvent.Title = name; newEvent.StartDate = DateTimeToNSDate (startTime); newEvent.EndDate = DateTimeToNSDate (endTime); newEvent.Calendar = store.DefaultCalendarForNewEvents; NSError err; bool isSuceess = store.SaveEvent(newEvent, EKSpan.ThisEvent, out err); if (isSuceess) { new UIAlertView ("Add suceess", "Suceess add event to your reminder", null, "ok", null).Show (); } else { new UIAlertView ("Add fail", "Fail add event to your reminder", null, "ok", null).Show (); Debug.WriteLine (err.ToString ()); } */ }
/// <summary> /// Launchs the create new event controller. /// </summary> private void LaunchCreateNewEvent() { // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. var eventController = new EventKitUI.EKEventEditViewController { // set the controller's event store - it needs to know where/how to save the event EventStore = EventStore }; // wire up a delegate to handle events from the controller eventController.EditViewDelegate = new CreateEventEditViewDelegate(eventController); // show the event controller base.PresentViewController(eventController, true, null); }
// completed is called when a user eith public override void Completed(EventKitUI.EKEventEditViewController controller, EventKitUI.EKEventEditViewAction action) { this.eventController.DismissViewController(true, null); // action tells you what the user did in the dialog, so you can optionally // do things based on what their action was. additionally, you can get the // Event from the controller.Event property, so for instance, you could // modify the event and then resave if you'd like. switch (action) { case EventKitUI.EKEventEditViewAction.Canceled: break; case EventKitUI.EKEventEditViewAction.Deleted: break; case EventKitUI.EKEventEditViewAction.Saved: // if you wanted to modify the event you could do so here, and then // save: //App.Current.EventStore.SaveEvent ( controller.Event, ) break; } }
public CreateEventEditViewDelegate(EventKitUI.EKEventEditViewController eventController) { // save our controller reference this.eventController = eventController; }
public CreateEventEditViewDelegate (EventKitUI.EKEventEditViewController eventController) { // save our controller reference this.eventController = eventController; }
/// <summary> /// Launchs the create new event controller. /// </summary> protected void LaunchModifyEvent () { // first we need to create an event it so we have one that we know exists // in a real world scenario, we'd likely either a) be modifying an event that // we found via a query, or 2) we'd do like this, in which we'd automatically // populate the event data, like for say a dr. appt. reminder, or something EKEvent newEvent = EKEvent.FromStore (App.Current.EventStore); // set the alarm for 10 minutes from now newEvent.AddAlarm (EKAlarm.FromDate ((NSDate)DateTime.Now.AddMinutes (10))); // make the event start 20 minutes from now and last 30 minutes newEvent.StartDate = (NSDate)DateTime.Now.AddMinutes (20); newEvent.EndDate = (NSDate)DateTime.Now.AddMinutes (50); newEvent.Title = "Get outside and do some exercise!"; newEvent.Notes = "This is your motivational event to go and do 30 minutes of exercise. Super important. Do this."; // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = App.Current.EventStore; eventController.Event = newEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller PresentViewController (eventController, true, null); }
/// <summary> /// Launchs the create new event controller. /// </summary> protected void LaunchCreateNewEvent () { // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = App.Current.EventStore; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller PresentViewController (eventController, true, null); }
protected void LaunchCreateNewEvent () { // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. AppDelegate.EventStore.RequestAccess (EKEntityType.Event, (bool granted, NSError e) => { EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); InvokeOnMainThread (() => { // EKEvent newEvent = EKEvent.FromStore (AppDelegate.EventStore); // newEvent.Title = "Get outside and do some exercise!"; // newEvent.Notes = "This is your motivational event to go and do 30 minutes of exercise. Super important. Do this."; // newEvent.Location = "Seattle,WA"; // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = AppDelegate.EventStore; // eventController.Event = newEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller PresentViewController (eventController, true, null); }); //NavigationController.PushViewController (calendarListScreen, true); }); }
public void LoadEvent(string eventID,LHRemindItem rmItem) { try { if (rmItem!=null) { ItemLH= new LHRemindItem(); ItemLH=rmItem; } else { ItemLT=new LTRemindItem(); } EKEvent mySavedEvent = App.Current.EventStore.EventFromIdentifier (eventID); EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); eventController.EventStore = App.Current.EventStore; eventController.Event = mySavedEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; isUpdate=true; controller.PresentViewController (eventController, true, null); } catch { BRemind.RemoveRemind (SQLite_iOS.GetConnection (), eventID); UIAlertView _error = new UIAlertView ("Lỗi", "Không tìm thấy Nhắc lịch đã tạo", null, "Ok", null); if (VCLichHoc.instance != null) VCLichHoc.Instance.LoadData (); if (VCLichHocTuan.instance != null) VCLichHocTuan.Instance.LoadData_Tuan (VCLichHocTuan.LoadedDate); if (VCLichThi.instance != null) VCLichThi.Instance.LoadData (); _error.Show (); } }
protected void LaunchCreateNewEvent () { // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EKEvent newEvent = EKEvent.FromStore (App.Current.EventStore); // set the alarm for 10 minutes from now newEvent.AddAlarm (EKAlarm.FromDate ((NSDate)srtTime.AddMinutes (-60))); // make the event start 20 minutes from now and last 30 minutes newEvent.StartDate = (NSDate)srtTime; newEvent.EndDate = (NSDate)endTime; newEvent.Title = title; if (title.Equals("Lịch Thi")) { newEvent.Notes = "Môn:" + tenmh + " Phòng Thi: " + lt.PhongThi + " Ghi chú"; ItemLT = new LTRemindItem (); ItemLT.EventID = newEvent.EventIdentifier; ItemLT.MaMH = lt.MaMH; ItemLT.NamHoc = lt.NamHoc; ItemLT.HocKy = lt.HocKy; } else { newEvent.Notes = "Môn:" + tenmh + " Phòng Học:" + ct.Phong + " Ghi chú:"; ItemLH = new LHRemindItem (); ItemLH.EventID = newEvent.EventIdentifier; ItemLH.Date = time; ItemLH.IDLH = lh.Id; } // create a new EKEventEditViewController. This controller is built in an allows // the user to create a new, or edit an existing event. EventKitUI.EKEventEditViewController eventController = new EventKitUI.EKEventEditViewController (); // set the controller's event store - it needs to know where/how to save the event eventController.EventStore = App.Current.EventStore; eventController.Event = newEvent; // wire up a delegate to handle events from the controller eventControllerDelegate = new CreateEventEditViewDelegate (eventController); eventController.EditViewDelegate = eventControllerDelegate; // show the event controller controller.PresentViewController (eventController, true, null); }
public CreateEventEditViewDelegate(EventKitUI.EKEventEditViewController eventController, ScrollReq obj) { // save our controller reference this.eventController = eventController; this.myObject = obj; }