/// <summary> /// 装载聊天信息 /// </summary> /// <param name="chatInfo">聊天信息详情</param> /// <param name="line">内容</param> /// <returns>装载完成的聊天信息</returns> private static Chat LoadChat(ChatInfo chatInfo, string line) { // 替换小队前面的乱码字符 line = line.Replace("", "①").Replace("", "②") .Replace("", "③").Replace("", "④") .Replace("", "⑤").Replace("", "⑥") .Replace("", "⑦").Replace("", "⑧") // 替换物品乱码 .Replace("", "") // 替换团本乱码 .Replace("", "Ⓐ").Replace("", "Ⓑ") .Replace("", "Ⓒ"); var sp = line.Split('|'); var time = sp[1].Substring(11, 5); var chat = new Chat { Show = ChatTypeHandler.IsShowThisChatType(chatInfo.ChatType), ChatInfo = chatInfo, Time = time, PlayerName = sp[3], Context = sp[4] }; return(chat); }
/// <summary> /// 将UI中的复选框装填到复选框数组当中 /// </summary> /// <param name="i">位置</param> private void LoadCheckBox(int i) { if (!(Controls.Find("checkbox" + (i + 1), true)[0] is CheckBox checkBox)) { return; } checkBox.Text = ChatTypeHandler.ChatTypeToName((ChatType)i); _checkBoxArr[i] = checkBox; }
/// <summary> /// 取消 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button2_Click(object sender, EventArgs e) { for (var i = 0; i < IsShowArrLength; i++) { _checkBoxArr[i].Checked = ChatTypeHandler.IsShowThisChatType(i); } Hide(); }
/// <summary> /// 初始化过滤器 /// </summary> private static void InitChecked() { for (var i = 0; i < ChatTypeHandler.GetIsShowArrayLength(); i++) { if (i == (int)ChatType.Party || i == (int)ChatType.Speak || i == (int)ChatType.Yell || i == (int)ChatType.Alliance || i == (int)ChatType.Shout || i == (int)ChatType.Motion || i == (int)ChatType.Tell) { ChatTypeHandler.SetIsShowThisChatType(i, true); } } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { // 将储存复选框状态的数组修改为对应复选框的选择状态 for (var i = 0; i < IsShowArrLength; i++) { ChatTypeHandler.SetIsShowThisChatType(i, _checkBoxArr[i].Checked); } var newChatList = new List <Chat>(); foreach (var chat in _chatList) { chat.Show = ChatTypeHandler.IsShowThisChatType(chat.ChatInfo.ChatType); newChatList.Add(chat); } Hide(); _mainForm.RefreshRichTextBox(newChatList); }
private void FilterForm_Load(object sender, EventArgs e) { // 获取主窗口对象 _mainForm = (MainForm)Owner; // 加载复选框 for (var i = 0; i < _checkBoxArr.Length; i++) { LoadCheckBox(i); _checkBoxArr[i].Checked = ChatTypeHandler.IsShowThisChatType(i); } // 注册各个全选按钮和取消全选按钮的点击事件 g1AllSelect.Click += (o, args) => { AllSelect(0, 9); }; g2AllSelect.Click += (o, args) => { AllSelect(9, 17); }; g3AllSelect.Click += (o, args) => { AllSelect(17, 25); }; g1NoSelect.Click += (o, args) => { NoSelect(0, 9); }; g2NoSelect.Click += (o, args) => { NoSelect(9, 17); }; g3NoSelect.Click += (o, args) => { NoSelect(17, 25); }; }