コード例 #1
0
ファイル: Form1.cs プロジェクト: fr830/DAQ-2
 private void onAddBtnComponent(object sender, EventArgs e)
 {
     form_Btn              = new BtnComponent();
     form_Btn.Name         = "按钮类型";
     form_Btn.setBtnValue += new SetValueHandler(_setBtnValue);
     form_Btn.ChangeBtnState(form_Btn.isCreateMode);
     form_Btn.ShowDialog();
 }
コード例 #2
0
ファイル: Form1.cs プロジェクト: fr830/DAQ-2
        private void onDouleClickItem(object sender, EventArgs e)
        {
            //  System.Console.WriteLine("onDouleClickItem");
            List <string> comValue = new List <string>();
            ListViewItem  item     = listView1.FocusedItem;

            for (int i = 0; i < item.SubItems.Count; i++)
            {
                comValue.Add(item.SubItems[i].Text);
            }
            if (listView1.SelectedItems.Count != 0)
            {
                int componentType = int.Parse(comValue[0]);
                if (componentType == (int)ComponentType.BtnComponent)
                {
                    BtnComponent form2 = new BtnComponent();
                    form2.Name           = "按钮类型";
                    form2.setBtnValue   += new SetValueHandler(_setBtnValue);
                    form2.removeHandler += new RemoveHandler(_removeHandler);
                    form2.saveHandler   += new SaveHandler(_saveHandler);
                    form2.ChangeBtnState(ChangeMode.Change);

                    Component com = new Component();
                    com.componentType   = int.Parse(comValue[0]);
                    com.isEnable_Input  = comValue[1];
                    com.data_Type       = (DataType)Enum.Parse(typeof(DataType), comValue[2]);
                    com.operatorType    = OperatorType._On;
                    com.offset          = comValue[4];
                    com.in_word_offset  = comValue[5];
                    com.in_bit_offset   = comValue[6];
                    com.out_word_offset = comValue[7];
                    com.out_bit_offset  = comValue[8];
                    if (comValue.Count >= 9 && !string.IsNullOrEmpty(comValue[9]))
                    {
                        com.note = comValue[9];
                    }
                    com.pressType = (PressType)Enum.Parse(typeof(PressType), comValue[10]);

                    form2.InitUI(com);
                    form2.ShowDialog();
                }
                else if (componentType == (int)ComponentType.TextComponent)
                {
                    TextComponent form2 = new TextComponent();
                    form2.Name           = "文本类型";
                    form2.setTextValue  += new SetValueHandler(_setTextValue);
                    form2.removeHandler += new RemoveHandler(_removeHandler);
                    form2.saveHandler   += new SaveHandler(_saveHandler);
                    form2.ChangeBtnState(ChangeMode.Change);

                    Component com = new Component();
                    com.isEnable_Input = comValue[1];
                    com.data_Type      = (DataType)Enum.Parse(typeof(DataType), comValue[2]);
                    com.offset         = comValue[4];
                    com.point          = int.Parse(comValue[11]);

                    form2.InitUI(com);
                    form2.ShowDialog();
                }
            }
        }