Esempio n. 1
0
 public CloudCreator(Config config, IWordReader wordReader, ITextFilter textFilter, IDrawer drawer, ITagMaker tagMaker)
 {
     this.config     = config;
     this.textFilter = textFilter;
     this.wordReader = wordReader;
     this.drawer     = drawer;
     this.tagMaker   = tagMaker;
 }
Esempio n. 2
0
 public CensusRepository(string connectionString)
 {
     _connectionString = connectionString ??
                         throw new ArgumentNullException(nameof(connectionString));
     _connection   = new MySqlConnection(_connectionString);
     _filter       = new StandardTextFilter();
     _queryBuilder = new MySqlQueryBuilder(_filter);
 }
        /// <summary>
        ///     Sets the filter that will be used for target view.
        /// </summary>
        /// <param name="textField">Target view.</param>
        /// <param name="filter">Filter to apply.</param>
        public static void SetFilter(this UITextView textField, ITextFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            textField.ShouldChangeText = (field, range, text) =>
            {
                return(filter.ShouldChangeText(field, field.Text, range, text));
            };
        }
        /// <summary>
        ///     Sets the filter that will be used for target view.
        /// </summary>
        /// <param name="textField">Target view.</param>
        /// <param name="filter">Filter to apply.</param>
        public static void SetFilter(this UITextField textField, ITextFilter filter)
        {
            if (filter == null)
            {
                throw new ArgumentNullException(nameof(filter));
            }

            textField.ShouldChangeCharacters = (field, range, replacementString) =>
            {
                return(filter.ShouldChangeText(field, field.Text, range, replacementString));
            };
        }
Esempio n. 5
0
    public void Filter(ITextFilter filter)
    {
        // If there's no original items, then there's nothing
        // to filter and the collection won't ever change.
        if (_originalItems.Count > 0)
        {
            // Replace the items with the
            // original items that meet the filter.
            _items.Clear();
            _items.AddRange(_originalItems.Where((x) => x.Filter(filter)));

            OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
        }
    }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvImporter"/> class.
        /// </summary>
        /// <param name="connectionString">The connection string.</param>
        /// <exception cref="ArgumentNullException">connectionString</exception>
        public CsvImporter(string connectionString)
        {
            _connectionString = connectionString ??
                                throw new ArgumentNullException(nameof(connectionString));
            _displayFilter = new WhitespaceTextFilter();
            _indexFilter   = new StandardTextFilter
            {
                PreserveDigits = true
            };

            _yearRegex = new Regex(@"^\s*(\d+)\s*$");

            // separators for altri soci (inconsistent)
            _otherSeps = new[] { ',', '/' };
        }
Esempio n. 7
0
 /// <summary>
 /// Gets the core filter from this model.
 /// </summary>
 /// <returns>Filter.</returns>
 public ActFilter GetFilter(ITextFilter filter)
 {
     return(new ActFilter
     {
         PageNumber = PageNumber,
         PageSize = PageSize,
         ArchiveId = ArchiveId.GetValueOrDefault(),
         BookId = BookId.GetValueOrDefault(),
         BookYearMin = BookYearMin.GetValueOrDefault(),
         BookYearMax = BookYearMax.GetValueOrDefault(),
         Description = filter.Apply(Description),
         ActTypeId = ActTypeId.GetValueOrDefault(),
         FamilyId = FamilyId.GetValueOrDefault(),
         CompanyId = CompanyId.GetValueOrDefault(),
         PlaceId = PlaceId.GetValueOrDefault(),
         Label = filter.Apply(Label),
         CategoryIds = ParseIds(CategoryIds),
         ProfessionIds = ParseIds(ProfessionIds),
         PartnerIds = ParseIds(PartnerIds)
     });
 }
Esempio n. 8
0
 public MySqlQueryBuilder(ITextFilter filter)
 {
     _tokenHelper = new MySqlTokenHelper();
     _filter      = filter;
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CensusController"/> class.
 /// </summary>
 /// <param name="repository">The repository.</param>
 /// <param name="filter">The text filter.</param>
 public CensusController(ICensusRepository repository, ITextFilter filter)
 {
     _repository = repository;
     _filter     = filter;
 }