private void ListViewItem_DoubleClick(object sender, EventArgs e)
        {
            //アイテムが選択状態ではなければ、何もしない
            if (ListViewItem.SelectedItems.Count == 0)
            {
                return;
            }

            FormDecodeOption fm = (FormDecodeOption)this.Owner;

            fm.ReceiveFixedChName  = ListViewItem.SelectedItems[0].SubItems[0].Text;
            fm.ReceiveFixedCANID   = ListViewItem.SelectedItems[0].SubItems[1].Text;
            fm.ReceiveFixedFormula = ListViewItem.SelectedItems[0].SubItems[2].Text;
            fm.ReceiveFixedColor   = ListViewItem.SelectedItems[0].SubItems[3].Text;
            fm.ReceiveFixedMin     = ListViewItem.SelectedItems[0].SubItems[4].Text;
            fm.ReceiveFixedMax     = ListViewItem.SelectedItems[0].SubItems[5].Text;

            //閉じる
            this.Close();
        }
Esempio n. 2
0
        private void BtnOK_Click(object sender, EventArgs e)
        {
            FormDecodeOption fm = (FormDecodeOption)this.Owner;

            //LBAddのCANIDをFormMain.decodeRuleに追加する
            for (int i = 0; i < LBAdd.Items.Count; i++)
            {
                //CANIDにData1~Data8まで存在するので一通り追加する
                for (int j = 1; j < 9; j++)
                {
                    int i_color;
                    switch (j)
                    {
                    case 1: i_color = -32640; break;

                    case 2: i_color = -128; break;

                    case 3: i_color = -8323200; break;

                    case 4: i_color = -8323073; break;

                    case 5: i_color = -16744193; break;

                    case 6: i_color = -32576; break;

                    case 7: i_color = -65281; break;

                    case 8: i_color = -32768; break;

                    default: i_color = 0; break;
                    }

                    if (CBByte.Checked)
                    {
                        fm.decodeRule.AddData(LBAdd.Items[i] + "_Data" + j.ToString(),  //Ch Name
                                              LBAdd.Items[i].ToString(),                //CAN ID
                                              "#Data" + j.ToString(),                   //Formula
                                              i_color.ToString(),                       //Ch Color
                                              "0",                                      //Min
                                              "255",                                    //Max
                                              "false",                                  //flg Preview
                                              "false",                                  //flg Show
                                              "false",                                  //flg UseFilter
                                              "1");                                     //cut off
                    }

                    if (CBHigh.Checked)
                    {
                        fm.decodeRule.AddData(LBAdd.Items[i] + "_HiData" + j.ToString(), //Ch Name
                                              LBAdd.Items[i].ToString(),                 //CAN ID
                                              "#HiData" + j.ToString(),                  //Formula
                                              i_color.ToString(),                        //Ch Color
                                              "0",                                       //Min
                                              "255",                                     //Max
                                              "false",                                   //flg Preview
                                              "false",                                   //flg Show
                                              "false",                                   //flg UseFilter
                                              "1");                                      //cut off
                    }

                    if (CBLow.Checked)
                    {
                        fm.decodeRule.AddData(LBAdd.Items[i] + "_LoData" + j.ToString(), //Ch Name
                                              LBAdd.Items[i].ToString(),                 //CAN ID
                                              "#LoData" + j.ToString(),                  //Formula
                                              i_color.ToString(),                        //Ch Color
                                              "0",                                       //Min
                                              "255",                                     //Max
                                              "false",                                   //flg Preview
                                              "false",                                   //flg Show
                                              "false",                                   //flg UseFilter
                                              "1");                                      //cut off
                    }
                }
            }

            //閉じる
            this.Close();
        }