Пример #1
0
        /// <summary>
        /// 从容器集合中获取控件的地址属性信息
        /// </summary>
        /// <param name="CassInfos"></param>
        private void GetAddreesInfo(List <ArrayList> CassInfos)
        {
            int Count = 0;//数组序号

            foreach (ArrayList node in CassInfos)
            {
                CassView curCass = (CassView)(node[1]);
                foreach (ControlInfo ctrl in curCass.ctrlsInfo)
                {
                    if (ctrl.CodeInfo[2] != null && ctrl.VisibleFunctionProperty != null)
                    {//有点名
                        if (ctrl.VisibleFunctionProperty.Count != 0)
                        {
                            foreach (XProp attribute in ctrl.VisibleFunctionProperty)
                            {
                                if (attribute.VarName != CassViewGenerator.portIndex)
                                {//排除可见属性中的点名序号信息
                                    string[] adresInfo = new string[7];
                                    adresInfo[0] = ctrl.CodeInfo[2];
                                    adresInfo[1] = attribute.Name;
                                    adresInfo[6] = attribute.VarName;

                                    if (Length4.Contains(attribute.ValueType))
                                    {
                                        adresInfo[2] = Type4[Length4.IndexOf(attribute.ValueType)];
                                        adresInfo[3] = "4";
                                    }
                                    else if (Length1.Contains(attribute.ValueType))
                                    {//bool和char类统一为uint8 20090621
                                        adresInfo[2] = "uint8";
                                        adresInfo[3] = "1";
                                    }
                                    adresInfo[5] = "False";//初始时地址为空 所以设置可读可写为false

                                    this.AddressInfo.Add(adresInfo);
                                }
                            }
                        }
                    }
                }
                //获取模糊和解耦数据
                List <string[]> tempList = GenerateCode.CatchArrayInfo(curCass, ref Count);
                foreach (string[] element in tempList)
                {
                    this.AddressInfo.Add(ConvertInfo(element));
                }
            }
        }
Пример #2
0
        /// <summary>
        /// 获取对应Cassview中控件的数组信息
        /// </summary>
        /// <param name="curCas"></param>
        /// <param name="count">数组起始序号</param>
        static public List <string[]> CatchArrayInfo(CassView curCass, ref int count)
        {
            List <string[]> Ainfos = new List <string[]>();

            foreach (Control element in curCass.Controls)
            {//获取模糊和解耦的数组信息
                string MS = TypeDescriptor.GetProperties(element)["ModuleSort"].GetValue(element).ToString();
                if (MS == "模糊控制器")
                {
                    string[] info = GenerateCode.GetFuzzyArray(curCass, element, ref count);
                    Ainfos.Add(info);
                }
                else if (MS == "解耦补偿控制器")
                {
                    List <string[]> tempInfos = GenerateCode.GetJieOuArray(curCass, element, ref count);
                    foreach (string[] info in tempInfos)
                    {
                        Ainfos.Add(info);
                    }
                }
            }
            return(Ainfos);
        }
 /// <summary>
 /// 主态图形编辑模式下根据图形信息
 /// 并打开指令页面
 /// </summary>
 private void CreateCodeList()
 {
     GenerateCode newGenCode = new GenerateCode(GetCassinfo());
     this.IOlist = newGenCode.GenerateCodeList();
     this.tempValue = newGenCode.TempInfo;
     this.errorForm.ViewErrorInfo = newGenCode.ViewErrorinfo;//将为连接控件信息赋给错误列表控件
     AddCodeListPage(this.IOlist);
 }