Ejemplo n.º 1
0
        private void pictureBox_controlData_Click(object sender, EventArgs e)
        {
            if (nowEditItem == null)
            {
                MessageBox.Show("can not find edit Parameter Data", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            IRunTimeStaticData editRunTimeStaticData = (IRunTimeStaticData)nowEditItem.Tag;

            if (sender == pb_edit)
            {
                if (!editRunTimeStaticData.DataSet(tb_valueAdd.Text))
                {
                    MessageBox.Show(string.Format("{0} is illegal for this RunTimeStaticData", tb_valueAdd.Text), "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                }
            }
            else if (sender == pb_next)
            {
                editRunTimeStaticData.DataMoveNext();
            }
            else if (sender == pb_reset)
            {
                editRunTimeStaticData.DataReset();
            }
            else
            {
                MessageBox.Show("can not find edit data", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop);
            }
            FreeHttpWindow.MarkRuleItem(nowEditItem);
            nowEditItem.SubItems[2].Text = tb_valueAdd.Text = editRunTimeStaticData.DataCurrent();
        }
Ejemplo n.º 2
0
        public void UpdatalistView_CaseParameter(bool isNew)
        {
            if (isNew)
            {
                MyControlHelper.SetControlFreeze(listView_CaseParameter);
                listView_CaseParameter.BeginUpdate();
                listView_CaseParameter.Items.Clear();
                try
                {
                    //Dictionary<string, IRunTimeStaticData> tempUpdateStaticDataDictionary = null;
                    //Dictionary<string, IRunTimeDataSource> tempUpdateDataSourceDictionary = null;
                    dynamic tempUpdateDictionary = null;
                    switch (nowShowType)
                    {
                    case ShowRunTimeParameterType.KeyValue:
                        tempUpdateDictionary = actuatorStaticDataCollection.RunActuatorStaticDataKeyList;
                        break;

                    case ShowRunTimeParameterType.Parameter:
                        tempUpdateDictionary = actuatorStaticDataCollection.RunActuatorStaticDataParameterList;
                        break;

                    case ShowRunTimeParameterType.DataSouce:
                        tempUpdateDictionary = actuatorStaticDataCollection.RunActuatorStaticDataSouceList;
                        break;

                    default:
                        MessageBox.Show("nonsupport static data type");
                        break;
                    }
                    if (tempUpdateDictionary != null && tempUpdateDictionary.Count > 0)
                    {
                        foreach (var tempKvp in tempUpdateDictionary)
                        {
                            ListViewItem tempItem = new ListViewItem(new string[] { tempKvp.Key, CaseRunTimeDataTypeEngine.dictionaryStaticDataAnnotation[tempKvp.Value.RunTimeStaticDataType][0], tempKvp.Value.DataCurrent() });
                            tempItem.Tag = tempKvp.Value;
                            listView_CaseParameter.Items.Add(tempItem);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                listView_CaseParameter.EndUpdate();
                MyControlHelper.SetControlUnfreeze(listView_CaseParameter);
            }
            else
            {
                foreach (ListViewItem tempItem in listView_CaseParameter.Items)
                {
                    if (actuatorStaticDataCollection.IsHaveSameKey(tempItem.SubItems[0].Text))
                    {
                        IRunTimeStaticData tempStaticData = tempItem.Tag as IRunTimeStaticData;
                        if (tempStaticData != null)
                        {
                            tempItem.SubItems[2].Text = tempStaticData.DataCurrent();
                        }
                        else
                        {
                            UpdatalistView_CaseParameter(true);
                            return;
                        }
                    }
                    else
                    {
                        UpdatalistView_CaseParameter(true);
                        return;
                    }
                }
            }
        }