private void backgroundWorkerBtnOK_DoWork(object sender, DoWorkEventArgs e) { CEnum.Message_Body[] mMsg = (CEnum.Message_Body[])e.Argument; lock (typeof(C_Event.CSocketEvent)) { if (mMsg.Length == 5) { e.Result = GMAdmin.ModuleAdd(this.m_ClientEvent, mMsg); try { int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString()); for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++) { GMAdmin.ModuleAdd((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg); } } catch { } } else { e.Result = GMAdmin.ModuleModi(this.m_ClientEvent, mMsg); try { int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString()); for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++) { GMAdmin.ModuleModi((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg); } } catch { } } } }
private void NewModule_Load(object sender, System.EventArgs e) { IntiFontLib(); //添加 if (!isModify) { //初始化界面 comboBox1.Items.Clear(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); //正式信息 lock (typeof(C_Event.CSocketEvent)) { mResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.GAME_QUERY, C_Global.CEnum.Msg_Category.GAME_ADMIN, this.mMsgBody); } //检测状态 if (mResult[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); //Application.Exit(); return; } comboBox1 = GMAdmin.DisplayComboBox(m_ClientEvent, comboBox1, mResult); } else //编辑 { comboBox1.Items.Clear(); textBox1.Clear(); textBox2.Clear(); textBox3.Clear(); lock (typeof(C_Event.CSocketEvent)) { mResult = m_ClientEvent.RequestResult(C_Global.CEnum.ServiceKey.GAME_QUERY, C_Global.CEnum.Msg_Category.GAME_ADMIN, this.mMsgBody); } //检测状态 if (mResult[0, 0].eName == C_Global.CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); //Application.Exit(); return; } comboBox1 = GMAdmin.DisplayComboBox(m_ClientEvent, comboBox1, mResult); int index = comboBox1.FindString(requestMsgBody[1].oContent.ToString().Trim()); this.comboBox1.SelectedIndex = index; //this.comboBox1.Text = requestMsgBody[1].oContent.ToString().Trim(); this.textBox1.Text = requestMsgBody[2].oContent.ToString().Trim(); this.textBox2.Text = requestMsgBody[3].oContent.ToString().Trim(); this.textBox3.Text = requestMsgBody[4].oContent.ToString().Trim(); } }
C_Global.CEnum.Message_Body[] requestMsgBody = null; //编辑时传送过来的模块信息 #endregion /// <summary> /// 创建/编辑模块 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, System.EventArgs e) { //创建 if (!isModify) { C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[5]; mMsg[0].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[0].eName = C_Global.CEnum.TagName.UserByID; mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mMsg[1].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[1].eName = C_Global.CEnum.TagName.GameID; mMsg[1].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString()); mMsg[2].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[2].eName = C_Global.CEnum.TagName.ModuleName; mMsg[2].oContent = textBox1.Text; mMsg[3].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[3].eName = C_Global.CEnum.TagName.ModuleClass; mMsg[3].oContent = textBox2.Text; mMsg[4].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[4].eName = C_Global.CEnum.TagName.ModuleContent; mMsg[4].oContent = textBox3.Text; C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleAdd(this.m_ClientEvent, mMsg); if (mResultSave[0, 0].oContent.Equals("SUCESS")) { MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk")); this.Close(); } else { MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed")); } } else //编辑 { C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[6]; mMsg[0].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[0].eName = C_Global.CEnum.TagName.UserByID; mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mMsg[1].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[1].eName = C_Global.CEnum.TagName.Module_ID; mMsg[1].oContent = int.Parse(requestMsgBody[0].oContent.ToString()); mMsg[2].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[2].eName = C_Global.CEnum.TagName.GameID; mMsg[2].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString()); mMsg[3].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[3].eName = C_Global.CEnum.TagName.ModuleName; mMsg[3].oContent = textBox1.Text; mMsg[4].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[4].eName = C_Global.CEnum.TagName.ModuleClass; mMsg[4].oContent = textBox2.Text; mMsg[5].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[5].eName = C_Global.CEnum.TagName.ModuleContent; mMsg[5].oContent = textBox3.Text; C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleModi(this.m_ClientEvent, mMsg); if (mResultSave[0, 0].oContent.Equals("SUCESS")) { MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk")); this.Close(); } else { MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed")); } } }
C_Global.CEnum.Message_Body[] requestMsgBody = null; //编辑时传送过来的模块信息 #endregion /// <summary> /// 创建/编辑模块 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, System.EventArgs e) { button1.Enabled = false; Cursor = Cursors.AppStarting; //创建 if (!isModify) { C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[5]; mMsg[0].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[0].eName = C_Global.CEnum.TagName.UserByID; mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mMsg[1].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[1].eName = C_Global.CEnum.TagName.GameID; mMsg[1].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString()); mMsg[2].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[2].eName = C_Global.CEnum.TagName.ModuleName; mMsg[2].oContent = textBox1.Text; mMsg[3].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[3].eName = C_Global.CEnum.TagName.ModuleClass; mMsg[3].oContent = textBox2.Text; mMsg[4].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[4].eName = C_Global.CEnum.TagName.ModuleContent; mMsg[4].oContent = textBox3.Text; this.backgroundWorkerBtnOK.RunWorkerAsync(mMsg); //C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleAdd(this.m_ClientEvent, mMsg); //try //{ // int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString()); // for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++) // { // GMAdmin.ModuleAdd((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg); // } //} //catch { } //if (mResultSave[0,0].oContent.Equals("SUCESS")) //{ // MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk")); // this.Close(); //} //else //{ // MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed")); //} } else //编辑 { C_Global.CEnum.Message_Body[] mMsg = new C_Global.CEnum.Message_Body[6]; mMsg[0].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[0].eName = C_Global.CEnum.TagName.UserByID; mMsg[0].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mMsg[1].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[1].eName = C_Global.CEnum.TagName.Module_ID; mMsg[1].oContent = int.Parse(requestMsgBody[0].oContent.ToString()); mMsg[2].eTag = C_Global.CEnum.TagFormat.TLV_INTEGER; mMsg[2].eName = C_Global.CEnum.TagName.GameID; mMsg[2].oContent = GMAdmin.GetContentID(mResult, comboBox1.SelectedItem.ToString()); mMsg[3].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[3].eName = C_Global.CEnum.TagName.ModuleName; mMsg[3].oContent = textBox1.Text; mMsg[4].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[4].eName = C_Global.CEnum.TagName.ModuleClass; mMsg[4].oContent = textBox2.Text; mMsg[5].eTag = C_Global.CEnum.TagFormat.TLV_STRING; mMsg[5].eName = C_Global.CEnum.TagName.ModuleContent; mMsg[5].oContent = textBox3.Text; this.backgroundWorkerBtnOK.RunWorkerAsync(mMsg); //C_Global.CEnum.Message_Body[,] mResultSave = GMAdmin.ModuleModi(this.m_ClientEvent, mMsg); //try //{ // int iSrvCount = int.Parse(m_ClientEvent.GetInfo("ServersCount").ToString()); // for (int iSrvIndex = 1; iSrvIndex <= iSrvCount; iSrvIndex++) // { // GMAdmin.ModuleModi((CSocketEvent)m_ClientEvent.GetInfo("Server" + iSrvIndex), mMsg); // } //} //catch { } //if (mResultSave[0,0].oContent.Equals("SUCESS")) //{ // MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveOk")); // this.Close(); //} //else //{ // MessageBox.Show(config.ReadConfigValue("MGM", "NM_Code_SaveFailed")); //} } }