private void m_msg_input_tbx_KeyDown(object sender, KeyEventArgs e) { if (!e.Shift && e.KeyCode == Keys.Enter) { string msg = m_msg_input_tbx.Text.Trim(); if (string.IsNullOrEmpty(msg)) { return; } msg = MsgInputConfig.FormatMessage(msg); m_msg_input_tbx.Text = string.Empty; foreach (UserInfo user in m_user_list.Items) { OutgoingPackagePool.Add(NetPackageGenerater.AppendGroupTextMessage(m_group.Key, msg, user.RemoteIP)); } e.Handled = true; e.SuppressKeyPress = true; } else if (e.Alt && e.KeyCode == Keys.C) { Close(); } }
protected override void ExecuteImpl() { if (m_text.Contains(TextCommand_IsAlive)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendTextMessage(MsgInputConfig.FormatMessage("I'm alive."), m_remoteIP)); return; } else if (m_text.Contains(TextCommand_Version)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendTextMessage(MsgInputConfig.FormatMessage(DataManager.Version), m_remoteIP)); return; } else if (m_text.Contains(TextCommand_Dead_Pkg_Count)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendTextMessage(MsgInputConfig.FormatMessage(Logger.Get_Dead_Pkg_Counter()), m_remoteIP)); return; } UserInfo usr = UserInfoManager.FindUser(m_remoteIP);; usr.AppendMessage(m_text, usr.Username); Logger.WriteLine("Add message:" + m_text); }
private void m_msg_input_tbx_KeyDown(object sender, KeyEventArgs e) { if (!e.Shift && e.KeyCode == Keys.Enter) { string msg = m_msg_input_tbx.Text.Trim(); if (string.IsNullOrEmpty(msg)) { return; } msg = MsgInputConfig.FormatMessage(msg); m_msg_input_tbx.Text = string.Empty; m_userinfo.AppendMessage(msg, DataManager.WhoAmI); OutgoingPackagePool.Add(NetPackageGenerater.AppendTextMessage(msg, m_userinfo.RemoteIP)); e.Handled = true; e.SuppressKeyPress = true; } else if (e.Alt && e.KeyCode == Keys.C) { Close(); } }
protected override void ExecuteImpl() { GroupInfo gi = GroupInfoManager.FindGroup(m_groupKey); if (gi != null) { if (m_text.Contains(TextCommand_IsAlive)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendGroupTextMessage(gi.Key, MsgInputConfig.FormatMessage("I'm alive."), m_remoteIP)); return; } else if (m_text.Contains(TextCommand_Version)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendGroupTextMessage(gi.Key, MsgInputConfig.FormatMessage(DataManager.Version), m_remoteIP)); return; } else if (m_text.Contains(TextCommand_Dead_Pkg_Count)) { OutgoingPackagePool.AddFirst(NetPackageGenerater.AppendTextMessage(MsgInputConfig.FormatMessage(Logger.Get_Dead_Pkg_Counter()), m_remoteIP)); return; } } UserInfo usr = UserInfoManager.FindUser(m_remoteIP); if (gi != null && usr != null) { gi.AppendMessage(m_text, usr.Username); } }