1
A
回答
1
使用EventKit。
首先,你有權要求日曆訪問:
EKEventStore EventStore = new EKEventStore();
EventStore.RequestAccess (EKEntityType.Event,
(bool granted, NSError e) => {
if (granted)
//do something here
else
new UIAlertView ("Access Denied",
"User Denied Access to Calendar Data", null,
"ok", null).Show();
});
要查詢的時間範圍內的所有事件,做這樣的事情:
DateTime startDate = DateTime.Now.AddDays (-7);
DateTime endDate = DateTime.Now;
// the third parameter is calendars we want to look in, to use all calendars, we pass null
NSPredicate query = App.Current.EventStore.PredicateForEvents (startDate, endDate, null);
// execute the query
EKCalendarItem[] events = App.Current.EventStore.EventsMatching (query);
0
你也可以使用Xamarin.Mobile。這將是跨平臺的。
例如,從api docs:
var abook = new AddressBook();
abook.RequestPermissions().ContinueWith (t =>
{
if (!t.Result)
return; // Permission denied
var builder = new StringBuilder();
// Full LINQ support
foreach (Contact c in abook.Where (c => c.FirstName == "Eric" && c.Phones.Any()))
{
builder.AppendLine (c.DisplayName);
foreach (Phone p in c.Phones)
builder.AppendLine (String.Format ("{0}: {1}", p.Label, p.Number));
builder.AppendLine();
}
contacts.Text = builder.ToString(); // Update UI
}, TaskScheduler.FromCurrentSynchronizationContext()); // Ensure we're on the UI Thread
相關問題
- 1. 日曆和內容類型
- 2. 導入Google日曆任務
- 3. 從excel導入日期到Outlook日曆
- 4. 使用C導出和導入日曆數據#
- 5. 內容導入DIV
- 6. 的SharePoint:DateTimeControl內遺址日曆導航
- 7. 內容在CodeIgniter日曆中不可見
- 8. 將內容導入excel表
- 9. Typo3內容導入器
- 10. 將XML內容導入Excel
- 11. 從Google日曆導入時,D日曆日期有錯誤的日期?
- 12. 角引導日曆不顯示日曆
- 13. 將icalendar輸出導入Google日曆
- 14. 谷歌日曆.ics導入標準
- 15. Rails +谷歌日曆事件導入
- 16. 將多個事件導入Android日曆
- 17. 通過CalendarView導入Google日曆
- 18. WordPress博客:導入內容
- 19. concrete5內容導入CIF
- 20. 將內容導入jsf h:inputTextarea
- 21. 將內容導入AEM
- 22. C#webform日曆
- 23. 日曆庫C++
- 24. C日曆庫#
- 25. 具有完整修訂歷史記錄的導出/導入內容mediawiki
- 26. Outlook插件導出日曆
- 27. C#日曆日期格式
- 28. C + +日曆問題
- 29. C#谷歌日曆
- 30. 提醒日曆c#
真棒的感謝! – Goober