コード例 #1
0
        public ColorCategoryMapper(IOutlookSession outlookSession, IColorMappingsDataAccess colorMappingsDataAccess)
        {
            _colorMappingsDataAccess = colorMappingsDataAccess;
            _outlookSession          = outlookSession ?? throw new ArgumentNullException(nameof(outlookSession));

            var mappingEntries = colorMappingsDataAccess.Load();

            _categoryByHtmlColor = mappingEntries.ToDictionary(e => e.HtmlColor, StringComparer.OrdinalIgnoreCase);

            _outlookColorByCategory = outlookSession.GetCategories()
                                      .Where(c => c.Color != OlCategoryColor.olCategoryColorNone)
                                      .ToDictionary(c => c.Name, c => c.Color, StringComparer.InvariantCultureIgnoreCase);
        }
 public ColorCategoryMapperFactory(IOutlookSession outlookSession, IColorMappingsDataAccess colorMappingsDataAccess)
 {
     if (outlookSession == null)
     {
         throw new ArgumentNullException(nameof(outlookSession));
     }
     if (colorMappingsDataAccess == null)
     {
         throw new ArgumentNullException(nameof(colorMappingsDataAccess));
     }
     _outlookSession          = outlookSession;
     _colorMappingsDataAccess = colorMappingsDataAccess;
 }