public override void ViewWillDisappear(bool animated) { // Lost focus in TextView to hide the keyboard TxtContent.ResignFirstResponder(); txtTitle.ResignFirstResponder(); // Means that photos will appear, we are not closing the note UI // to execute Save or Delete task if (photosAreVisible) { base.ViewWillDisappear(animated); return; } var title = txtTitle.Text; var content = TxtContent.Text; // If we tap the delete button or we delete the content of note means that we need to delete the note. if (deleteNote || (string.IsNullOrWhiteSpace(title) && string.IsNullOrWhiteSpace(content))) { DeleteNote(); } else if (title != Note.Title || content != Note.Content) // If we made some change to note, update it { SaveNote(); } DeregisterToKeyboardNotifications(); base.ViewWillDisappear(animated); }
private int CountVisibleLines() { //TODO teste int lines = (int)Math.Floor((TxtContent.VerticalOffset + TxtContent.ViewportHeight - 1) / (TxtContent.FontFamily.LineSpacing * TxtContent.FontSize)); return(lines); //Implement cache to the result. Refresh on resize. int lineIndex; if (TxtContent.Text != string.Empty) { lineIndex = TxtContent.GetLastVisibleLineIndex(); } else { //TODO tratar casos onde tem texto mas não preenche a tela toda string temp = TxtContent.Text; TxtContent.Text = new string('\n', 500); TxtContent.GetLineIndexFromCharacterIndex(0);//Workaround to GetLastVisibleLineIndex work at first lineIndex = TxtContent.GetLastVisibleLineIndex(); TxtContent.Text = temp; } return(lineIndex + 1); }
private void TxtTitle_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && !string.IsNullOrEmpty(TxtTitle.Text)) { TxtContent.Focus(); } }
public async Task <List <TxtContent> > GetContent(int IdSection) { var txt = new List <TxtContent>(); using (GetCon()) { SqlCommand cmd = new SqlCommand("usp_Get_Txt_Content", con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@IdSection", IdSection); await con.OpenAsync(); SqlDataReader rdr = await cmd.ExecuteReaderAsync(); while (await rdr.ReadAsync()) { var txtContent = new TxtContent(); txtContent.IdTextContent = Convert.ToInt16(rdr["IdTextContent"]); txtContent.TextTitle = rdr["TextTitle"].ToString(); txtContent.Text = rdr["Text"].ToString(); txtContent.HTMLDecoration = rdr["HTMLDecoration"].ToString(); txt.Add(txtContent); } con.Close(); } return(txt); }
/// <summary> /// 数据验证方法 /// </summary> /// <returns></returns> bool ChecekGroup() { if (string.IsNullOrEmpty(TxtTitle.Text.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "SurveysTITLE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (string.IsNullOrEmpty(TxtContent.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "SurveysContent"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (ComboBoxAnswer.SelectedIndex < 0) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "OAANSWER"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (ComboBoxPercent.SelectedIndex < 0) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "OASURVEYPERCENTAGE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } List <ValidatorBase> validators = checkGroup.ValidateAll(); if (validators.Count > 0) { foreach (ValidatorBase validator in validators) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(validator.ErrorMessage), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } } return(true); }
private void backgroundWorkerUnFreeze_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.BtnSave.Enabled = true; this.Cursor = Cursors.Default; CEnum.Message_Body[,] mResult = (CEnum.Message_Body[, ])e.Result; if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopFailure")); } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopSucces")); } //PnlInput.Visible = false; TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); }
private void Awake() { //TODO: ICON if (TxtContent != null) { var text = TxtContent.GetComponent <Text>(); text.text = Content; } }
bool CheceGroup()//验证UI数据正确性 { string start = string.Empty; string end = string.Empty; if (string.IsNullOrEmpty(TxtTitle.Text.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "SurveysTITLE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (string.IsNullOrEmpty(TxtContent.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEEMPTYSELECT", "SurveysContent"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (DGDistribute.SelectedIndex < 0) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "DISTRBUTEOBJECT"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); } if (string.IsNullOrEmpty(this.startDate.Text.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "STARTDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); this.startDate.Focus(); return(false); } start = this.startDate.SelectedDate.Value.ToString("d"); if (string.IsNullOrEmpty(this.endDate.Text.ToString())) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STRINGNOTNULL", "ENDTDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); this.startDate.Focus(); return(false); } end = this.endDate.SelectedDate.Value.ToString("d"); if (this.endDate.SelectedDate.Value < this.startDate.SelectedDate.Value) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("CANNOTBEGREATERTHANENDDATE", "STARTDATE"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } if (AnswerGroup.SelectedIndex < 1) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("SELECTFIRST", "OAANSWERGROUP"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } List <ValidatorBase> validators = checkGroup.ValidateAll(); if (validators.Count > 0) { foreach (ValidatorBase validator in validators) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr(validator.ErrorMessage), Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); return(false); } } return(true); }
private void btnGenerate_Click(object sender, RoutedEventArgs e) { int length; if (int.TryParse(TxtSeedLength.Text, out length)) { TxtContent.Text = generator.Generate(length); } else { TxtContent.Clear(); } }
public Task FindText(string text, Progress <int> progress, CancellationToken token) { return(Task.Run(async() => { await foreach (var offsetOccurence in searcher.Search(CarretSelectionOffset + CarretSelectionLength, text.ToCharArray(), progress, token)) { await await Dispatcher.InvokeAsync(async() => { long lineBeginningOffset = await GoToOffset(offsetOccurence, true); TxtContent.Select((int)(offsetOccurence - lineBeginningOffset), text.Length); App.Current.MainWindow.Activate(); }); break; } })); }
private void button2_Click(object sender, EventArgs e) { //if (MessageBox.Show("您确定要保存公告信息吗?", "提示信息:", MessageBoxButtons.YesNo).Equals(DialogResult.Yes)) //{ //} //请求频道名称 GetChannelList(); TxtContent.Clear(); TxtIID.Clear(); TxtSpeed.Clear(); ChkPlay.Checked = false; ChkStatus.Checked = false; TxtColor.Clear(); GrpInput.Visible = false; }
private void BtnNew_Click(object sender, EventArgs e) { //int maxid = 1; //for (int i = 0; i< CmbOption.Items.Count; i++) //{ // if ( Convert.ToInt32(CmbOption.Items[i]) > maxid) // { // maxid = Convert.ToInt32(CmbOption.Items[i]); // } //} //maxid += 1; //CmbOption.Items.Add(maxid); //CmbOption.SelectedIndex = 1; TxtAns.Clear(); TxtContent.Clear(); CmbAns.DataSource = null; CmbOption.DataSource = null; }
private void backgroundWorkerPost_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { BtnPost.Enabled = true; TbcResult.Enabled = true; Cursor = Cursors.Default; CEnum.Message_Body[,] mGetResult = (CEnum.Message_Body[, ])e.Result; //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_Audition.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); TbcResult.SelectedTab = TpgList; }
public async Task OpenFile(string filePath) { IsEnabled = true; if (mFile != null) { mFile.Dispose();//TODO pensar em uma forma melhor de clean, talvez remover todo o User Control } this.filePath = filePath; fileSize = new FileInfo(filePath).Length; maximumStartOffset = GetMaximumStartOffset();//TODO precisa atualizar sempre que fizer resize mFile = MemoryMappedFile.CreateFromFile(filePath, FileMode.Open, null, 0, MemoryMappedFileAccess.Read); searcher = new TextSearcher(mFile, fileSize); LineIndexer = new LineIndexer(searcher); await GoToOffset(0, true); TxtContent.Focus(); }
private void backgroundWorkerFreeze_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { this.BtnPost.Enabled = true; this.Cursor = Cursors.Default; if (e.Result.ToString() != "Error") { CEnum.Message_Body[,] mResult = (CEnum.Message_Body[, ])e.Result; if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) //if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopFailure")); return; } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopSucces")); TxtAccount.Text = ""; TxtContent.Text = ""; } } else { return; } this.Btn_Search_Click(null, null); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); }
private void BtnPost_Click_1(object sender, EventArgs e) { if (TxtAccount.Text.Trim().Length > 0) { if (MessageBox.Show("确认将服务器" + CmbServer.Text + "中的帐号" + TxtAccount.Text + "停封吗?", "停封帐号", MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[,] mResult = null; CEnum.Message_Body[] mContent = new CEnum.Message_Body[4]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.SDO_Account; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = TxtAccount.Text; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.SDO_REASON; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text; mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.SDO_MEMBERSTOPSTATUS_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.SDO_StopStatus && mResult[0, 0].oContent.ToString() == "0") { mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.SDO_ACCOUNT_CLOSE, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) //if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show("操作失败!"); return; } else { MessageBox.Show("操作成功,该帐号已经成功被停封!"); TxtAccount.Text = ""; TxtContent.Text = ""; } } else { MessageBox.Show("该帐号已经被停封,不能再次处理!"); } mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_Kart.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.SDO_MEMBERBANISHMENT_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_Kart.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show("请输入帐号!"); } }
private int GetCarretLineIndex() { return(TxtContent.GetLineIndexFromCharacterIndex(TxtContent.CaretIndex)); }
private void BtnPost_Click(object sender, EventArgs e) { if (TxtContent.Text == "" || TxtContent.Text == null) { MessageBox.Show("请输入封停原因"); return; } if (TxtAccount.Text.Trim().Length > 0) { if (MessageBox.Show("停封帐号", "确认将该用户停封吗?", MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[,] mResult = null; CEnum.Message_Body[] mContent = new CEnum.Message_Body[4]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.AU_ACCOUNT; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = TxtAccount.Text; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.AU_Reason; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text; mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } mContent = new CEnum.Message_Body[5]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.AU_UserNick; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = mResult[0, 2].oContent.ToString(); mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.AU_Reason; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text; mContent[4].eName = CEnum.TagName.AU_ACCOUNT; mContent[4].eTag = CEnum.TagFormat.TLV_STRING; mContent[4].oContent = TxtAccount.Text; //有问题 mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_BANISHMENT_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.AU_STOPSTATUS && mResult[0, 0].oContent.ToString() == "0") { mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_CLOSE, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show("封停帐号失败,请稍候尝试!"); } else { MessageBox.Show("操作成功,该帐号已经成功被停封!"); } TxtAccount.Text = ""; TxtContent.Text = ""; } else { MessageBox.Show("该帐号已经被停封,不能再次处理!"); } mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_Audition.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNTREMOTE_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_Audition.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show("请输入帐号!"); } }
private void BtnSave_Click(object sender, EventArgs e) { strUserNick = TxtNick.Text.Trim(); if (strUserNick != null) { if (MessageBox.Show("解封帐号", "确认将该用户解封吗?", MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[,] mResult = null; CEnum.Message_Body[] mContent = new CEnum.Message_Body[4]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.AU_ACCOUNT; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = strUserNick; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.AU_Reason; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text; mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } mContent = new CEnum.Message_Body[5]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.AU_UserNick; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = mResult[0, 2].oContent.ToString(); mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.AU_Reason; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text; mContent[4].eName = CEnum.TagName.AU_ACCOUNT; mContent[4].eTag = CEnum.TagFormat.TLV_STRING; mContent[4].oContent = strUserNick; mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_BANISHMENT_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.AU_STOPSTATUS && mResult[0, 0].oContent.ToString() == "1") { mResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNT_OPEN, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show("操作失败!"); } else { GrdList.DataSource = null; MessageBox.Show("操作成功,该帐号已经成功被解封!"); } } else { MessageBox.Show("该玩家没有处于停封状态,解封失败!"); } PnlInput.Visible = false; mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.AU_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Audition.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_Audition.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_Audition.GetResult(this.m_ClientEvent, CEnum.ServiceKey.AU_ACCOUNTREMOTE_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_Audition.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show("请输入解封原因!"); } }
// Hide keyboard void btnDone_Clicked(object sender, EventArgs e) { TxtContent.ResignFirstResponder(); }
private void BtnPost_Click(object sender, EventArgs e) { if (TxtAccount.Text.Trim().Length > 0 && txtBandays.Text.Trim().Length > 0 && TxtContent.Text.Trim().Length > 0) { if (MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgServer").Replace("{Server}", CmbServer.Text).Replace("{Account}", TxtAccount.Text), config.ReadConfigValue("MSDO", "BA_Code_MsgBan"), MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[,] mResult = null; CEnum.Message_Body[] mContent = new CEnum.Message_Body[5]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.SDO_Account; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = TxtAccount.Text; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[3].eName = CEnum.TagName.SDO_REASON; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtContent.Text.Trim(); mContent[4].eName = CEnum.TagName.SDO_BanDate; mContent[4].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[4].oContent = ReturnBanDays(txtBandays.Text.Trim()); mResult = Operation_SDO.GetResult(m_ClientEvent.GetSocket(m_ClientEvent, Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text)), CEnum.ServiceKey.SDO_MEMBERSTOPSTATUS_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.SDO_StopStatus && mResult[0, 0].oContent.ToString() == "0") { mResult = Operation_SDO.GetResult(m_ClientEvent.GetSocket(m_ClientEvent, Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text)), CEnum.ServiceKey.SDO_ACCOUNT_CLOSE, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { //MessageBox.Show("操作失败!"); MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) //if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopFailure")); return; } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopSucces")); TxtAccount.Text = ""; TxtContent.Text = ""; //txtBandays.Text = ""; } } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgUnoperation")); } mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_SDO.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_SDO.GetResult(m_ClientEvent.GetSocket(m_ClientEvent, Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text)), CEnum.ServiceKey.SDO_MEMBERBANISHMENT_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_SDO.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsginputAccont")); } }
private void BtnSave_Click(object sender, EventArgs e) { strUserNick = TxtNick.Text.Trim(); if (strUserNick != null && strUserNick != "") { if (MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgAccont"), config.ReadConfigValue("MSDO", "BA_Code_MsgUnlock"), MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[] mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.SDO_Account; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = strUserNick; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); CEnum.Message_Body[,] mResult = Operation_SDO.GetResult(m_ClientEvent.GetSocket(m_ClientEvent, Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text)), CEnum.ServiceKey.SDO_ACCOUNT_OPEN, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopFailure")); } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopSucces1")); } PnlInput.Visible = false; mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_SDO.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_SDO.GetResult(m_ClientEvent.GetSocket(m_ClientEvent, Operation_SDO.GetItemAddr(mServerInfo, CmbServer.Text)), CEnum.ServiceKey.SDO_MEMBERBANISHMENT_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_SDO.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show(config.ReadConfigValue("MSDO", "BA_Code_MsgopSucces")); } }
private void ToUnStopAccount() { /* * 获取ip */ if (_ServerIP == null || _ServerIP == "") { for (int i = 0; i < this.serverIPResult.GetLength(0); i++) { if (serverIPResult[i, 1].oContent.ToString().Trim().Equals(this.cbxServerIP.Text.Trim())) { this._ServerIP = serverIPResult[i, 0].oContent.ToString(); } } } /* * 拉数据 * */ try { C_Global.CEnum.Message_Body[] messageBody = new C_Global.CEnum.Message_Body[3]; messageBody[0].eTag = C_Global.CEnum.TagFormat.TLV_STRING; messageBody[0].eName = C_Global.CEnum.TagName.O2JAM2_ServerIP; messageBody[0].oContent = _ServerIP; messageBody[1].eTag = C_Global.CEnum.TagFormat.TLV_STRING; messageBody[1].eName = C_Global.CEnum.TagName.O2JAM2_UserID; messageBody[1].oContent = TxtAccount.Text.Trim(); messageBody[2].eName = CEnum.TagName.UserByID; messageBody[2].eTag = CEnum.TagFormat.TLV_INTEGER; messageBody[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); lock (typeof(C_Event.CSocketEvent)) { openActionResult = m_ClientEvent.GetSocket(m_ClientEvent, _ServerIP).RequestResult(C_Global.CEnum.ServiceKey.O2JAM2_ACCOUNT_OPEN, C_Global.CEnum.Msg_Category.O2JAM2_ADMIN, messageBody); } if (openActionResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(openActionResult[0, 0].oContent.ToString()); return; } if (openActionResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show(config.ReadConfigValue("MBAF", "SA_Code_Failed")); return; } else if (openActionResult[0, 0].oContent.Equals("SUCESS")) { MessageBox.Show(config.ReadConfigValue("MBAF", "SA_Code_Success")); dpActaion.Visible = false; cbxToPageIndex.Visible = false; dpStopActView.Visible = false; TxtAccount.Clear(); TxtContent.Clear(); ReadStopAccountFromDB(); return; } } catch (Exception ex) { MessageBox.Show(config.ReadConfigValue("MBAF", "SA_Code_ClientErrorMessage") + "\n-------------------------------------\n" + ex.Message); } finally { openActionResult = null; } }
private async void TxtContent_PreviewKeyDown(object sender, KeyEventArgs e) { int lineIndex = GetCarretLineIndex(); int column = TxtContent.SelectionStart - TxtContent.GetCharacterIndexFromLineIndex(lineIndex); int line = lineIndex + 1; int linesToScroll; switch (e.Key) { case Key.Up: if (line > 1) { return; } linesToScroll = -1; break; case Key.Down: if (line < CountVisibleLines()) { return; } linesToScroll = 1; break; case Key.PageUp: linesToScroll = -(CountVisibleLines() - 1); //TODO -(CountVisibleLines() - 2); break; case Key.PageDown: linesToScroll = CountVisibleLines() - 1; //TODO CountVisibleLines() - 2; break; case Key.Home: if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control)) { await GoToOffset(0, true); } return; case Key.End: if (e.KeyboardDevice.Modifiers.HasFlag(ModifierKeys.Control)) { await GoToOffset(maximumStartOffset, true); } return; default: return; } await ScrollContent(linesToScroll, false); switch (e.Key) { case Key.PageUp: case Key.PageDown: int newColumn = Math.Min(column, TxtContent.GetLineLength(lineIndex)); TxtContent.CaretIndex = TxtContent.GetCharacterIndexFromLineIndex(lineIndex) + newColumn; e.Handled = true; break; } }
private void BtnSave_Click_1(object sender, EventArgs e) { strUserNick = TxtNick.Text.Trim(); if (strUserNick != null && strUserNick != "") { if (MessageBox.Show("解封帐号", "确认将该用户解封吗?", MessageBoxButtons.YesNo) == DialogResult.Yes) { CEnum.Message_Body[] mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.SDO_Account; mContent[1].eTag = CEnum.TagFormat.TLV_STRING; mContent[1].oContent = strUserNick; mContent[2].eName = CEnum.TagName.UserByID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); CEnum.Message_Body[,] mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.SDO_ACCOUNT_OPEN, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].eName == CEnum.TagName.Status && mResult[0, 0].oContent.Equals("FAILURE")) { MessageBox.Show("操作失败!"); } else { MessageBox.Show("操作成功,该帐号已经成功被解封!"); } PnlInput.Visible = false; mContent = new CEnum.Message_Body[3]; mContent[0].eName = CEnum.TagName.SDO_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.Index; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = 1; mContent[2].eName = CEnum.TagName.PageSize; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = Operation_Kart.iPageSize; CEnum.Message_Body[,] mGetResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.SDO_MEMBERBANISHMENT_QUERY, mContent); //无内容显示 if (mGetResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mGetResult[0, 0].oContent.ToString()); return; } Operation_Kart.BuildDataTable(this.m_ClientEvent, mGetResult, GrdList, out iPageCount); TxtAccount.Clear(); TxtContent.Clear(); TxtMemo.Clear(); } } else { MessageBox.Show("请输入帐号名称!"); } }
private void button1_Click(object sender, EventArgs e) { CEnum.Message_Body[] mContent; if (iOperation == 1) { mContent = new CEnum.Message_Body[14]; } else if (iOperation == 2) { mContent = new CEnum.Message_Body[15]; } else { MessageBox.Show("请检查您的操作步骤!"); return; } if (Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text) != null) { mContent[0].eName = CEnum.TagName.CR_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); } else { MessageBox.Show("请先选择一个服务器!"); return; } mContent[1].eName = CEnum.TagName.CR_ValidTime; mContent[1].eTag = CEnum.TagFormat.TLV_TIMESTAMP; mContent[1].oContent = Convert.ToDateTime(DptStart.Text); mContent[2].eName = CEnum.TagName.CR_InValidTime; mContent[2].eTag = CEnum.TagFormat.TLV_TIMESTAMP; mContent[2].oContent = Convert.ToDateTime(DptStop.Text); if (TxtColor.Text.Trim().Length <= 0) { MessageBox.Show("请选择公告的颜色!"); return; } mContent[3].eName = CEnum.TagName.CR_BoardColor; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; mContent[3].oContent = TxtColor.Text; mContent[4].eName = CEnum.TagName.CR_DayLoop; mContent[4].eTag = CEnum.TagFormat.TLV_INTEGER; if (ChkPlay.Checked) { mContent[4].oContent = 1; } else { mContent[4].oContent = 0; } try { mContent[5].eName = CEnum.TagName.CR_PublishID; mContent[5].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[5].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); } catch { MessageBox.Show("请输入发布人ID,只能为数字!"); return; } try { mContent[6].eName = CEnum.TagName.CR_SPEED; mContent[6].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[6].oContent = int.Parse(TxtSpeed.Text.Trim()); } catch { MessageBox.Show("请输入播放速度,只能为数字!"); return; } try { mContent[7].eName = CEnum.TagName.CR_Mode; mContent[7].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[7].oContent = int.Parse(TxtCode.Text.Trim()); } catch { mContent[7].eName = CEnum.TagName.CR_Mode; mContent[7].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[7].oContent = 0; } try { mContent[8].eName = CEnum.TagName.CR_BoardContext; mContent[8].eTag = CEnum.TagFormat.TLV_STRING; mContent[8].oContent = TxtContent.Text.Trim().Substring(0, 75); } catch { mContent[8].eName = CEnum.TagName.CR_BoardContext; mContent[8].eTag = CEnum.TagFormat.TLV_STRING; mContent[8].oContent = TxtContent.Text.Trim(); } try { mContent[9].eName = CEnum.TagName.CR_BoardContext1; mContent[9].eTag = CEnum.TagFormat.TLV_STRING; mContent[9].oContent = TxtContent.Text.Trim().Substring(75, 150); } catch { try { mContent[9].eName = CEnum.TagName.CR_BoardContext1; mContent[9].eTag = CEnum.TagFormat.TLV_STRING; mContent[9].oContent = TxtContent.Text.Trim().Substring(75, TxtContent.Text.Trim().Length - 75); } catch { mContent[9].eName = CEnum.TagName.CR_BoardContext1; mContent[9].eTag = CEnum.TagFormat.TLV_STRING; mContent[9].oContent = ""; } } try { mContent[10].eName = CEnum.TagName.CR_BoardContext2; mContent[10].eTag = CEnum.TagFormat.TLV_STRING; mContent[10].oContent = TxtContent.Text.Trim().Substring(150, 220); } catch { try { mContent[10].eName = CEnum.TagName.CR_BoardContext2; mContent[10].eTag = CEnum.TagFormat.TLV_STRING; mContent[10].oContent = TxtContent.Text.Trim().Substring(150, TxtContent.Text.Trim().Length - 220); } catch { mContent[10].eName = CEnum.TagName.CR_BoardContext2; mContent[10].eTag = CEnum.TagFormat.TLV_STRING; mContent[10].oContent = ""; } } mContent[11].eName = CEnum.TagName.UserByID; mContent[11].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[11].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[12].eName = CEnum.TagName.CR_STATUS; mContent[12].eTag = CEnum.TagFormat.TLV_INTEGER; if (ChkStatus.Checked) { mContent[12].oContent = 1; } else { mContent[12].oContent = 0; } if (TxtCode.CheckedItems.Count <= 0) { MessageBox.Show("请选择要发布的频道!"); return; } mContent[13].eName = CEnum.TagName.CR_Channel; mContent[13].eTag = CEnum.TagFormat.TLV_STRING; for (int i = 0; i < TxtCode.CheckedItems.Count; i++) { /* * if (i == TxtCode.CheckedItems.Count || i == 0) * { * mContent[11].oContent = mContent[11].oContent + TxtCode.CheckedItems[i].ToString(); * } * else * { * mContent[11].oContent = mContent[11].oContent + "," + TxtCode.CheckedItems[i].ToString(); * }GetChannelID */ mContent[13].oContent = TxtCode.CheckedItems[i].ToString() + "," + mContent[13].oContent; //mContent[13].oContent = GetChannelID(TxtCode.CheckedItems[i].ToString()) + "," + mContent[13].oContent; } CEnum.Message_Body[,] mResult = null; string strMessageS = string.Empty; string strMessageF = string.Empty; if (iOperation == 1) { mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.CR_CALLBOARD_CREATE, mContent); strMessageF = "添加公告失败!"; strMessageS = "信息添加成功!"; } else if (iOperation == 2) { mContent[14].eName = CEnum.TagName.CR_BoardID; mContent[14].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[14].oContent = iBoardID; mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.CR_CALLBOARD_UPDATE, mContent); strMessageF = "修改公告失败!"; strMessageS = "信息修改成功!"; } else { MessageBox.Show("请检查你的操作步骤!"); return; } if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].oContent.ToString() != "FAILURE" && mResult[0, 0].oContent.ToString() != "SUCESS" || mResult == null) { MessageBox.Show("添加频道" + mResult[0, 0].oContent.ToString().Remove(0, 2) + "失败,请选择公告ID和频道号再次添加"); label2.Text = "添加频道" + mResult[0, 0].oContent.ToString().Remove(0, 2) + "失败"; string[] arrChannel = mResult[0, 0].oContent.ToString().Remove(0, 2).Split(','); GetGridContent(); button4.Visible = true; for (int i = 0; i < TxtCode.Items.Count; i++) { TxtCode.SetItemChecked(i, false); } ArrayList arr = new ArrayList(); arr = ChannelIndex(arrChannel); for (int i = 0; i < TxtCode.Items.Count; i++) { for (int x = 0; x < arr.Count; x++) { if (i == int.Parse(arr[x].ToString())) { TxtCode.SetItemChecked(i, true); } } } } else { MessageBox.Show(strMessageS); label2.Text = ""; GetChannelList(); TxtContent.Clear(); TxtIID.Clear(); TxtSpeed.Clear(); TxtColor.Clear(); ChkPlay.Checked = false; ChkStatus.Checked = false; GrpInput.Visible = false; GetGridContent(); button4.Visible = false; } }
private void button4_Click(object sender, EventArgs e) { if (iBoardID == -1) { MessageBox.Show("请选择一条记录!"); return; } C_Global.CEnum.Message_Body[] mContent = new CEnum.Message_Body[4]; mContent[0].eName = CEnum.TagName.CR_ServerIP; mContent[0].eTag = CEnum.TagFormat.TLV_STRING; mContent[0].oContent = Operation_Kart.GetItemAddr(mServerInfo, CmbServer.Text); mContent[1].eName = CEnum.TagName.UserByID; mContent[1].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[1].oContent = int.Parse(m_ClientEvent.GetInfo("USERID").ToString()); mContent[2].eName = CEnum.TagName.CR_BoardID; mContent[2].eTag = CEnum.TagFormat.TLV_INTEGER; mContent[2].oContent = iBoardID; mContent[3].eName = CEnum.TagName.CR_Channel; mContent[3].eTag = CEnum.TagFormat.TLV_STRING; for (int i = 0; i < TxtCode.CheckedItems.Count; i++) { mContent[3].oContent = TxtCode.CheckedItems[i].ToString() + "," + mContent[3].oContent; } CEnum.Message_Body[,] mResult = Operation_Kart.GetResult(this.m_ClientEvent, CEnum.ServiceKey.CR_ERRORCHANNEL_QUERY, mContent); if (mResult[0, 0].eName == CEnum.TagName.ERROR_Msg) { MessageBox.Show(mResult[0, 0].oContent.ToString()); return; } if (mResult[0, 0].oContent.ToString() != "FAILURE" && mResult[0, 0].oContent.ToString() != "SUCESS" || mResult == null) { MessageBox.Show("添加频道" + mResult[0, 0].oContent.ToString().Remove(0, 2) + "失败,请选择公告ID和频道号再次添加"); label2.Text = "添加频道" + mResult[0, 0].oContent.ToString().Remove(0, 2) + "失败"; string[] arrChannel = mResult[0, 0].oContent.ToString().Remove(0, 2).Split(','); GetGridContent(); for (int i = 0; i < TxtCode.Items.Count; i++) { TxtCode.SetItemChecked(i, false); } ArrayList arr = new ArrayList(); arr = ChannelIndex(arrChannel); for (int i = 0; i < TxtCode.Items.Count; i++) { for (int x = 0; x < arr.Count; x++) { if (i == int.Parse(arr[x].ToString())) { TxtCode.SetItemChecked(i, true); } } } button4.Visible = true; } else { MessageBox.Show("重置频道信息成功"); label2.Text = ""; GetChannelList(); TxtContent.Clear(); TxtIID.Clear(); TxtSpeed.Clear(); TxtColor.Clear(); ChkPlay.Checked = false; ChkStatus.Checked = false; GrpInput.Visible = false; GetGridContent(); button4.Visible = false; } }