📄 groupconversationform.cs
字号:
}
private void AppendSendMessageError(string message, string error)
{
try
{
message = Imps.Utils.TagParser.TagParser.Create(message, false).Text;
message = StringHelper.GetPaddingStringEndEllipsis(message, 0x12);
message = message + " ";
message = StringHelper.EncodString(message);
message = string.Format(StringTable.Conversation.MsgMessageSendFailed, message, error);
this.AppendMessage(new CommonMessage(null, message));
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void btnSend_ButtonClick(object sender, EventArgs e)
{
this.SendMessage();
}
private void ConversationSetting_PropertiesChanged(object sender, PropertiesChangedEventArgs e)
{
if (!base.IsDisposed && e.ContainsProperty("EnterToSend"))
{
if (this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey != null)
{
this.tsSendCtrlEnter.set_Checked(false);
this.tsSendEnter.set_Checked(true);
}
else
{
this.tsSendCtrlEnter.set_Checked(true);
this.tsSendEnter.set_Checked(false);
}
}
}
private static string ConvertString(string source)
{
return StringHelper.EncodString(source);
}
private void CurrentUser_StatusChanged(object sender, UserSatusChangedEventArgs e)
{
if (!base.IsDisposed)
{
try
{
if (e.NewStatus == UserAccountStatus.Logon)
{
this.DoUserLogon();
}
else if (e.OldStatus == UserAccountStatus.Logon)
{
this.DoUserNotLogon();
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
}
private void de_DisplayEmoticonsHide(object sender, EventArgs e)
{
this.tsbEmoticons.set_Checked(false);
}
private void diallg_SendMessageFailed(object sender, MessageSendFailedEventArgs e)
{
this.AppendSendMessageError(e.Message.Content, e.Error);
}
private void dialog_Closed(object sender, EventArgs e)
{
}
private void dialog_MessageRecieved(object sender, MessageEventArgs e)
{
this.AppendMessage(e.Message);
}
protected override void Dispose(bool disposing)
{
if (disposing && (this.components != null))
{
this.components.Dispose();
}
base.Dispose(disposing);
}
private void DoUserLogon()
{
}
private void DoUserNotLogon()
{
base.Close();
}
private void emotion_EmoticonSelected(object sender, EmoticonEventArgs e)
{
try
{
if (e.IsCustomEmoticon)
{
this.CurrentUser.CustomEmotionManager.AddClicks(e.CustomEmotion);
this._inputChatManager.InsertCustomEmotion(e.CustomEmotion, this.GetCustomEmotionImage(e.CustomEmotion.Id));
}
else
{
this._inputChatManager.InsertEmoticon(e.Emoticon.Key);
}
}
catch (Exception)
{
}
}
private void FormatSMSInputInfo()
{
if (this.lblSMSSendInfo.Visible)
{
this.lblSMSSendInfo.Text = string.Format(StringTable.Conversation.MsgSMSInputInfo, this.rtfInput.MaxLength - this.rtfInput.TextLength);
}
else
{
this.lblSMSSendInfo.Text = "";
}
}
private void FormatSMSOrMessageDisplay()
{
bool sendSMS = this.topControl.SendSMS;
this.pnlSendTypeImage.Visible = sendSMS;
if (sendSMS)
{
this.btnSend.Text = "发送短信";
this.rtfInput.MaxLength = this.CurrentUser.Configuration.SystemSetting.SysSmsSetting.MaxMsgLenSmsOnline;
if (this.rtfInput.TextLength > this.rtfInput.MaxLength)
{
this.rtfInput.Text = this.rtfInput.Text.Substring(0, this.rtfInput.MaxLength);
}
this.lblSMSSendInfo.Visible = this.btnSend.Visible;
}
else
{
this.btnSend.Text = "发送";
this.rtfInput.MaxLength = this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.MaxLengthOneMessage;
this.lblSMSSendInfo.Visible = false;
}
this.FormatSMSInputInfo();
}
private void FormtEditMenu()
{
if (this.rtfInput.Focused)
{
this.tsInputChatUndo.set_Enabled(this._inputChatManager.CanUndo);
this.tsInputChatPaste.set_Enabled(this._inputChatManager.CanPaste);
this.tsInputChatCopy.set_Enabled(this._inputChatManager.CanCopy);
this.tsInputChatCut.set_Enabled(this._inputChatManager.CanCut);
this.tsInputChatDelete.set_Enabled(this._inputChatManager.CanCut);
this.tsInputChatSelectALl.set_Enabled(this.rtfInput.Text != "");
this.tsInputChangeFont.set_Enabled(true);
}
else
{
this.tsInputChatUndo.set_Enabled(false);
this.tsInputChatPaste.set_Enabled(false);
this.tsInputChatCopy.set_Enabled(this._historyChatManager.CanCopy);
this.tsInputChatCut.set_Enabled(false);
this.tsInputChatDelete.set_Enabled(false);
this.tsInputChatSelectALl.set_Enabled(this.rtfHistory.Text != "");
this.tsInputChangeFont.set_Enabled(false);
}
}
private Imps.Client.Core.CustomEmotion.CustomEmotion GetCustomEmotion(string xml, OleKey key, out Image image)
{
string pattern = "id\\s{0,}=\\s{0,}\\\"{0,1}(?<id>\\w*)\\\"{0,1}";
Match match = Regex.Match(xml, pattern, RegexOptions.Singleline | RegexOptions.IgnoreCase);
if (!match.Success || (match.Groups["id"] == null))
{
throw new ArgumentException("xml不符合规则");
}
string id = string.Empty;
string text3 = string.Empty;
string text4 = string.Empty;
using (StringReader input = new StringReader(xml))
{
using (XmlReader reader2 = new XmlTextReader(input))
{
while (reader2.Read())
{
if (reader2.HasAttributes)
{
while (reader2.MoveToNextAttribute())
{
switch (reader2.Name.ToLower())
{
case "id":
{
id = reader2.Value.ToUpper();
continue;
}
case "name":
{
text3 = reader2.Value;
continue;
}
case "shortcut":
break;
default:
{
continue;
}
}
text4 = reader2.Value;
}
continue;
}
if (reader2.HasValue)
{
text4 = reader2.Value;
}
}
}
}
image = this.GetCustomEmotionImage(id);
Imps.Client.Core.CustomEmotion.CustomEmotion emotion = null;
if ((this.CurrentUser.CustomEmotionManager.OwnerEmotions.ContainsKey(id) && (this.CurrentUser.CustomEmotionManager.OwnerEmotions[id].Name == text3)) && (this.CurrentUser.CustomEmotionManager.OwnerEmotions[id].ShortCut == text4))
{
emotion = this.CurrentUser.CustomEmotionManager.OwnerEmotions[id];
}
if (emotion == null)
{
emotion = Imps.Client.Core.CustomEmotion.CustomEmotion.FromXml(xml);
}
if (image == null)
{
image = ImpsIcons.Loading2;
AsyncBizOperation op = new AsyncBizOperation(key);
op.Successed += new EventHandler(this.opEmotionDown_Successed);
op.ImpsError += new EventHandler<ImpsErrorEventArgs>(this, (IntPtr) this.opEmotionDown_ImpsError);
this.CurrentUser.CustomEmotionManager.AsyncDownLoadEmotionImage(emotion, op);
}
return emotion;
}
private Image GetCustomEmotionImage(string id)
{
if (this._dicMd5Images == null)
{
this._dicMd5Images = new Dictionary<string, Image>();
}
if (this._dicMd5Images.ContainsKey(id))
{
return this._dicMd5Images.get_Item(id);
}
Image emotionImageById = this.CurrentUser.CustomEmotionManager.GetEmotionImageById(id);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -