コード例 #1
0
        /// <summary>
        /// 新建游戏模块
        /// </summary>
        private void NewModule()
        {
            NewModule newModule = new NewModule();

            newModule.CreateModule(null, m_ClientEvent);
            InitializeListView();
        }
コード例 #2
0
        /// <summary>
        /// 编辑游戏模块
        /// </summary>
        private void EditModule()
        {
            //要更改模块的所在行
            int selectIndex = 0;

            try
            {
                selectIndex = this.listView1.SelectedItems[0].Index;
            }
            catch
            {
                MessageBox.Show(config.ReadConfigValue("MGM", "ML_Code_ChooseModule"), "", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            try
            {
                //要更改的模块id
                int moduleID = int.Parse(this.listView1.Items[selectIndex].Tag.ToString());
                //传送到属性窗体的用户信息
                C_Global.CEnum.Message_Body[] messageBody = new C_Global.CEnum.Message_Body[5];

                for (int i = 0; i < mResult.GetLength(0); i++)
                {
                    if (int.Parse(mResult[i, 0].oContent.ToString()) == moduleID)
                    {
                        messageBody[0].eTag     = C_Global.CEnum.TagFormat.TLV_INTEGER;
                        messageBody[0].eName    = C_Global.CEnum.TagName.Module_ID;
                        messageBody[0].oContent = moduleID;

                        messageBody[1].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                        messageBody[1].eName    = C_Global.CEnum.TagName.GameName;
                        messageBody[1].oContent = mResult[i, 2].oContent.ToString().Trim();

                        messageBody[2].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                        messageBody[2].eName    = C_Global.CEnum.TagName.ModuleName;
                        messageBody[2].oContent = mResult[i, 3].oContent.ToString().Trim();

                        messageBody[3].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                        messageBody[3].eName    = C_Global.CEnum.TagName.ModuleClass;
                        messageBody[3].oContent = mResult[i, 4].oContent.ToString().Trim();

                        messageBody[4].eTag     = C_Global.CEnum.TagFormat.TLV_STRING;
                        messageBody[4].eName    = C_Global.CEnum.TagName.ModuleContent;
                        messageBody[4].oContent = mResult[i, 5].oContent.ToString().Trim();

                        NewModule newModule = null;
                        try
                        {
                            newModule = new NewModule(true, messageBody);
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }

                        try
                        {
                            newModule.CreateModule(null, m_ClientEvent);
                            InitializeListView();
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message);
            }
        }