public AdvancedOptions (bool closeConnectionAfterEachRequest, ProxyOptions proxyOptions, MappingConfigurationBase mappingConfiguration)
    {
      if (proxyOptions == null)
        throw new ArgumentNullException ("proxyOptions");

      _closeConnectionAfterEachRequest = closeConnectionAfterEachRequest;
      _proxyOptions = proxyOptions;
      _mappingConfiguration = mappingConfiguration;
    }
    public static MappingConfigurationBase CoreceMappingConfiguration (OlItemType? outlookFolderType, MappingConfigurationBase mappingConfiguration)
    {
      switch (outlookFolderType)
      {
        case OlItemType.olAppointmentItem:
          if (mappingConfiguration == null || mappingConfiguration.GetType() != typeof (EventMappingConfiguration))
            return new EventMappingConfiguration();
          break;
        case OlItemType.olContactItem:
          if (mappingConfiguration == null || mappingConfiguration.GetType() != typeof (ContactMappingConfiguration))
            return new ContactMappingConfiguration();
          break;
      }

      return mappingConfiguration;
    }
    private MappingConfigurationBase CoreceMappingConfiguration (MappingConfigurationBase mappingConfiguration)
    {
      switch (_folderType)
      {
        case OlItemType.olAppointmentItem:
          if (mappingConfiguration == null || mappingConfiguration.GetType() != typeof (EventMappingConfiguration))
            return new EventMappingConfiguration();
          break;
      }

      return mappingConfiguration;
    }
 private void _mappingConfigurationButton_Click (object sender, EventArgs e)
 {
   try
   {
     var mappingConfiguration = _coerceMappingConfiguration (_mappingConfiguration);
     if (mappingConfiguration != null)
     {
       var configurationForm = mappingConfiguration.CreateConfigurationForm (_configurationFormFactory);
       if (configurationForm.Display())
         _mappingConfiguration = configurationForm.Options;
     }
     else
     {
       MessageBox.Show ("Mapping configuration not available.");
       return;
     }
   }
   catch (Exception x)
   {
     ExceptionHandler.Instance.HandleException (x, s_logger);
   }
 }