/// <summary>
        /// 分析代码中的绑定信息
        /// </summary>
        /// <param name="invocation"></param>
        /// <param name="components"></param>
        private static void AnalysisBindingMembers(string invocation, ComponentItem[] components)
        {
            var  arguments = invocation.Replace(" ", "").Split(',');
            bool isMethod;
            var  lamdaArgs = AnalysisTargetFromLamdaArgument(arguments[0], out isMethod);

            for (int i = 0; i < components.Length; i++)
            {
                var component  = components[i];
                var sourceName = arguments[1].Replace(keyword_address, "");
                var targetName = lamdaArgs[2];
                if (component.name == lamdaArgs[1])
                {
                    BindingShow info = component.viewItems.Find(x => x.bindingTarget == targetName);
                    if (info == null)
                    {
                        info = new BindingShow();
                        component.viewItems.Add(info);
                    }
                    info.bindingSource = sourceName;
                    info.bindingTarget = targetName;
                    info.isMethod      = isMethod;
                    var type = GenCodeUtil.GetTypeClamp(component.componentType, targetName);
                    info.bindingTargetType.Update(type);
                }
            }
        }
Exemplo n.º 2
0
 private void AnalysisBindingMembers(string componentName, string targetName, string sourceName, bool isMethod, ComponentItem[] components)
 {
     for (int i = 0; i < components.Length; i++)
     {
         var component = components[i];
         if (component.name == componentName)
         {
             BindingShow info = component.viewItems.Find(x => x.bindingTarget == targetName);
             if (info == null)
             {
                 info = new BindingShow();
                 component.viewItems.Add(info);
             }
             info.bindingSource = sourceName;
             info.bindingTarget = targetName;
             info.isMethod      = isMethod;
             var type = GenCodeUtil.GetTypeClamp(component.componentType, targetName);
             info.bindingTargetType.Update(type);
         }
     }
 }
Exemplo n.º 3
0
        private void AnalysisBindingEvents(string componentName, string targetName, string sourceName, ComponentItem[] components)
        {
            for (int i = 0; i < components.Length; i++)
            {
                var component = components[i];
                if (component.name == componentName)
                {
                    Type infoType = GenCodeUtil.GetTypeClamp(component.componentType, targetName);
                    var  info     = component.eventItems.Find(x => x.bindingSource == sourceName);

                    if (info == null)
                    {
                        info = new BindingEvent();
                        component.eventItems.Add(info);
                    }

                    info.bindingSource = sourceName;
                    info.bindingTarget = targetName;
                    info.bindingTargetType.Update(infoType);
                    info.type = BindingType.Simple;
                }
            }
        }
        /// <summary>
        /// 事件绑定信息解析
        /// </summary>
        /// <param name="invocation"></param>
        /// <param name="components"></param>
        private static void AnalysisBindingEvents(string invocation, ComponentItem[] components)
        {
            var arguments = invocation.Replace(" ", "").Split(',');
            var arg0s     = arguments[0].Split('.');

            for (int i = 0; i < components.Length; i++)
            {
                var component  = components[i];
                var targetName = arg0s[2];
                var sourceName = arguments[1].Replace(keyword_address, "");

                if (component.name == arg0s[1])
                {
                    Type infoType = GenCodeUtil.GetTypeClamp(component.componentType, targetName);
                    var  info     = component.eventItems.Find(x => x.bindingSource == sourceName);

                    if (info == null)
                    {
                        info = new BindingEvent();
                        component.eventItems.Add(info);
                    }

                    info.bindingSource = sourceName;
                    info.bindingTarget = targetName;
                    info.bindingTargetType.Update(infoType);

                    if (arguments.Length > 2)
                    {
                        info.type = BindingType.Full;//3个参数
                    }
                    else
                    {
                        info.type = BindingType.Simple;//2个参数
                    }
                }
            }
        }