Ejemplo n.º 1
0
        public override void Filter()
        {
            var filterText = FilterSpan.GetText(FilterSpan.TextBuffer.CurrentSnapshot);
            Predicate <Completion> predicate = delegate(Completion completion)
            {
                var startIndex = completion.DisplayText.StartsWith(InitialApplicableTo, StringComparison.OrdinalIgnoreCase) ? InitialApplicableTo.Length : 0;
                return(completion.DisplayText.IndexOf(filterText, startIndex, StringComparison.OrdinalIgnoreCase) != -1);
            };

            if (Completions.Any(current => predicate(current)))
            {
                completions.Filter(predicate);
            }
        }
Ejemplo n.º 2
0
        public override void ViewAppeared()
        {
            IndexClientName = string.Empty;
            IsRelation      = false;

            base.ViewAppeared();
            var indexJson = _settings.GetValue(nameof(IndexClientDTO), "");

            if (!string.IsNullOrWhiteSpace(indexJson))
            {
                IsRelation     = true;
                IndexClientDTO = JsonConvert.DeserializeObject <IndexClientDTO>(indexJson);
                if (null != IndexClientDTO)
                {
                    MoveNextLabel     = "SAVE";
                    IndexClientName   = $"Relation To Index [{IndexClientDTO}]";
                    Title             = $"Profile [{IndexClientDTO.RelType}]";
                    RelationshipTypes = RelationshipTypes
                                        .Where(x => x.Description.ToLower() == IndexClientDTO.RelType.ToLower()).ToList();
                }
            }

            var preventEnroll = _settings.GetValue("PreventEnroll", "");

            if (!string.IsNullOrWhiteSpace(preventEnroll))
            {
                MoveNextLabel = Convert.ToBoolean(preventEnroll) ? "SAVE" : "NEXT";
            }

            var educationsJson  = _settings.GetValue("lookup.Education", "");
            var completionsJson = _settings.GetValue("lookup.Completion", "");
            var occupationsJson = _settings.GetValue("lookup.Occupation", "");

            if (!string.IsNullOrWhiteSpace(educationsJson) && !Educations.Any())
            {
                Educations = JsonConvert.DeserializeObject <List <CategoryItem> >(educationsJson);
            }

            if (!string.IsNullOrWhiteSpace(completionsJson) && !Completions.Any())
            {
                Completions = JsonConvert.DeserializeObject <List <CategoryItem> >(completionsJson);
            }

            if (!string.IsNullOrWhiteSpace(occupationsJson) && !Occupations.Any())
            {
                Occupations = JsonConvert.DeserializeObject <List <CategoryItem> >(occupationsJson);
            }
        }