예제 #1
0
        internal static void MapProperties(BlazorComponent o)
        {
            var mappedProperties = DevUtils
                                   .GetAllProperties(o)
                                   .Where(x => x.CustomAttributes.Any(y => y.AttributeType == typeof(DevMapAttribute)));

            foreach (var property in mappedProperties)
            {
                Dev.Map(o, property.GetValue(o),
                        ((DevMapAttribute)property.GetCustomAttributes(typeof(DevMapAttribute), false)[0]).MapName);
            }
        }
예제 #2
0
        internal static void MapFields(BlazorComponent o)
        {
            var mappedFields = DevUtils
                               .GetAllFields(o)
                               .Where(x => x.CustomAttributes.Any(y => y.AttributeType == typeof(DevMapAttribute)));

            foreach (var field in mappedFields)
            {
                Dev.Map(o, field.GetValue(o),
                        ((DevMapAttribute)field.GetCustomAttributes(typeof(DevMapAttribute), false)[0]).MapName);
            }
        }
예제 #3
0
        /// <summary>
        /// Map C# referance type instance to Js object with custom name.
        /// </summary>
        /// <param name="context">Component that contains the object, mostly 'this' keyword.</param>
        /// <param name="o">Reference type object</param>
        /// <param name="name">Js variable name</param>
        public static void Map(BlazorComponent context, object o, string name, [CallerFilePath] string filePath = null, [CallerLineNumber] int lineNumber = 0)
        {
            if (!(context is DevComponent))
            {
                return;
            }

            //Add DevBoot Js code
            DevUtils.DevBoot();

            AddToOrUpdateObjectList(o, name);
            UpdateMappingLayer();

            DevUtils.DevWarn($"Mapped {o.GetType().FullName} object in {filePath} at line {lineNumber}.");
        }
 public NObservableBlazorComponentHelper(BlazorComponent component)
 {
     _component = component;
 }
예제 #5
0
 /// <see cref="IState.Subscribe(BlazorComponent)"/>
 public void Subscribe(BlazorComponent subscriber) => Feature.Subscribe(subscriber);