/// <summary> /// 更正模糊控件信息中数组属性的数组名并返回数组信息 /// </summary> /// <param name="curCas">控件所在CASSVIEW容器</param> /// <param name="curCtrl">控件</param> /// <param name="ArrayCount">当前所用到队列编号</param> /// <returns>数组信息</returns> static public string[] GetFuzzyArray(CassView curCas, Control curCtrl, ref int ArrayCount) { List <string> ArrayInfo = new List <string>(); PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.Fuzzy ConvertTool = new ControlTactic.SpecialControl.Fuzzy(); ControlTactic.SpecialControl.FuzzyStruct tempStruct = ConvertTool.ListToStruct((List <string>)configurationProperty.GetValue(curCtrl)); ControlInfo Fuzzy = curCas.FindControlInfo(curCtrl); string tempArray = null; for (int row = 0; row < tempStruct.RowNum * 2 + 1; row++) { for (int column = 0; column < tempStruct.ColumnNum * 2 + 1; column++) { tempArray += tempStruct.ControlTable[row, column]; if (row != tempStruct.RowNum * 2 || column != tempStruct.ColumnNum * 2) { tempArray += ","; } } if (row != tempStruct.RowNum - 1) { //tempArray += "\n";//去除每行回车符号 否则导致读取地址表出错BUG20090622 } } //创建模糊控制表参数的数组节点 for (int i = 0; i < Fuzzy.UnvisibleFunctionProperty.Count; i++) { if (Fuzzy.UnvisibleFunctionProperty[i].Name == "模糊控制表") {//ArrayInfo顺序依次为控件PortName、属性VarName、类型、数组名、长度、数组 Fuzzy.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); ArrayInfo.Add(Fuzzy.CodeInfo[2]); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].Name); ArrayInfo.Add("fp32"); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].TheValue.ToString()); ArrayInfo.Add(tempStruct.ControlTable.Length.ToString()); ArrayInfo.Add(tempArray); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].VarName); } } return(ArrayInfo.ToArray()); }
/// <summary> /// ��������ؼ���Ϣ���������Ե�������������������Ϣ /// </summary> /// <param name="curCas">�ؼ�����CASSVIEW����</param> /// <param name="curCtrl">�ؼ�</param> /// <param name="ArrayCount">��ǰ���õ����б��</param> /// <returns>������Ϣ</returns> public static List<string[]> GetJieOuArray(CassView curCas, Control curCtrl,ref int ArrayCount) { List<string[]> ArrayInfos = new List<string[]>();//������Ϣ���� int count = 2;//����·�� //������������Ҫ������������� List<string> NeedAddArray = new List<string>(new string[] { "����", "����", "��", "�趨ֵ", "�Զ�/�ֶ�", "����������", "����������", "���������", "�������IJ���" }); PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.JieOu ConvertTool = new ControlTactic.SpecialControl.JieOu(); ControlTactic.SpecialControl.JieOuStruct tempStruct = ConvertTool.ListToStruct((List<string>)configurationProperty.GetValue(curCtrl)); ControlInfo JieOu = curCas.FindControlInfo(curCtrl); for (int i = 0; i < JieOu.VisibleFunctionProperty.Count; i++) {//�ڿ����������ҵ����������и�ֵ if (JieOu.VisibleFunctionProperty[i].Name == "����·��") { JieOu.VisibleFunctionProperty[i].TheValue = tempStruct.JieOuNum; count = tempStruct.JieOuNum; break; } } //����Ϊ���������֡��֡��趨ֵ���Զ��ֶ������������ޡ����������ޡ�������������� List<string>[] Attributes = new List<string>[] { new List<string>(), new List<string>(), new List<string>(), new List<string>(), new List<string>(), new List<string>(), new List<string>(), new List<string>() }; foreach (List<string> attribute in tempStruct.JieOuAttribute) {//ÿ������ �����ɱ��������֡��֡��趨ֵ���Զ��ֶ������������ޡ����������ޡ������������� Attributes[0].Add(attribute[0]); Attributes[1].Add(attribute[1]); Attributes[2].Add(attribute[2]); Attributes[3].Add(attribute[3]); Attributes[4].Add(new List<string>(new string[] { "�Զ�", "�ֶ�" }).IndexOf(attribute[4]).ToString());//�Զ��ֶ���� Attributes[5].Add(attribute[5]); Attributes[6].Add(attribute[6]); Attributes[7].Add(attribute[7]); } for (int i = 0; i < JieOu.UnvisibleFunctionProperty.Count; i++) { int index = NeedAddArray.IndexOf(JieOu.UnvisibleFunctionProperty[i].Name); if (index != -1) {//ArrayInfo˳������Ϊ�ؼ�PortName������VarName�����͡������������ȡ����� List<string> ArrayInfo = new List<string>(); JieOu.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); ArrayInfo.Add(JieOu.CodeInfo[2]); ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].Name); ArrayInfo.Add("fp32"); ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].TheValue.ToString()); if (index == 8) { List<string> tempArray = new List<string>(); foreach (string element in tempStruct.JieOuTable) { tempArray.Add(element); } ArrayInfo.Add(tempArray.Count.ToString()); ArrayInfo.Add(String.Join(",", tempArray.ToArray())); } else { ArrayInfo.Add(Attributes[index].Count.ToString()); ArrayInfo.Add(String.Join(",", Attributes[index].ToArray())); } if (index == 4) {//�Զ�/�ֶ�Ϊchar�� ArrayInfo[2] = "uint8"; } ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].VarName); ArrayInfos.Add(ArrayInfo.ToArray()); } else if (JOUnuseArray.Contains(JieOu.UnvisibleFunctionProperty[i].Name)) {//��ʹ�õ����鸳ֵ JieOu.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); List<string> tempValue = new List<string>();//���ɽ���·����ȫ0���� for (int k = 0; k < count; k++) { tempValue.Add("0"); } UnseeArray.Add(new string[] { null, null, "fp32", JieOu.UnvisibleFunctionProperty[i].TheValue.ToString(), count.ToString(), String.Join(",", tempValue.ToArray()) }); } } return ArrayInfos; }
/// <summary> /// ����ģ���ؼ���Ϣ���������Ե�������������������Ϣ /// </summary> /// <param name="curCas">�ؼ�����CASSVIEW����</param> /// <param name="curCtrl">�ؼ�</param> /// <param name="ArrayCount">��ǰ���õ����б��</param> /// <returns>������Ϣ</returns> public static string[] GetFuzzyArray(CassView curCas, Control curCtrl, ref int ArrayCount) { List<string> ArrayInfo = new List<string>(); PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.Fuzzy ConvertTool = new ControlTactic.SpecialControl.Fuzzy(); ControlTactic.SpecialControl.FuzzyStruct tempStruct = ConvertTool.ListToStruct((List<string>)configurationProperty.GetValue(curCtrl)); ControlInfo Fuzzy = curCas.FindControlInfo(curCtrl); string tempArray = null; for (int row = 0; row < tempStruct.RowNum * 2 + 1; row++) { for (int column = 0; column < tempStruct.ColumnNum * 2 + 1; column++) { tempArray += tempStruct.ControlTable[row, column]; if (row != tempStruct.RowNum * 2 || column != tempStruct.ColumnNum * 2) { tempArray += ","; } } if (row != tempStruct.RowNum - 1) { //tempArray += "\n";//ȥ��ÿ�лس����� �����¶�ȡ��ַ�����BUG20090622 } } //����ģ�����Ʊ����������ڵ� for (int i = 0; i < Fuzzy.UnvisibleFunctionProperty.Count; i++) { if (Fuzzy.UnvisibleFunctionProperty[i].Name == "ģ�����Ʊ�") {//ArrayInfo˳������Ϊ�ؼ�PortName������VarName�����͡������������ȡ����� Fuzzy.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); ArrayInfo.Add(Fuzzy.CodeInfo[2]); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].Name); ArrayInfo.Add("fp32"); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].TheValue.ToString()); ArrayInfo.Add(tempStruct.ControlTable.Length.ToString()); ArrayInfo.Add(tempArray); ArrayInfo.Add(Fuzzy.UnvisibleFunctionProperty[i].VarName); } } return ArrayInfo.ToArray(); }
/// <summary> /// 更正解耦控件信息中数组属性的数组名并返回数组信息 /// </summary> /// <param name="curCas">控件所在CASSVIEW容器</param> /// <param name="curCtrl">控件</param> /// <param name="ArrayCount">当前所用到队列编号</param> /// <returns>数组信息</returns> static public List <string[]> GetJieOuArray(CassView curCas, Control curCtrl, ref int ArrayCount) { List <string[]> ArrayInfos = new List <string[]>(); //返回信息数组 int count = 2; //解耦路数 //解耦属性中需要生成数组的属性 List <string> NeedAddArray = new List <string>(new string[] { "比例", "积分", "微分", "设定值", "自动/手动", "控制量上限", "控制量下限", "控制量输出", "解耦矩阵的参数" }); PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.JieOu ConvertTool = new ControlTactic.SpecialControl.JieOu(); ControlTactic.SpecialControl.JieOuStruct tempStruct = ConvertTool.ListToStruct((List <string>)configurationProperty.GetValue(curCtrl)); ControlInfo JieOu = curCas.FindControlInfo(curCtrl); for (int i = 0; i < JieOu.VisibleFunctionProperty.Count; i++) {//在可视属性中找到解耦数进行赋值 if (JieOu.VisibleFunctionProperty[i].Name == "解耦路数") { JieOu.VisibleFunctionProperty[i].TheValue = tempStruct.JieOuNum; count = tempStruct.JieOuNum; break; } } //依次为比例、积分、微分、设定值、自动手动、控制量上限、控制量下限、控制量输出数组 List <string>[] Attributes = new List <string>[] { new List <string>(), new List <string>(), new List <string>(), new List <string>(), new List <string>(), new List <string>(), new List <string>(), new List <string>() }; foreach (List <string> attribute in tempStruct.JieOuAttribute) {//每个属性 依次由比例、积分、微分、设定值、自动手动、控制量上限、控制量下限、控制量输出组成 Attributes[0].Add(attribute[0]); Attributes[1].Add(attribute[1]); Attributes[2].Add(attribute[2]); Attributes[3].Add(attribute[3]); Attributes[4].Add(new List <string>(new string[] { "自动", "手动" }).IndexOf(attribute[4]).ToString());//自动手动序号 Attributes[5].Add(attribute[5]); Attributes[6].Add(attribute[6]); Attributes[7].Add(attribute[7]); } for (int i = 0; i < JieOu.UnvisibleFunctionProperty.Count; i++) { int index = NeedAddArray.IndexOf(JieOu.UnvisibleFunctionProperty[i].Name); if (index != -1) {//ArrayInfo顺序依次为控件PortName、属性VarName、类型、数组名、长度、数组 List <string> ArrayInfo = new List <string>(); JieOu.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); ArrayInfo.Add(JieOu.CodeInfo[2]); ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].Name); ArrayInfo.Add("fp32"); ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].TheValue.ToString()); if (index == 8) { List <string> tempArray = new List <string>(); foreach (string element in tempStruct.JieOuTable) { tempArray.Add(element); } ArrayInfo.Add(tempArray.Count.ToString()); ArrayInfo.Add(String.Join(",", tempArray.ToArray())); } else { ArrayInfo.Add(Attributes[index].Count.ToString()); ArrayInfo.Add(String.Join(",", Attributes[index].ToArray())); } if (index == 4) {//自动/手动为char型 ArrayInfo[2] = "uint8"; } ArrayInfo.Add(JieOu.UnvisibleFunctionProperty[i].VarName); ArrayInfos.Add(ArrayInfo.ToArray()); } else if (JOUnuseArray.Contains(JieOu.UnvisibleFunctionProperty[i].Name)) {//不使用的数组赋值 JieOu.UnvisibleFunctionProperty[i].TheValue = "configuration" + CassViewGenerator.ProjectNum + "_array" + (ArrayCount++).ToString(); List <string> tempValue = new List <string>();//生成解耦路数个全0数组 for (int k = 0; k < count; k++) { tempValue.Add("0"); } UnseeArray.Add(new string[] { null, null, "fp32", JieOu.UnvisibleFunctionProperty[i].TheValue.ToString(), count.ToString(), String.Join(",", tempValue.ToArray()) }); } } return(ArrayInfos); }
private void OperateDoing(ref Operation Opt) { switch (Opt.Oname) { case "比例放大": { cassview.Scaling = Convert.ToSingle(Opt.Change[1]); break; } case "比例缩小": { cassview.Scaling = Convert.ToSingle(Opt.Change[1]); break; } case "控件删除": { for (int i = 0; i < cassview.Controls.Count; i++) { if (cassview.Controls[i].Site.Name == ((Control)Opt.Item).Tag.ToString()) { cassview.Controls.RemoveAt(i); break; } } break; } case "控件添加": { CreateControl(ref Opt); cassview.Controls.Add((Control)Opt.Item); cassview.ctrlsInfo.Add((ControlInfo)Opt.Change[2]); cassview.blocksInfo.Add((BlockInfo)Opt.Change[3]); if (Opt.Change.Length > 4) { for (int i = 4; i < Opt.Change.Length; i++) { Opt.Change[i] = AddnewLine((LineInfo)Opt.Change[i]); } } cassview.portReflash(); cassview.DrawBackgroundImage(); break; } case "控件移动": { BlockInfo tempBinfo = (BlockInfo)Opt.Change[1]; for (int i = 0; i < cassview.blocksInfo.Count; i++) { int x = cassview.Controls.Count; if (cassview.blocksInfo[i].BlockNum == ((BlockInfo)Opt.Change[0]).BlockNum) { foreach (Control element in cassview.Controls) { PropertyDescriptor Number = TypeDescriptor.GetProperties(element)["SerialNumber"]; if (Number != null && Number.GetValue(element).ToString() == cassview.blocksInfo[i].BlockNum.ToString()) { element.Location = new Point(tempBinfo.StartPoint.X + 5, tempBinfo.StartPoint.Y + 5); Opt.Item = element; break; } } } } break; } case "控件置前": { ((Control)Opt.Item).BringToFront(); break; } case "控件置后": { ((Control)Opt.Item).SendToBack(); break; } case "直线删除": { cassview.DeleteLine(GetLineinfoNum((LineInfo)Opt.Item), true); break; } case "直线添加": { Opt.Item = AddnewLine((LineInfo)Opt.Item); break; } case "属性修改": { if (Opt.Change[0].ToString() == "模块点名") { foreach (Control element in cassview.Controls) { if (element.Tag.ToString() == ((Control)Opt.Item).Tag.ToString()) { //找到删除后新建的控件 Opt.Item = element; break; } } string Cmname = TypeDescriptor.GetProperties((Control)Opt.Item)["ModuleName"].GetValue((Control)Opt.Item).ToString(); //当前控件模块名 CassView.ModifyPortName(Cmname, Opt.Change[1].ToString(), Opt.Change[2].ToString()); PropertyDescriptor portNameProperty = TypeDescriptor.GetProperties((Control)Opt.Item)["PortName"]; cassview.FindControlInfo((Control)Opt.Item).CodeInfo[2] = Cmname + Opt.Change[2].ToString(); portNameProperty.SetValue((Control)Opt.Item, Cmname + Opt.Change[2].ToString()); for (int i = 0; i < cassview.ctrlsInfo.Count; i++) { if (cassview.ctrlsInfo[i].ControlName == ((Control)Opt.Item).Site.Name && cassview.ctrlsInfo[i].VisibleFunctionProperty != null) { for (int j = 0; j < cassview.ctrlsInfo[i].VisibleFunctionProperty.Count; j++) { if (cassview.ctrlsInfo[i].VisibleFunctionProperty[j].Name == "模块点名") { cassview.ctrlsInfo[i].VisibleFunctionProperty[j].TheValue = Opt.Change[2]; } } break; } } } else { CassViewGenerator.SpecialValueChange(cassview, (Control)Opt.Item, Opt.Change[0].ToString(), Opt.Change[1], Opt.Change[2]); CassViewGenerator.SetCodeInfo(cassview, (Control)Opt.Item, Opt.Change[0].ToString(), Opt.Change[2].ToString()); } break; } } }
/// <summary> /// ��������������ڵ� /// </summary> /// <param name="curCas">�ؼ�����CASSVIEW����</param> /// <param name="curCtrl">�ؼ�</param> /// <returns>�ڵ�</returns> private XmlNode CreateProcess(CassView curCas, Control curCtrl) { PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.Process ConvertTool = new ControlTactic.SpecialControl.Process(); ControlTactic.SpecialControl.ProcessStruct tempStruct = ConvertTool.ListToStruct((List<string>)configurationProperty.GetValue(curCtrl)); tempStruct = AddID(tempStruct); XmlElement Process = document.CreateElement("ConditionAction"); ControlInfo currentCtrl = curCas.FindControlInfo(curCtrl); Process.SetAttribute("name", currentCtrl.CodeInfo[2]); if (tempStruct.IsOnlyStart) { for (int i = 0; i < tempStruct.NumOfConditions; i++) {//�������������Ϣ���������� if (tempStruct.Conditions[i] == "") { continue; } XmlElement newItem = document.CreateElement("item"); XmlElement newCondition = document.CreateElement("condition"); newCondition.InnerText = tempStruct.Conditions[i]; newItem.AppendChild(newCondition); XmlElement newExpression = document.CreateElement("expression"); newExpression.InnerText = "condition[" + i.ToString() + "] = 1"; newItem.AppendChild(newExpression); Process.AppendChild(newItem); } } for (int Aindex = 0; Aindex < tempStruct.NumOfActions; Aindex++) { XmlElement newItem = document.CreateElement("item"); if (tempStruct.Actions[Aindex][0] == "" || (tempStruct.Actions[Aindex][1] == "" && tempStruct.Actions[Aindex][2] == "")) {//����Ϊ�ջ������ı��ʽΪ�� continue; } for (int Cindex = 0; Cindex < tempStruct.NumOfConditions; Cindex++) { string Condition = null; if (tempStruct.OrderBox[Cindex, Aindex] == "" || tempStruct.Conditions[Cindex] == "") {//���˳����ϵΪ�� ���Ӧ������Ϊ�������� continue; } else if (tempStruct.OrderBox[Aindex, Cindex] == "N") {//�ǹ�ϵ���ϣ� Condition = "!"; } if (tempStruct.IsOnlyStart) {//�������������趨�ж���ʾ�������黹�DZ��ʽ Condition += "condition[" + Cindex.ToString() + "]"; } else { Condition += "(" + tempStruct.Conditions[Cindex] + ")"; } XmlElement newCondition = document.CreateElement("condition"); newCondition.InnerText = Condition; newItem.AppendChild(newCondition); } if (newItem.ChildNodes.Count == 0) {//���û��������Ĭ��Ϊ1 �������"1"�����ӽڵ� XmlElement newCondition = document.CreateElement("condition"); newCondition.InnerText = "1"; newItem.AppendChild(newCondition); } XmlElement newExpression = document.CreateElement("expression"); if (tempStruct.Actions[Aindex][0] == "Evaluate") { newExpression = document.CreateElement("expression"); newExpression.InnerText = tempStruct.Actions[Aindex][1] + "=" + tempStruct.Actions[Aindex][2]; } else if (tempStruct.Actions[Aindex][0] == "Transfer") { newExpression = document.CreateElement("function"); newExpression.InnerText = Mid + tempStruct.Actions[Aindex][1] + Sid; } newItem.AppendChild(newExpression); Process.AppendChild(newItem); } return Process; }
/// <summary> /// ������������̬�ڵ� /// </summary> /// <param name="curCas">�ؼ�����CASSVIEW����</param> /// <param name="curCtrl">�ؼ�</param> /// <returns>�ڵ�</returns> private XmlNode CreateCalculator(CassView curCas, Control curCtrl) { PropertyDescriptor configurationProperty = TypeDescriptor.GetProperties(curCtrl)["Configuration"]; ControlTactic.SpecialControl.Calculator ConvertTool = new ControlTactic.SpecialControl.Calculator(); List<List<string>> tempvalue = (List<List<string>>)configurationProperty.GetValue(curCtrl); XmlElement Calculator = document.CreateElement("Calculator"); ControlInfo currentCtrl = curCas.FindControlInfo(curCtrl); Calculator.SetAttribute("name", currentCtrl.CodeInfo[2]); if (tempvalue.Count != 0) { Calculator.SetAttribute("name", currentCtrl.CodeInfo[2]); foreach (List<string> express in tempvalue) { if (express[0] != null || express[1] != null || express[2] != null) { XmlElement newItem = document.CreateElement("item"); if (express[0] != null) { XmlElement condition = document.CreateElement("condition"); condition.InnerText = ChangeExpress(express[0], currentCtrl.CodeInfo[2]); newItem.AppendChild(condition); } if (express[1] != null && express[2] != null) { XmlElement expression = document.CreateElement("expression"); expression.InnerText = ChangeExpress(express[2] + "=" + express[1], currentCtrl.CodeInfo[2]); newItem.AppendChild(expression); } Calculator.AppendChild(newItem); } } } else { } return Calculator; }
/// <summary> /// 修改解耦路数时需要对应修改解耦控件相关的信息 /// </summary> /// <param name="cassView">控件所在容器</param> /// <param name="control">控件</param> /// <param name="oldValue">修改前解耦路数</param> /// <param name="newValue">修改后解耦路数</param> private static void ModifyCLinfo(CassView cassView, Control control, int oldValue, int newValue) { ControlInfo JieOu = cassView.FindControlInfo(control); if (newValue >= 2 && newValue <= 10) {//解耦路数必须大于等于2否则还原 //修改控件信息中解耦的输出输入端口数目 PropertyDescriptor configurationPropertyI = TypeDescriptor.GetProperties(control)["InputNum"]; PropertyDescriptor configurationPropertyO = TypeDescriptor.GetProperties(control)["OutputNum"]; configurationPropertyI.SetValue(control, newValue); configurationPropertyO.SetValue(control, newValue); JieOu.InputInfo = CassView.InitializeIOinfo(newValue, JieOu.InputInfo);//解耦控件没有端口初值20090616 JieOu.OutputInfo = CassView.InitializeIOinfo(newValue); for (int i = 0; i < cassView.ctrlsInfo.Count; i++) {//将修改后的控件信息覆盖原有的控件信息 if (cassView.ctrlsInfo[i].ControlNum == JieOu.ControlNum) { cassView.ctrlsInfo[i] = JieOu; } } if (oldValue > newValue) {//当修改后解耦路数小于原先,则删除缩减端口对应的直线 for (int i = cassView.linesInfo.Count - 1; i >= 0; i--)//从后往前删线信息 { if (((string)(control.Tag) == cassView.linesInfo[i].StartInfo.Split(';')[0] && (Convert.ToInt32(cassView.linesInfo[i].StartInfo.Split(',')[1]) >= newValue)) || (((string)(control.Tag) == cassView.linesInfo[i].EndInfo.Split(';')[0]) && Convert.ToInt32(cassView.linesInfo[i].EndInfo.Split(',')[1]) >= newValue)) {//直线的输入或输出信息对应当前控件且端口号大于修改后的值则删除 cassView.DeleteLine(i, false); } } } cassView.portReflash();//刷新端口及连线信息 cassView.DrawBackgroundImage();//刷新背景图 SetJoConfigInfo(control, Convert.ToInt32(oldValue), newValue);//修改控件端口外观 } else {//还原端口旧值 JieOu.VisibleFunctionProperty[0].TheValue = (oldValue); MessageBox.Show("解耦路数必须大于等于2小于等于10!"); } }
/// <summary> /// 处理解耦和模糊控件的组态属性修改 /// </summary> /// <param name="cassView"></param> /// <param name="control"></param> /// <param name="ChangeItem"></param> /// <param name="OldValue"></param> /// <param name="ChangeValue"></param> public static void SpecialValueChange(CassView cassView, Control control, string ChangeItem, object OldValue, object ChangeValue) { if (ChangeItem == "解耦路数") {//当修改解耦路数时修改组态属性对应的所有信息20090610 ModifyCLinfo(cassView, control, Convert.ToInt32(OldValue), Convert.ToInt32(ChangeValue)); } else if (ChangeItem == "解耦控制组态") {//对解耦路数赋值 ControlInfo JieOu = cassView.FindControlInfo(control); for (int i = 0; i < JieOu.VisibleFunctionProperty.Count; i++) { if (JieOu.VisibleFunctionProperty[i].Name == "解耦路数") {//解耦中可视属性第一个即序号[0]为解耦路数 ModifyCLinfo(cassView, control, Convert.ToInt32(JieOu.VisibleFunctionProperty[i].TheValue), Convert.ToInt32(((List<string>)ChangeValue)[0])); JieOu.VisibleFunctionProperty[i].TheValue = ((List<string>)ChangeValue)[0]; break; } } } if (ChangeItem == "偏差模糊论域" || ChangeItem == "偏差变化率模糊论域") {//当修改模糊论域时修改组态属性对应的所有信息20090708 SetFzConfigInfo(control, ChangeItem, Convert.ToInt32(OldValue), Convert.ToInt32(ChangeValue)); } else if (ChangeItem == "模糊控制表") { ControlInfo Fuzzy = cassView.FindControlInfo(control); for (int i = 0; i < Fuzzy.VisibleFunctionProperty.Count; i++) { if (Fuzzy.VisibleFunctionProperty[i].Name == "偏差模糊论域") {//更新不可见属性中的模糊论域(值为行数/2,位置为不可见属性第[1]位) Fuzzy.VisibleFunctionProperty[i].TheValue = ((List<string>)ChangeValue)[0]; } else if (Fuzzy.VisibleFunctionProperty[i].Name == "偏差变化率模糊论域") {//模糊变化域(值为列数/2,位置为不可见属性第[2]位)20090611 Fuzzy.VisibleFunctionProperty[i].TheValue = ((List<string>)ChangeValue)[1]; } } } }