private void SetStringCommonRules(YmnosStructure ymnosStructure, TypiconEntity typicon)
        {
            CommonRuleServiceRequest req = new CommonRuleServiceRequest()
            {
                RuleSerializer = Serializer
            };

            //добавляем стихи к славнику и богородичну
            if (ymnosStructure.Doxastichon != null)
            {
                //слава
                req.Key = CommonRuleConstants.SlavaText;
                ymnosStructure.Doxastichon.Ymnis[0].Stihoi.Add(typicon.GetCommonRuleItemTextValue(req));
                //и ныне
                if (ymnosStructure.Theotokion?.Count > 0)
                {
                    req.Key = CommonRuleConstants.InyneText;
                    ymnosStructure.Theotokion[0].Ymnis[0].Stihoi.Add(typicon.GetCommonRuleItemTextValue(req));
                }
            }
            else
            {
                //слава и ныне
                if (ymnosStructure.Theotokion?.Count > 0)
                {
                    req.Key = CommonRuleConstants.SlavaInyneText;
                    ymnosStructure.Theotokion[0].Ymnis[0].Stihoi.Add(typicon.GetCommonRuleItemTextValue(req));
                }
            }
        }
Example #2
0
        private string GetKindStringValue(TextHolderKind kind, IRuleHandler handler)
        {
            CommonRuleServiceRequest req = new CommonRuleServiceRequest()
            {
                RuleSerializer = Serializer
            };

            switch (kind)
            {
            case TextHolderKind.Choir:
                req.Key = CommonRuleConstants.ChoirRule;
                break;

            case TextHolderKind.Deacon:
                req.Key = CommonRuleConstants.DeaconRule;
                break;

            case TextHolderKind.Lector:
                req.Key = CommonRuleConstants.LectorRule;
                break;

            case TextHolderKind.Priest:
                req.Key = CommonRuleConstants.PriestRule;
                break;

            case TextHolderKind.Stihos:
                req.Key = CommonRuleConstants.StihosRule;
                break;

            default:
                return(string.Empty);
            }

            return(handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language));
        }
Example #3
0
        public YmnosGroupViewModel(YmnosGroup group, IRuleHandler handler, IRuleSerializerRoot serializer)
        {
            if (group == null || group.Ymnis == null)
            {
                throw new ArgumentNullException("YmnosGroup");
            }
            _group = group;

            _handler = handler ?? throw new ArgumentNullException("handler");

            Serializer = serializer ?? throw new ArgumentNullException("IRuleSerializerRoot");

            Ihos = group.Ihos;

            if (group.Annotation?.IsEmpty == false)
            {
                Annotation = group.Annotation[handler.Settings.Language];
            }

            //текст "Глас"
            CommonRuleServiceRequest req = new CommonRuleServiceRequest()
            {
                RuleSerializer = Serializer
            };

            req.Key  = CommonRuleConstants.IhosText;
            IhosText = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language);

            //если подобен
            if (group.Prosomoion?.IsEmpty == false)
            {
                req.Key    = CommonRuleConstants.ProsomoionText;
                Prosomoion = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language);

                Prosomoion = string.Format(@"{0}: ""{1}""", Prosomoion, group.Prosomoion[handler.Settings.Language]);
            }
            //самоподобен?
            if (group.Prosomoion?.Self == true)
            {
                req.Key = CommonRuleConstants.SelfText;
                Self    = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language);
            }

            //находим Стих и Хор для дальнешей вставки
            req.Key          = CommonRuleConstants.StihosRule;
            _kindStihosValue = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language);

            req.Key         = CommonRuleConstants.ChoirRule;
            _kindChoirValue = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language);
        }
        private static (string StihosText, string ChoirText) GetStringValues(IRuleHandler handler, IRuleSerializerRoot serializer)
        {
            CommonRuleServiceRequest req = new CommonRuleServiceRequest()
            {
                RuleSerializer = serializer
            };

            //находим Стих и Хор для дальнешей вставки
            req.Key = CommonRuleConstants.StihosRule;
            string stihos = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language.Name);

            req.Key = CommonRuleConstants.ChoirRule;
            string choir = handler.Settings.Rule.Owner.GetCommonRuleTextValue(req, handler.Settings.Language.Name);

            return(stihos, choir);
        }
        public static void AppendViewModel(this Prosomoion prosomoion, IRuleHandler handler,
                                           IRuleSerializerRoot serializer, ElementViewModel viewModel, int?ihos = null)
        {
            TypiconEntity            typ = handler.Settings.Rule.Owner;
            CommonRuleServiceRequest req = new CommonRuleServiceRequest()
            {
                RuleSerializer = serializer
            };

            string str = "";

            if (ihos != null)
            {
                //текст "Глас"
                req.Key = CommonRuleConstants.IhosText;
                string ihosString = handler.Settings.Language.IntConverter.ToString((int)ihos);
                str += $"{typ.GetCommonRuleTextValue(req, handler.Settings.Language.Name)} {ihosString}. ";
            }

            //самоподобен?
            if (prosomoion?.Self == true)
            {
                req.Key = CommonRuleConstants.SelfText;
                str    += typ.GetCommonRuleTextValue(req, handler.Settings.Language.Name);
            }
            //если подобен
            else if (prosomoion?.IsEmpty == false)
            {
                req.Key = CommonRuleConstants.ProsomoionText;
                string p = typ.GetCommonRuleTextValue(req, handler.Settings.Language.Name);

                str += $"{p}: \"{ prosomoion[handler.Settings.Language.Name] }\"";
            }

            viewModel.Add(ViewModelItemFactory.Create(TextHolderKind.Text,
                                                      new List <ParagraphViewModel> {
                ParagraphVMFactory.Create(str)
            }));
        }