/// <summary> /// Loads all server calendars for the account into ServerCalendars /// </summary> private void LoadServerCalendars() { using (Data.OwnCloudDataContext context = new OwnCloudDataContext()) { //Get the account, to get the Url, where we can get all calendars var account = context.Accounts.Where(o => o.GUID == _accountId).Single(); //Get clear credentials if (account.IsEncrypted) { account.RestoreCredentials(); } //Create caldav client to get all calendars Net.OcCalendarClient ocClient = new Net.OcCalendarClient(account.GetUri().AbsoluteUri, new Net.OwncloudCredentials { Username = account.Username, Password = account.Password }, account.CalDAVPath); //Load calendars ocClient.LoadCalendarInfoComplete += LoadCalendarInfoComplete; ocClient.LoadCalendarInfo(); } }
/// <summary> /// Loads all server calendars for the account into ServerCalendars /// </summary> private async Task LoadServerCalendars() { using (var context = new OwnCloudDataContext()) { //Get the account, to get the Url, where we can get all calendars var account = await App.AccountService.GetAccountByID(_accountId.Value); //Get clear credentials await App.AccountService.RestoreCredentials(account); //Create caldav client to get all calendars var ocClient = new Net.OcCalendarClient(account.GetUri().AbsoluteUri, new Net.OwncloudCredentials { Username = account.Username, Password = account.Password }, account.CalDAVPath); //Load calendars ocClient.LoadCalendarInfoComplete += LoadCalendarInfoComplete; ocClient.LoadCalendarInfo(); } }
/// <summary> /// Loads all server calendars for the account into ServerCalendars /// </summary> private void LoadServerCalendars() { using (var context = new OwnCloudDataContext()) { //Get the account, to get the Url, where we can get all calendars var account = context.Accounts.Where(o => o.GUID == _accountId).Single(); //Get clear credentials if (account.IsEncrypted) account.RestoreCredentials(); //Create caldav client to get all calendars var ocClient = new Net.OcCalendarClient(account.GetUri().AbsoluteUri , new Net.OwncloudCredentials { Username = account.Username, Password = account.Password }, account.CalDAVPath); //Load calendars ocClient.LoadCalendarInfoComplete += LoadCalendarInfoComplete; ocClient.LoadCalendarInfo(); } }