Ejemplo n.º 1
0
        public UIPresenter(int localeCultureId)
        {
            UIAspect <T>            aspect        = UIAspect <T> .Instance;
            GlobalizationAspect <T> globalization = GlobalizationAspect <T> .Instance;
            RestrictionAspect <T>   restrictions  = RestrictionAspect <T> .Instance;
            InterceptorAspect <T>   interceptors  = InterceptorAspect <T> .Instance;

            this._Controls = new List <TControl>(aspect.Count);

            foreach (SingleAnnotationAspectMember <UIControlAttribute> child in aspect)
            {
                int globalizationOrdinal = globalization.GetOrdinal(child.Name);

                GlobalizationList globalizationList = globalizationOrdinal >= 0 ?
                                                      globalization[globalizationOrdinal].Terms : null;

                string label = globalizationList == null ? null : globalizationList.GetTerm("label", localeCultureId);
                string hint  = globalizationList == null ? null : globalizationList.GetTerm("hint", localeCultureId);

                _Controls.Add(CreateControl(
                                  child,
                                  string.IsNullOrEmpty(label) ? child.Annotation.DefaultLabel : label,
                                  string.IsNullOrEmpty(hint) ? child.Annotation.DefaultHint : hint,
                                  localeCultureId,
                                  restrictions.GetRestrictionList(child.Name),
                                  interceptors.GetInterceptorList(child.Name),
                                  globalizationList));
            }
        }
Ejemplo n.º 2
0
        public void GlobalizationLabelTest()
        {
            GlobalizationAspect exampleGlobalization = GlobalizationAspect <Example> .Instance;

            string item = exampleGlobalization["FirstName"].GetTerm("label", "pt-BR");

            Assert.IsNotNull(item);
        }