Ejemplo n.º 1
0
        private void Initialize()
        {
            SetTitle();
            SetSubtitle();
            SetPartOfSpeech();

            if (_model.ShowVariants.ContainsKey(Dictionary.ShowVariantsTypes.Label))
            {
                Label = _model.ShowVariants[Dictionary.ShowVariantsTypes.Label];
            }
            else
            {
                Label = string.Empty;
            }

            if (_model.ShowVariants.ContainsKey(Dictionary.ShowVariantsTypes.SortKey))
            {
                SortKey = _model.ShowVariants[Dictionary.ShowVariantsTypes.SortKey];
            }
            else
            {
                SortKey = string.Empty;
            }

            if (Hacks.NeedSwitchShowVariants(Index.BaseId) && !string.IsNullOrEmpty(Subtitle))
            {
                string title = Title;
                Title    = Subtitle;
                Subtitle = title;
            }

            _morphoTableIndex = _dictionaryService.FindMorphoTable(Title);
        }
Ejemplo n.º 2
0
        public string GetArticle()
        {
            _locker.WaitOne();

            StringBuilder articleStyles = new StringBuilder();

            foreach (int styleId in _articleStyles)
            {
                articleStyles.Append(HtmlBuilder.CreateStyle(styleId, _allStyles[styleId]));
            }

            string bodyStyle = "columns";

            if (!_renderParameters.Columns || Hacks.NeedDisableColumns())
            {
                bodyStyle = "simpl";
            }

            string html = _htmlTemplate;

            html = html.Replace("[[styles]]", articleStyles.ToString());
            html = html.Replace("[[label]]", _label);
            html = html.Replace("[[body_style]]", bodyStyle);
            html = html.Replace("[[article_height]]", _renderParameters.ArticleHeight.ToString());
            html = html.Replace("[[body]]", _article.ToString());
            return(html);
        }
Ejemplo n.º 3
0
        private void CheckDirection()
        {
            if (Hacks.NeedDisableAutoSwitchDirection(_dictBaseId))
            {
                return;
            }

            if (LanguageFrom != null && !string.IsNullOrEmpty(_searchQuery))
            {
                if (_dictionary.NeedSwitchDirection(_searchQuery, LanguageFrom))
                {
                    SwitchDirection();
                }
            }
        }
Ejemplo n.º 4
0
        private void FillAdditionalArticles()
        {
            AdditionalArticles.Clear();

            var lists = _lists.Where(l => l.Type == Dictionary.WordListTypes.AdditionalInfo);

            foreach (Dictionary.WordList list in lists)
            {
                if (Hacks.NeedExcludeAddtionalList(list.TypeId))
                {
                    continue;
                }

                AdditionalArticles.Add(new AdditionalArticlesList(list));
            }
        }