示例#1
0
文件: DataManage.cs 项目: houxpGit/12
        static public short ShortValue(string strGroupName, string strItemName)
        {
            short sReturn = 0;

            try
            {
                sReturn = short.Parse(m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue.ToString());
            }
            catch
            {
                if (m_Doc.m_dataDictionary.ContainsKey(strGroupName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在组名字为:" + strGroupName + "的参数据");
                    ProjectDataS group = new ProjectDataS();
                    m_Doc.m_dataDictionary.Add(strGroupName, group);
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.ContainsKey(strItemName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + "不存在名字为:" + strItemName + "的参数");
                    ProjectDataBase data = new ProjectDataBase();
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.Add(strItemName, data);
                    data.strName  = strItemName;
                    data.dataType = ProjectDataType.SHORT;
                    data.objValue = 0;
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType != ProjectDataType.SHORT)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + ":" + strItemName + "的参数" + "不是Short");
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType = ProjectDataType.SHORT;
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue = 0;
                }
            }
            return(sReturn);
        }
示例#2
0
文件: DataManage.cs 项目: houxpGit/12
        static public string StrValue(string strGroupName, string strItemName)
        {
            string strReturn = "";

            try
            {
                strReturn = m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue.ToString();
            }
            catch
            {
                if (m_Doc.m_dataDictionary.ContainsKey(strGroupName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在组名字为:" + strGroupName + "的参数据");
                    ProjectDataS group = new ProjectDataS();
                    m_Doc.m_dataDictionary.Add(strGroupName, group);
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.ContainsKey(strItemName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + "不存在名字为:" + strItemName + "的参数");
                    ProjectDataBase data = new ProjectDataBase();
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.Add(strItemName, data);
                    data.strName  = strItemName;
                    data.dataType = ProjectDataType.STRING;
                    data.objValue = "";
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType != ProjectDataType.STRING)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + ":" + strItemName + "的参数" + "不是字符");
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType = ProjectDataType.STRING;
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue = "";
                }
            }
            return(strReturn);
        }
示例#3
0
文件: DataManage.cs 项目: houxpGit/12
        static public bool BOOLValue(string strGroupName, string strItemName)
        {
            bool bReturn = false;

            try
            {
                bReturn = bool.Parse(m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue.ToString());
            }
            catch
            {
                if (m_Doc.m_dataDictionary.ContainsKey(strGroupName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在组名字为:" + strGroupName + "的参数据");
                    ProjectDataS group = new ProjectDataS();
                    m_Doc.m_dataDictionary.Add(strGroupName, group);
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.ContainsKey(strItemName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + "不存在名字为:" + strItemName + "的参数");
                    ProjectDataBase data = new ProjectDataBase();
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.Add(strItemName, data);
                    data.strName  = strItemName;
                    data.dataType = ProjectDataType.BOOL;
                    data.objValue = false;
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType != ProjectDataType.BOOL)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + ":" + strItemName + "的参数" + "不是布尔型");
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType = ProjectDataType.BOOL;
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue = false;
                }
            }
            return(bReturn);
        }
示例#4
0
文件: DataManage.cs 项目: houxpGit/12
        static public double DoubleValue(string strGroupName, string strItemName)
        {
            double dReturn = 0.0;

            try
            {
                dReturn = double.Parse(m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue.ToString());
            }
            catch
            {
                if (m_Doc.m_dataDictionary.ContainsKey(strGroupName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("不存在组名字为:" + strGroupName + "的参数据");
                    ProjectDataS group = new ProjectDataS();
                    m_Doc.m_dataDictionary.Add(strGroupName, group);
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.ContainsKey(strItemName) == false)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + "不存在名字为:" + strItemName + "的参数");
                    ProjectDataBase data = new ProjectDataBase();
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary.Add(strItemName, data);
                    data.strName  = strItemName;
                    data.dataType = ProjectDataType.DOUBLE;
                    data.objValue = 0.0;
                }
                if (m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType != ProjectDataType.DOUBLE)
                {
                    MainModule.FormMain.m_formAlarm.InsertAlarmMessage("参数组:" + strGroupName + ":" + strItemName + "的参数" + "浮点型的");
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].dataType = ProjectDataType.DOUBLE;
                    m_Doc.m_dataDictionary[strGroupName].m_dataDictionary[strItemName].objValue = 0.0;
                }
            }
            return(dReturn);
        }
示例#5
0
        private void buttonAddGroup_Click(object sender, EventArgs e)
        {
            if (textBoxGroupName.Text == "")
            {
                return;
            }
            try
            {
                ProjectDataS data = new ProjectDataS();
                DataManage.m_Doc.m_dataDictionary.Add(textBoxGroupName.Text, data);
                DataManage.m_Doc.m_dataList.Add(data);
                data.strGroupName = textBoxGroupName.Text;

                DataGridViewRow rowAdd = new DataGridViewRow();

                DataGridViewTextBoxCell IoNameCell = new DataGridViewTextBoxCell();
                IoNameCell.Value = data.strGroupName;

                DataGridViewTextBoxCell RemarkCell = new DataGridViewTextBoxCell();
                RemarkCell.Value = data.strRemark;

                rowAdd.Cells.Add(IoNameCell);
                rowAdd.Cells.Add(RemarkCell);
                dataGridGroup.Rows.Add(rowAdd);
            }
            catch
            {
            }
        }
示例#6
0
        private void dataGridGroup_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            string       strGroupName = dataGridGroup.Rows[e.RowIndex].Cells[0].Value.ToString();
            ProjectDataS dataList     = DataManage.m_Doc.m_dataList[e.RowIndex];

            frmItem.UpdateData(dataList);
            frmItem.Show();
        }
示例#7
0
        private void dataGridGroup_CellValidated(object sender, DataGridViewCellEventArgs e)
        {
            string       strGroupName = dataGridGroup.Rows[e.RowIndex].Cells[0].Value.ToString();
            ProjectDataS dataDis      = DataManage.m_Doc.m_dataDictionary[strGroupName];
            ProjectDataS dataList     = DataManage.m_Doc.m_dataList[e.RowIndex];

            dataDis.strRemark  = dataGridGroup.Rows[e.RowIndex].Cells[1].Value.ToString();
            dataList.strRemark = dataGridGroup.Rows[e.RowIndex].Cells[1].Value.ToString();
        }
示例#8
0
        public void UpdateData(ProjectDataS iDatas)
        {
            if (iDatas == null)
            {
            }
            else
            {
                dataGridViewOutput.Rows.Clear();
                datas       = iDatas;
                label3.Text = datas.strGroupName;
                foreach (ProjectDataBase item in datas.m_dataList)
                {
                    DataGridViewRow rowAdd = new DataGridViewRow();

                    DataGridViewTextBoxCell NameCell = new DataGridViewTextBoxCell();
                    NameCell.Value = item.strName;



                    DataGridViewComboBoxCell DataTypeCell = new DataGridViewComboBoxCell();
                    foreach (ProjectDataType itemType in Enum.GetValues(typeof(ProjectDataType)))
                    {
                        DataTypeCell.Items.Add(itemType);
                    }

                    DataTypeCell.Value = item.dataType;


                    DataGridViewTextBoxCell ValueCell = new DataGridViewTextBoxCell();
                    ValueCell.Value = item.objValue;


                    DataGridViewTextBoxCell RemarkCell = new DataGridViewTextBoxCell();
                    RemarkCell.Value = item.strRemark;

                    rowAdd.Cells.Add(NameCell);
                    rowAdd.Cells.Add(DataTypeCell);
                    rowAdd.Cells.Add(ValueCell);
                    rowAdd.Cells.Add(RemarkCell);
                    dataGridViewOutput.Rows.Add(rowAdd);
                }
            }
        }
示例#9
0
        private string MakeDataItemText(ProjectDataS datas)
        {
            string strReturn = "";

            if (datas.m_dataList.Count < 1)
            {
                return(strReturn);
            }

            string strTempHeader = "using System;\r\n";

            strTempHeader += "using System.Collections.Generic;\r\n";
            strTempHeader += "using System.Linq;\r\n";
            strTempHeader += "using System.Text;\r\n";
            strTempHeader += "using System.Threading.Tasks;\r\n";
            strTempHeader += "\r\n";
            strTempHeader += "namespace ControlPlatformLib\r\n";
            strTempHeader += "{\r\n";
            strTempHeader += "   public static class " + "Data" + datas.strGroupName + "\r\n";
            strTempHeader += "   {\r\n";
            strReturn      = strTempHeader;
            string strItemHeader    = "      public static string ";// WEIDONGYUAN = "weidongyuan";
            string strItemName      = "";
            string strItemOperation = " = ";
            string strValue         = "";
            string strItemEnd       = " ;\r\n";

            foreach (ProjectDataBase item in datas.m_dataList)
            {
                strItemName = item.strName;
                strValue    = "\"" + strItemName + "\"";
                strReturn  += strItemHeader + strItemName + strItemOperation + strValue + strItemEnd;
            }

            string strTempEnd = "   }\r\n";

            strTempEnd += "}\r\n";
            strReturn  += strTempEnd;
            return(strReturn);
        }
示例#10
0
        private void FormProjectDataSetting_Load(object sender, EventArgs e)
        {
            foreach (ProjectDataS item in DataManage.m_Doc.m_dataList)
            {
                DataGridViewRow rowAdd = new DataGridViewRow();

                DataGridViewTextBoxCell IoNameCell = new DataGridViewTextBoxCell();
                IoNameCell.Value = item.strGroupName;

                DataGridViewTextBoxCell RemarkCell = new DataGridViewTextBoxCell();
                RemarkCell.Value = item.strRemark;

                rowAdd.Cells.Add(IoNameCell);
                rowAdd.Cells.Add(RemarkCell);
                dataGridGroup.Rows.Add(rowAdd);
            }
            if (dataGridGroup.Rows.Count > 0)
            {
                string       strGroupName = dataGridGroup.Rows[0].Cells[0].Value.ToString();
                ProjectDataS dataList     = DataManage.m_Doc.m_dataList[0];
                frmItem          = new FormProjectDataItemMonitor(dataList);
                frmItem.TopLevel = false;
                panel1.Controls.Add(frmItem);
                frmItem.Size = panel1.Size;
                frmItem.Show();
            }
            else
            {
                frmItem          = new FormProjectDataItemMonitor();
                frmItem.TopLevel = false;
                panel1.Controls.Add(frmItem);
                frmItem.Size = panel1.Size;
                frmItem.Show();
                frmItem.Hide();
            }
        }
示例#11
0
 public FormProjectDataItemSetting(ProjectDataS iDatas)
 {
     InitializeComponent();
     datas = iDatas;
 }
示例#12
0
 public FormProjectDataItemMonitor(ProjectDataS iDatas)
 {
     InitializeComponent();
     datas = iDatas;
 }