DoesSupportCalendarQuery() публичный Метод

public DoesSupportCalendarQuery ( ) : Task
Результат Task
 private static async Task<CalendarProperties> GetCalendarProperties (CalDavDataAccess calDavDataAccess)
 {
   return
       (await calDavDataAccess.IsCalendarAccessSupported() ? CalendarProperties.CalendarAccessSupported : CalendarProperties.None) |
       (await calDavDataAccess.IsWriteable() ? CalendarProperties.IsWriteable : CalendarProperties.None) |
       (await calDavDataAccess.DoesSupportCalendarQuery() ? CalendarProperties.SupportsCalendarQuery : CalendarProperties.None);
 }
    public static async Task<TestResult> TestConnection (Uri url, IWebDavClient webDavClient, ResourceType supposedRessourceType)
    {
      var calDavDataAccess = new CalDavDataAccess (url, webDavClient);
      var cardDavDataAccess = new CardDavDataAccess (url, webDavClient);

      TestResult result;


      switch (supposedRessourceType)
      {
        case ResourceType.None:
          var ressourceType =
              (await calDavDataAccess.IsResourceCalender() ? ResourceType.Calendar : ResourceType.None) |
              (await cardDavDataAccess.IsResourceAddressBook() ? ResourceType.AddressBook : ResourceType.None);

          result = new TestResult (
              ressourceType,
              ressourceType.HasFlag (ResourceType.Calendar) ? await GetCalendarProperties (calDavDataAccess) : CalendarProperties.None,
              ressourceType.HasFlag (ResourceType.AddressBook) ? await GetAddressBookProperties (cardDavDataAccess) : AddressBookProperties.None);
              break;

        case ResourceType.Calendar:
          result = new TestResult (
              supposedRessourceType,
              CalendarProperties.CalendarAccessSupported |
              (await calDavDataAccess.IsWriteable() ? CalendarProperties.IsWriteable : CalendarProperties.None) |
              (await calDavDataAccess.DoesSupportCalendarQuery() ? CalendarProperties.SupportsCalendarQuery : CalendarProperties.None),
              AddressBookProperties.None);
          break;
        
        case ResourceType.AddressBook:
          result = new TestResult (
              supposedRessourceType,
              CalendarProperties.None,
              AddressBookProperties.AddressBookAccessSupported |
              (await cardDavDataAccess.IsWriteable() ? AddressBookProperties.IsWriteable : AddressBookProperties.None));
          break;
        
        default:
          throw new ArgumentOutOfRangeException ("supposedRessourceType");
      }

      return result;
    }
    public static async Task<TestResult> TestConnection (Uri url, IWebDavClient webDavClient, ResourceType autoRessourceType)
    {
      var calDavDataAccess = new CalDavDataAccess (url, webDavClient);
      var cardDavDataAccess = new CardDavDataAccess (url, webDavClient);

      TestResult result;

      if (autoRessourceType == ResourceType.None)
      {
        var ressourceType =
          (await calDavDataAccess.IsResourceCalender() ? ResourceType.Calendar : ResourceType.None) |
          (await cardDavDataAccess.IsResourceAddressBook() ? ResourceType.AddressBook : ResourceType.None);

        result = new TestResult(
          ressourceType,
          ressourceType.HasFlag(ResourceType.Calendar) ? await GetCalendarProperties(calDavDataAccess) : CalendarProperties.None,
          ressourceType.HasFlag(ResourceType.AddressBook) ? await GetAddressBookProperties(cardDavDataAccess) : AddressBookProperties.None);
      }
      else if (autoRessourceType == ResourceType.Calendar)
      {
        result = new TestResult(
          autoRessourceType,
          CalendarProperties.CalendarAccessSupported |
          (await calDavDataAccess.IsWriteable() ? CalendarProperties.IsWriteable : CalendarProperties.None) |
          (await calDavDataAccess.DoesSupportCalendarQuery() ? CalendarProperties.SupportsCalendarQuery : CalendarProperties.None),
          AddressBookProperties.None);
      }
      else
      {
        result = new TestResult(
          autoRessourceType,
          CalendarProperties.None,
          AddressBookProperties.AddressBookAccessSupported |
          (await cardDavDataAccess.IsWriteable() ? AddressBookProperties.IsWriteable : AddressBookProperties.None));
      }

      return result;
    }
        private void TestServerConnection()
        {
            const string connectionTestCaption = "Test settings";

              try
              {
            StringBuilder errorMessageBuilder = new StringBuilder();
            if (!ValidateCalendarUrl (errorMessageBuilder))
            {
              MessageBox.Show (errorMessageBuilder.ToString(), "The calendar Url is invalid", MessageBoxButtons.OK, MessageBoxIcon.Error);
              return;
            }

            var dataAccess = new CalDavDataAccess (
            new Uri (_calenderUrlTextBox.Text),
            new CalDavWebClient (
                _userNameTextBox.Text,
                _passwordTextBox.Text,
                TimeSpan.Parse (ConfigurationManager.AppSettings["calDavConnectTimeout"]),
                TimeSpan.Parse (ConfigurationManager.AppSettings["calDavReadWriteTimeout"]),
                Boolean.Parse (ConfigurationManager.AppSettings["disableCertificateValidation"]),
                Boolean.Parse (ConfigurationManager.AppSettings["enableSsl3"]),
                Boolean.Parse (ConfigurationManager.AppSettings["enableTls12"]))
            );

            if (!dataAccess.IsCalendarAccessSupported())
              MessageBox.Show ("The specified Url does not support calendar access!", connectionTestCaption);

            if (!dataAccess.IsResourceCalender())
              MessageBox.Show ("The specified Url is not a calendar!", connectionTestCaption);

            if (!dataAccess.IsWriteableCalender())
              MessageBox.Show ("The specified Url is a read-only calendar!", connectionTestCaption);

            if (!dataAccess.DoesSupportCalendarQuery ())
              MessageBox.Show ("The specified Url does not support Calendar Queries!", connectionTestCaption);

            MessageBox.Show ("Connection test successful.", connectionTestCaption);
              }
              catch (Exception x)
              {
            MessageBox.Show (x.Message, connectionTestCaption);
              }
        }
    private async Task<bool> TestCalendar (CalDavDataAccess calDavDataAccess, StringBuilder errorMessageBuilder)
    {
      bool hasError = false;

      if (!await calDavDataAccess.IsCalendarAccessSupported())
      {
        errorMessageBuilder.AppendLine ("- The specified Url does not support calendar access.");
        hasError = true;
      }

      if (!await calDavDataAccess.IsWriteable())
      {
        errorMessageBuilder.AppendLine ("- The specified Url is a read-only calendar.");
        hasError = true;
      }

      if (!await calDavDataAccess.DoesSupportCalendarQuery())
      {
        errorMessageBuilder.AppendLine ("- The specified Url does not support Calendar Queries.");
        hasError = true;
      }

      if (_folderType != OlItemType.olAppointmentItem && _folderType != OlItemType.olTaskItem)
      {
        errorMessageBuilder.AppendLine ("- The outlook folder is not a calendar or task folder, or there is no folder selected.");
        hasError = true;
      }

      return hasError;
    }