コード例 #1
0
        private Boolean MatchesContentFilter(TranslationItemViewModel translationLine)
        {
            if (String.IsNullOrWhiteSpace(ContentFilter))
            {
                return(true);
            }
            switch (CurrentContainsMode.FilterMode)
            {
            case ContainFilterMode.Either:
                foreach (var filter in _contentFilters)
                {
                    if (translationLine.TranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0 ||
                        translationLine.UnTranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                }
                return(false);

            case ContainFilterMode.Both:
                foreach (var filter in _contentFilters)
                {
                    if (translationLine.TranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0 &&
                        translationLine.UnTranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                }
                return(false);

            case ContainFilterMode.Translated:
                foreach (var filter in _contentFilters)
                {
                    if (translationLine.TranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                }
                return(false);

            case ContainFilterMode.Untranslated:
                foreach (var filter in _contentFilters)
                {
                    if (translationLine.UnTranslatedSingleLine.IndexOf(filter, StringComparison.InvariantCultureIgnoreCase) >= 0)
                    {
                        return(true);
                    }
                }
                return(false);

            default:
                return(true);
            }
        }
コード例 #2
0
 public Boolean MatchesFilter(TranslationItemViewModel translationLine)
 {
     if (translationLine == null)
     {
         return(false);
     }
     return((!TranslatedFilter.HasValue || translationLine.IsTranslated == TranslatedFilter.Value) &&
            (!EditingFilter.HasValue || translationLine.HasChangesInEditor == EditingFilter.Value) &&
            (String.IsNullOrWhiteSpace(AddressFilter) || translationLine.Address.StartsWith(AddressFilter, StringComparison.InvariantCultureIgnoreCase)) &&
            (SelectedGroups.Count == 0 || (InverseGroupFilter && !SelectedGroups.Contains(translationLine.Group)) || (!InverseGroupFilter && SelectedGroups.Contains(translationLine.Group))) &&
            MatchesContentFilter(translationLine) &&
            (!PotentialOverflowFilter || translationLine.TranslatedLineLength > 320 && translationLine.LineLengthDifference > 0) &&
            (!PotentialRepointIssueFilter || translationLine.RemainingLength < 0 && translationLine.PointerText.References.Where(r => r.Repoint).Count() != 1)
            );
 }