コード例 #1
0
        private void FormModelSelect_Load(object sender, EventArgs e)
        {
            for (int i = 0; i < m_lstDebugModel.Count; i++)
            {
                dgvFunction.Rows.Add(
                    DebugOperate.GetProperty(m_lstDebugModel[i], "ModelName"),
                    DebugOperate.GetProperty(m_lstDebugModel[i], "ModelDesc")
                    );
            }

            lblModelCount.Text = $"模块数量: {m_lstDebugModel.Count}";
            btnSelect.Enabled  = m_lstDebugModel.Count != 0;
        }
コード例 #2
0
        /// <summary>
        /// 设置变量/属性值
        /// </summary>
        /// <param name="type">变量/属性</param>
        /// <param name="name">参数名称</param>
        /// <param name="value">参数值</param>
        /// <returns>执行结果</returns>
        private bool SetFieldPropertyValue(string type, string name, object value)
        {
            string errMsg;

            if (type == "变量")
            {
                DebugOperate.SetField(m_projectObject, name, value, out errMsg);
            }
            else
            {
                DebugOperate.SetProperty(m_projectObject, name, value, out errMsg);
            }

            if (string.IsNullOrEmpty(errMsg))
            {
                dgvFP.SelectedRows[0].Cells["Value"].Value = value;
                return(true);
            }
            else
            {
                MessageBox.Show($"数值修改失败: {errMsg}", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }
        }
コード例 #3
0
        private void BtnRefresh_Click(object sender, EventArgs e)
        {
            //刷新控件信息
            for (int i = 0; i < dgvControl.Rows.Count; i++)
            {
                dgvControl.Rows[i].Cells["Text"].Value = (dgvControl.Rows[i].Cells["Object"].Value as Control).Text;
            }

            //刷新变量属性数值
            for (int i = 0; i < dgvFP.Rows.Count; i++)
            {
                string type = (dgvFP.Rows[i].Cells["类型"].Value as string).Substring(0, 2);
                string name = dgvFP.Rows[i].Cells["Name"].Value as string;

                if (type == "变量")
                {
                    dgvFP.Rows[i].Cells["Value"].Value = DebugOperate.GetField(m_projectObject, name);
                }
                else
                {
                    dgvFP.Rows[i].Cells["Value"].Value = DebugOperate.GetProperty(m_projectObject, name);
                }
            }
        }