コード例 #1
0
        public static async Task <AutoDiscoveryResult> DoAutoDiscovery(Uri autoDiscoveryUri, IWebDavClient webDavClient, bool useWellKnownCalDav, bool useWellKnownCardDav, OlItemType?selectedOutlookFolderType)
        {
            var calDavDataAccess = new CalDavDataAccess(autoDiscoveryUri, webDavClient);
            IReadOnlyList <Tuple <Uri, string, string> > foundCaldendars = await calDavDataAccess.GetUserCalendarsNoThrow(useWellKnownCalDav);

            var cardDavDataAccess = new CardDavDataAccess(autoDiscoveryUri, webDavClient);
            IReadOnlyList <Tuple <Uri, string> > foundAddressBooks = await cardDavDataAccess.GetUserAddressBooksNoThrow(useWellKnownCardDav);

            if (foundCaldendars.Count > 0 || foundAddressBooks.Count > 0)
            {
                using (SelectResourceForm listCalendarsForm = new SelectResourceForm(foundCaldendars, foundAddressBooks, selectedOutlookFolderType == OlItemType.olContactItem))
                {
                    if (listCalendarsForm.ShowDialog() == DialogResult.OK)
                    {
                        return(new AutoDiscoveryResult(new Uri(autoDiscoveryUri.GetLeftPart(UriPartial.Authority) + listCalendarsForm.SelectedUrl), false, listCalendarsForm.ResourceType));
                    }
                    else
                    {
                        return(new AutoDiscoveryResult(null, true, ResourceType.None));
                    }
                }
            }
            else
            {
                MessageBox.Show(useWellKnownCalDav ? "No resources were found via well-known URLs!" : "No resources were found via autodiscovery!", OptionTasks.ConnectionTestCaption);
                return(new AutoDiscoveryResult(null, false, ResourceType.None));
            }
        }
コード例 #2
0
    private async Task<AutoDiscoveryResult> DoAutoDiscovery (Uri autoDiscoveryUri, IWebDavClient webDavClient, bool useWellKnownUrl)
    {
      var calDavDataAccess = new CalDavDataAccess (autoDiscoveryUri, webDavClient);
      IReadOnlyList<Tuple<Uri, string>> foundCaldendars = await calDavDataAccess.GetUserCalendarsNoThrow (useWellKnownUrl);

      var cardDavDataAccess = new CardDavDataAccess (autoDiscoveryUri, webDavClient);
      IReadOnlyList<Tuple<Uri, string>> foundAddressBooks = await cardDavDataAccess.GetUserAddressBooksNoThrow (useWellKnownUrl);

      if (foundCaldendars.Count > 0 || foundAddressBooks.Count > 0)
      {
        using (SelectResourceForm listCalendarsForm = new SelectResourceForm (foundCaldendars, foundAddressBooks, _folderType == OlItemType.olContactItem))
        {
          if (listCalendarsForm.ShowDialog() == DialogResult.OK)
            return new AutoDiscoveryResult (new Uri (autoDiscoveryUri.GetLeftPart (UriPartial.Authority) + listCalendarsForm.SelectedUrl), false, listCalendarsForm.ResourceType);
          else
            return new AutoDiscoveryResult (null, true, ResourceType.None);
        }
      }
      else
      {
        MessageBox.Show ("No resources were found via autodiscovery!", c_connectionTestCaption);
        return new AutoDiscoveryResult (null, false, ResourceType.None);
      }
    }