1
0
mirror of https://github.com/XFox111/GUTSchedule.git synced 2026-04-22 06:58:01 +03:00

Almost done app

This commit is contained in:
Michael Gordeev
2019-12-21 16:06:59 +03:00
parent 93f84aaf40
commit 7747c23804
39 changed files with 9707 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
using System.Collections.Generic;
using Android.App;
using Android.Database;
using Android.Provider;
using Android.Support.V4.Content;
namespace GUT.Schedule
{
public static class Calendar
{
public static void LoadCalendars()
{
Data.Calendars = new List<(string, string)>();
var calendarsUri = CalendarContract.Calendars.ContentUri;
string[] calendarsProjection = {
CalendarContract.Calendars.InterfaceConsts.Id,
CalendarContract.Calendars.InterfaceConsts.CalendarDisplayName,
CalendarContract.Calendars.InterfaceConsts.AccountName,
CalendarContract.Calendars.InterfaceConsts.OwnerAccount,
CalendarContract.Calendars.InterfaceConsts.AccountType,
};
using CursorLoader loader = new CursorLoader(Application.Context, calendarsUri, calendarsProjection, null, null, null);
ICursor cursor = (ICursor)loader.LoadInBackground();
cursor.MoveToNext();
for (int i = 0; i < cursor.Count; i++)
{
if (cursor.GetString(4) == "com.google" && !cursor.GetString(3).Contains("google"))
Data.Calendars.Add((cursor.GetString(0), $"{cursor.GetString(1)} ({cursor.GetString(2)})"));
cursor.MoveToNext();
}
}
}
}