Пример #1
0
 /// <see cref="MarkupExtension.ProvideValue"/>
 public override object ProvideValue(IServiceProvider serviceProvider)
 {
     TypeArguments.Add(TypeArgument);
     ConstructorArguments.Add(App.Container);
     ConstructorArguments.Add(Name);
     return(base.ProvideValue(serviceProvider));
 }
Пример #2
0
        void CreateArguments()
        {
            int count = Constructor == null ? 0 : Constructor.MethodSig.GetParamCount();

            while (ConstructorArguments.Count > count)
            {
                ConstructorArguments.RemoveAt(ConstructorArguments.Count - 1);
            }
            while (ConstructorArguments.Count < count)
            {
                var type = Constructor.MethodSig.Params[ConstructorArguments.Count];
                ConstructorArguments.Add(new CAArgumentVM(ownerModule, CreateCAArgument(type), new TypeSigCreatorOptions(ownerModule, language), type));
            }
        }
Пример #3
0
        void InitializeFrom(CustomAttributeOptions options)
        {
            IsRawData     = options.RawData != null;
            RawData.Value = options.RawData;
            Constructor   = options.Constructor;
            ConstructorArguments.Clear();
            var sig = Constructor == null ? null : Constructor.MethodSig;

            for (int i = 0; i < options.ConstructorArguments.Count; i++)
            {
                TypeSig type = null;
                if (sig != null && i < sig.Params.Count)
                {
                    type = sig.Params[i];
                }
                ConstructorArguments.Add(new CAArgumentVM(ownerModule, options.ConstructorArguments[i], new TypeSigCreatorOptions(ownerModule, language), type));
            }
            CANamedArgumentsVM.InitializeFrom(options.NamedArguments);
            CreateArguments();
        }