Beispiel #1
0
        void V_Contents_E_TextChanged(object sender, CellTextChangedEventArgs e)
        {
            int           itemIndex  = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.itemIndex.ToString()];
            int           valueIndex = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.valueIndex.ToString()];
            CPacketStruct parser     = V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.parser.ToString()] as CPacketStruct;

            switch ((contentTitles)e.ColIndex)
            {
            case contentTitles.name:
                if (e.Text.Length == 0)    //아무것도 넣지않으면 자동으로 복귀
                {
                    e.IsCancel = true;
                    return;
                }
                else if (Char.IsDigit(e.Text[0]))
                {
                    MessageBox.Show("변수명의 처음은 문자로 시작해야 합니다.");
                    e.IsCancel = true;
                    return;
                }
                else
                {
                    for (int i = 0; i < e.Text.Length; i++)
                    {
                        if (Char.IsLetterOrDigit(e.Text, i) == false)
                        {
                            MessageBox.Show("변수명에는 문자와 숫자만 들어갈 수 있습니다.");
                            e.IsCancel = true;
                            return;
                        }
                    }
                    for (int i = 0; i < parser.Items.Count; i++)
                    {
                        if (parser.Items[i].Name.Equals(e.Text))
                        {
                            MessageBox.Show("같은 이름이 존재합니다.");
                            e.IsCancel = true;
                            return;
                        }
                    }
                }
                parser.Items[itemIndex].Name = e.Text;

                if (parser.Items[itemIndex].InitValues.Length > 1) //배열일 때,
                {
                    viewContent(parser);                           //목록을 다시 만듬.
                }

                break;

            case contentTitles.value:
                parser.Items[itemIndex].InitValues[valueIndex] = e.Text;
                break;
            }
            parser.MakePacket(_endian == Endians.Big);
            parser.MakeMsgText();
            String name = V_Contents.RelativeObject["name"] as String;

            _modifiedItems[name] = parser;
        }
Beispiel #2
0
        void V_Data_E_CellClicked(object sender, FormAdders.EasyGridViewCollections.CellClickEventArgs e)
        {
            if (e.RowIndex < 0 || e.ColIndex < 0)
            {
                return;
            }
            String packetName = (V_Data.GetCell(e.RowIndex, 1).Value as String);

            if (e.ColIndex == (int)Titles.edit_button) //edit msg
            {
                CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct;
                cp.MakeMsgText();
                //cp.MakeMsg();
                String      msgFile  = _packetDir + "\\" + packetName + "\\Msg.txt";
                DlgMsgMaker msgMaker = new DlgMsgMaker(cp, msgFile, _endian == Endians.Big);
                msgMaker.Location = this.Location;
                msgMaker.ShowDialog();
                cp.MakePacket(_endian == Endians.Big);
                //cp.MakeMsg();//다시 메시지를 만들어준다.
            }
            else if (e.ColIndex == (int)Titles.send) //send msg
            {
                CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct;
                cp.MakePacket(_endian == Endians.Big);
                _sendFunc(cp.PacketBuffer, 0, cp.PacketDataSize, cp);
                ReleaseSelections();
                V_Data.Rows[e.RowIndex].RowBackMode = FormAdders.EasyGridViewCollections.RowBackModes.Red;
            }
            else//내용보기
            {
                V_Contents.RelativeObject["name"] = packetName;
                CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct;
                viewContent(cp);
            }
        }
Beispiel #3
0
        void V_Contents_E_ComboBoxChanged(object sender, CellComboBoxEventArgs e)
        {
            int           itemIndex  = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.itemIndex.ToString()];
            int           valueIndex = (int)V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.valueIndex.ToString()];
            CPacketStruct parser     = V_Contents.Rows[e.RowIndex].RelativeObject[rowInfos.parser.ToString()] as CPacketStruct;

            switch ((contentTitles)e.ColIndex)
            {
            case contentTitles.swap:
                parser.Items[itemIndex].IsSwap = (_swapYn[e.SelectedIndex].Equals("y"));
                break;

            case contentTitles.type:
                //parser.Items[itemIndex].TypeString = _types[e.SelectedIndex];
                parser.Items[itemIndex].SetType(_types[e.SelectedIndex], true);
                break;
            }
            try
            {
                parser.MakePacket(_endian == Endians.Big);
                parser.MakeMsgText();
                String name = V_Contents.RelativeObject["name"] as String;
                _modifiedItems[name] = parser;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Beispiel #4
0
 void V_Data_E_CellClicked(object sender, FormAdders.EasyGridViewCollections.CellClickEventArgs e)
 {
     if (e.ColIndex == (int)Titles.edit_button) //edit msg
     {
         CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct;
         cp.MakeMsgText();
         String      msgFile  = _packetDir + "\\" + (V_Data.GetCell(e.RowIndex, 1).Value as String) + "\\Msg.txt";
         DlgMsgMaker msgMaker = new DlgMsgMaker(cp, msgFile, _endian == Endians.Big);
         msgMaker.Location = this.Location;
         msgMaker.ShowDialog();
     }
     else if (e.ColIndex == (int)Titles.send) //send msg
     {
         CPacketStruct cp = V_Data.RowRelativeObject(e.RowIndex)["parser"] as CPacketStruct;
         cp.MakePacket(_endian == Endians.Big);
         _sendFunc(cp.PacketBuffer, 0, cp.PacketDataSize, cp.SimpleText);
         ReleaseSelections();
         V_Data.Rows[e.RowIndex].RowBackMode = FormAdders.EasyGridViewCollections.RowBackModes.Red;
     }
 }