www.pudn.com > Fetion.rar > GroupConversationForm.cs
namespace Imps.Client.Pc
{
using Imps.Client;
using Imps.Client.Core;
using Imps.Client.Core.CustomEmotion;
using Imps.Client.Pc.BizControls;
using Imps.Client.Pc.BizControls.Conversation;
using Imps.Client.Pc.Properties;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Utils;
using Imps.Utils.TagParser;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using System.Xml;
public class GroupConversationForm : XConversationForm
{
private bool _activated;
private Size _defaultEmotionSize = ImpsEmoticons.EmoticonSize;
private Dictionary _dicMd5Images;
private WndlessFolder _folderNavigator;
private IFrameworkWindow _frameworkWnd;
private PersonalGroup _group;
private ChatEditCtrlManager _historyChatManager;
private ChatEditCtrlManager _inputChatManager;
private Size _messageEmotionSize = ImpsEmoticons.EmoticonSize;
private ConversationOperation _operation;
private int _richIdentity = 12;
private bool _sendSMS;
private Size _smallEmotionSize = ImpsEmoticons.Size;
private AsyncBizOperation _smsOperation;
private SendMessageButton btnSend;
private IContainer components;
private DisplayEmoticons de;
private FontDialog fontDialog;
private Label lblGroupMembersInfo;
private HtmlLabel lblSMSSendInfo;
private XConversationTip lblTooltip;
private PGConversationRightControl listControl;
private menu_widget menuHistoryChat;
private menu_widget menuInputChat;
private menu_widget menuSendType;
private Panel panel1;
private PictureBox pictureBox1;
private Panel pnlCenter;
private Panel pnlContainer;
private Panel pnlForWhiteBackground;
private Panel pnlNav;
private Panel pnlRight;
private Panel pnlSendTypeImage;
private Panel pnlTop;
private ChatRichTextBox rtfHistory;
private ChatRichTextBox rtfInput;
private SaveFileDialog saveFileDialog;
private IMSplitContainer scMain;
private ToolStripSeparator toolStripSeparator2;
private ToolStripSeparator toolStripSeparator3;
private ToolStripSeparator toolStripSeparator9;
private PGConversationTopControl topControl;
private ToolStripButton tsbEmoticons;
private ToolStripButton tsFont;
private ToolStripMenuItem tsHistoryAddToCustomEmotion;
private ToolStripMenuItem tsHistoryChatCopy;
private ToolStripMenuItem tsHistoryChatSelectAll;
private ToolStripMenuItem tsHistorySaveAsImage;
private ToolStripSeparator tsHistorySeparator;
private ToolStripMenuItem tsInputChangeFont;
private ToolStripMenuItem tsInputChatCopy;
private ToolStripMenuItem tsInputChatCut;
private ToolStripMenuItem tsInputChatDelete;
private ToolStripMenuItem tsInputChatPaste;
private ToolStripMenuItem tsInputChatSelectALl;
private ToolStripMenuItem tsInputChatUndo;
private ToolStripMenuItem tsSendCtrlEnter;
private ToolStripMenuItem tsSendEnter;
private IMToolstrip tsSendMessage;
private Rectangle workAreaRectangle;
public GroupConversationForm(IFrameworkWindow framework, PersonalGroup group, ConversationOperation operation)
{
this.InitializeComponent();
base.initComponentRegion();
this._frameworkWnd = framework;
this._group = group;
this._operation = operation;
this.InitChatControl();
this.lblGroupMembersInfo.ForeColor = Color.White;
this.lblGroupMembersInfo.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lblGroupMembersInfo.Location = new System.Drawing.Point(this.pnlContainer.Left + 10, (this.pnlContainer.Height + this.pnlContainer.Top) + 10);
}
private int _historyChatManager_BeforeContextMenuShow(object sender, ChatEditEventArgs e)
{
try
{
this._historyChatManager.Focus();
this.tsHistoryChatSelectAll.Enabled = this.rtfHistory.Text != string.Empty;
this.tsHistoryChatCopy.Enabled = this._historyChatManager.CanCopy;
this.tsHistorySeparator.Visible = false;
this.tsHistorySaveAsImage.Visible = false;
this.tsHistoryAddToCustomEmotion.Visible = false;
if (e.EventType == ChatEditEventType.CustomEmotion)
{
if (!(e.Context is Imps.Client.Core.CustomEmotion.CustomEmotion))
{
return 1;
}
this.tsHistorySeparator.Visible = true;
this.tsHistorySaveAsImage.Visible = true;
this.tsHistoryAddToCustomEmotion.Visible = true;
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
return 1;
}
private int _inputChatManager_BeforeContextMenuShow(object sender, ChatEditEventArgs e)
{
if (this.rtfInput.RectangleToScreen(this.rtfInput.ClientRectangle).Contains(Control.MousePosition))
{
this._inputChatManager.Focus();
this.FormtEditMenu();
}
return 1;
}
private void _inputChatManager_KeyDown(object sender, KeyEventArgs e)
{
if ((e.KeyCode == Keys.Escape) && string.IsNullOrEmpty(this._inputChatManager.Text.Trim()))
{
base.Close();
}
else
{
if (((this.tsSendEnter.Checked && (e.KeyCode == Keys.Return)) && !e.Control) || ((this.tsSendCtrlEnter.Checked && e.Control) && (e.KeyCode == Keys.Return)))
{
e.SuppressKeyPress = true;
this.SendMessage();
}
if (e.Control && (((e.KeyCode == Keys.E) || (e.KeyCode == Keys.R)) || (e.KeyCode == Keys.L)))
{
e.Handled = true;
}
}
}
private void _smsOperation_ImpsError(object sender, ImpsErrorEventArgs e)
{
e.Handled = true;
this.AppendSendMessageError((sender as AsyncBizOperation).ContextForBiz.ToString(), e.Summary);
}
private void AddConversationEvent()
{
try
{
if (this.CurrentDialog != null)
{
this.CurrentDialog.MessageRecieved += new EventHandler(this.dialog_MessageRecieved);
this.CurrentDialog.SendMessageFailed += new EventHandler(this.diallg_SendMessageFailed);
this.CurrentDialog.Closed += new EventHandler(this.dialog_Closed);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void AddGlobalEvent()
{
this.CurrentUser.StatusChanged += new EventHandler(this.CurrentUser_StatusChanged);
this.CurrentUser.Configuration.UserSetting.ConversationSetting.PropertiesChanged += new EventHandler(this.ConversationSetting_PropertiesChanged);
this.CurrentUser.PersonalGroupManager.GroupDeleted += new EventHandler(this.PersonalGroupManager_GroupDeleted);
this.CurrentUser.PersonalGroupManager.GroupRemoved += new EventHandler(this.PersonalGroupManager_GroupRemoved);
this.CurrentUser.PersonalGroupManager.MeBeDeleted += new EventHandler(this.PersonalGroupManager_MeBeDeleted);
this.CurrentUser.PersonalGroupManager.MemberDestroyed += new EventHandler(this.PersonalGroupManager_MemberDestroyed);
this.CurrentUser.PersonalGroupManager.MembersInfoChanged += new EventHandler(this.PersonalGroupManager_MembersInfoChanged);
this.CurrentUser.PersonalGroupManager.GroupInfoChanged += new EventHandler(this.PersonalGroupManager_GroupInfoChanged);
this.CurrentUser.PersonalGroupManager.MemberDeleted += new EventHandler(this.PersonalGroupManager_MemberDeleted);
this.CurrentUser.PersonalGroupManager.MemberExited += new EventHandler(this.PersonalGroupManager_MemberExited);
this.CurrentUser.PersonalGroupManager.MemberJoined += new EventHandler(this.PersonalGroupManager_MemberJoined);
}
private void AppendIMOrSMSMessage(Imps.Client.Core.Message msg)
{
msg.NewLine = this.CurrentConversation.CurrentDialog.MsgManager.IsMessageNewLine(msg);
if (!msg.NewLine)
{
this._historyChatManager.SelectionIdent = this._richIdentity;
this._historyChatManager.AppentString(msg.Content, this._messageEmotionSize);
}
else
{
this._historyChatManager.SelectionIdent = 0;
string str = string.Empty;
if (!string.IsNullOrEmpty(msg.FromSid))
{
str = string.Format(" ({0})", msg.FromSid);
}
this._historyChatManager.AppentString(string.Format(StringTable.Conversation.MsgSendIMFormat, ConvertString(msg.From) + str), this._smallEmotionSize);
try
{
this._historyChatManager.SelectionStart = this._historyChatManager.Length;
this._historyChatManager.AppendRichTextPlainString(string.Format("({0}):", DateTime.Now.ToString("HH:mm")));
}
catch (Exception exception)
{
this.HandleException(exception);
}
this._historyChatManager.AppendCRLF();
this._historyChatManager.SelectionIdent = this._richIdentity;
this._historyChatManager.AppentString(msg.Content, this._messageEmotionSize);
}
}
private void AppendMessage(Imps.Client.Core.Message msg)
{
if (!this.rtfHistory.IsDisposed)
{
try
{
if (!this.BeActivated || (base.WindowState == FormWindowState.Minimized))
{
ControlHelper.FlashWindow(this);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
try
{
this._historyChatManager.SelectionStart = this._historyChatManager.Length;
if ((msg is IMMessage) || (msg is SMSMessage))
{
this.AppendIMOrSMSMessage(msg);
}
else if (msg is CommonMessage)
{
this._historyChatManager.SelectionIdent = 0;
this._historyChatManager.AppentString(msg.Content);
}
else
{
this._historyChatManager.SelectionIdent = 0;
this._historyChatManager.AppentString(msg.Content);
}
this._historyChatManager.AppendCRLF();
this._historyChatManager.ScrollToEnd();
}
catch (Exception exception2)
{
this.HandleException(exception2);
}
}
}
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.Checked = false;
this.tsSendEnter.Checked = true;
}
else
{
this.tsSendCtrlEnter.Checked = true;
this.tsSendEnter.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.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.Enabled = this._inputChatManager.CanUndo;
this.tsInputChatPaste.Enabled = this._inputChatManager.CanPaste;
this.tsInputChatCopy.Enabled = this._inputChatManager.CanCopy;
this.tsInputChatCut.Enabled = this._inputChatManager.CanCut;
this.tsInputChatDelete.Enabled = this._inputChatManager.CanCut;
this.tsInputChatSelectALl.Enabled = this.rtfInput.Text != "";
this.tsInputChangeFont.Enabled = true;
}
else
{
this.tsInputChatUndo.Enabled = false;
this.tsInputChatPaste.Enabled = false;
this.tsInputChatCopy.Enabled = this._historyChatManager.CanCopy;
this.tsInputChatCut.Enabled = false;
this.tsInputChatDelete.Enabled = false;
this.tsInputChatSelectALl.Enabled = this.rtfHistory.Text != "";
this.tsInputChangeFont.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}(?\\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 str3 = string.Empty;
string str4 = string.Empty;
using (StringReader reader = new StringReader(xml))
{
using (XmlReader reader2 = new XmlTextReader(reader))
{
while (reader2.Read())
{
if (reader2.HasAttributes)
{
while (reader2.MoveToNextAttribute())
{
string str5 = reader2.Name.ToLower();
if (str5 != null)
{
if (!(str5 == "id"))
{
if (str5 == "name")
{
goto Label_00B5;
}
if (str5 == "shortcut")
{
goto Label_00BF;
}
}
else
{
id = reader2.Value.ToUpper();
}
}
continue;
Label_00B5:
str3 = reader2.Value;
continue;
Label_00BF:
str4 = reader2.Value;
}
continue;
}
if (reader2.HasValue)
{
str4 = 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 == str3)) && (this.CurrentUser.CustomEmotionManager.OwnerEmotions[id].ShortCut == str4))
{
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(this.opEmotionDown_ImpsError);
this.CurrentUser.CustomEmotionManager.AsyncDownLoadEmotionImage(emotion, op);
}
return emotion;
}
private Image GetCustomEmotionImage(string id)
{
if (this._dicMd5Images == null)
{
this._dicMd5Images = new Dictionary();
}
if (this._dicMd5Images.ContainsKey(id))
{
return this._dicMd5Images[id];
}
Image emotionImageById = this.CurrentUser.CustomEmotionManager.GetEmotionImageById(id);
if (emotionImageById != null)
{
this._dicMd5Images.Add(id, emotionImageById);
}
return emotionImageById;
}
private void GroupConversationForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.Alt && (e.KeyCode == Keys.S))
{
e.SuppressKeyPress = true;
this.SendMessage();
}
this._historyChatManager.SendKeys(e.KeyCode, e.Modifiers);
}
private void HandleException(Exception ex)
{
ClientLogger.WriteException(ex);
}
private void InitChatControl()
{
EventHandler handler = null;
try
{
this._historyChatManager = new ChatEditCtrlManager(this.rtfHistory, true);
this._historyChatManager.ReadOnly = true;
this._historyChatManager.LinkClick += new ChatEditClickEventHandler(this.richEdit_LinkClick);
this._historyChatManager.BeforeContextMenuShow += new BeforeContextMenuShowHandler(this._historyChatManager_BeforeContextMenuShow);
this._inputChatManager = new ChatEditCtrlManager(this.rtfInput, false, this.CurrentUser);
this._inputChatManager.LinkClick += new ChatEditClickEventHandler(this.richEdit_LinkClick);
this._inputChatManager.AllowDrop = true;
this._inputChatManager.BeforeContextMenuShow += new BeforeContextMenuShowHandler(this._inputChatManager_BeforeContextMenuShow);
this._inputChatManager.KeyDown += new KeyEventHandler(this._inputChatManager_KeyDown);
this._historyChatManager.DefaultTextFont = this.CurrentUser.Configuration.UserSetting.ConversationSetting.DefaultFont;
this._historyChatManager.SelectionFont = this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.HistoryFont;
this._historyChatManager.ForeColor = SystemColors.ControlText;
this._historyChatManager.ContextMenuStrip = this.menuHistoryChat;
this._inputChatManager.ContextMenuStrip = this.menuInputChat;
this._inputChatManager.DefaultTextFont = this.CurrentUser.Configuration.UserSetting.ConversationSetting.DefaultFont;
this.rtfInput.MaxLength = this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.MaxLengthOneMessage;
GlobalTimer.Register(new EventHandler(this.Timer_UpdateEmotion_Tick), this, 2);
base.Activated += new EventHandler(this.This_ActivatedOrShown);
base.Shown += new EventHandler(this.This_ActivatedOrShown);
this._inputChatManager.ConvertString = new DelegateConvert(GroupConversationForm.ConvertString);
this._historyChatManager.ConvertString = new DelegateConvert(GroupConversationForm.ConvertString);
this._historyChatManager.GetCustomEmotion = new ChatEditCtrlManager.GetCustomEmotionDelegate(this.GetCustomEmotion);
this._historyChatManager.GetCustomEmotionImage = new ChatEditCtrlManager.GetCustomEmotionImageDelegate(this.GetCustomEmotionImage);
this._inputChatManager.GetCustomEmotion = new ChatEditCtrlManager.GetCustomEmotionDelegate(this.GetCustomEmotion);
this._inputChatManager.GetCustomEmotionImage = new ChatEditCtrlManager.GetCustomEmotionImageDelegate(this.GetCustomEmotionImage);
this._inputChatManager.AutoParseCustomEmotion = true;
if (handler == null)
{
handler = delegate {
this.btnSend.Disabled = this.rtfInput.TextLength == 0;
this.FormatSMSInputInfo();
};
}
this.rtfInput.TextChanged += handler;
this._historyChatManager.SympolSize = this._defaultEmotionSize;
this._inputChatManager.SympolSize = this._messageEmotionSize;
if (EnvHelper.DynamicGifCtlRegistered)
{
this._historyChatManager.ConvertSympol = true;
this._inputChatManager.ConvertSympol = true;
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void InitCommonControls()
{
this.InitGroupMembersLable();
this.InitGroupCaption();
}
private void InitConversation()
{
try
{
this.AddConversationEvent();
this.CurrentConversation.OwnerFormCreated = true;
if ((base.WindowState == FormWindowState.Minimized) && (this._frameworkWnd.ConversationManager is ConversationManagerImp))
{
(this._frameworkWnd.ConversationManager as ConversationManagerImp).PlayMessageReceiveSource();
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void InitDisplayEmoticon()
{
this.de = new DisplayEmoticons(ImpsEmoticons.DistinctEmoticonList, ImpsEmoticons.DistinctEmoticonList, this._frameworkWnd);
this.de.RowCount = 5;
this.de.DisplayEmoticonsHide += new EventHandler(this.de_DisplayEmoticonsHide);
this.de.EmoticonSelected += new EventHandler(this.emotion_EmoticonSelected);
}
private void InitGroupCaption()
{
base.Text = string.Format("{0} - {1}", this._group.GroupInfo.Name, this._group.GroupInfo.Id);
}
private void InitGroupMembersLable()
{
try
{
this.lblGroupMembersInfo.Text = string.Format("群在线{0}人/共{1}人", this._group.GroupInfo.OnLineMembersCount, this._group.Members.Count);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void InitializeComponent()
{
this.components = new Container();
ComponentResourceManager manager = new ComponentResourceManager(typeof(GroupConversationForm));
this.pnlTop = new Panel();
this.pnlRight = new Panel();
this.pnlContainer = new Panel();
this.pnlCenter = new Panel();
this.scMain = new IMSplitContainer();
this.panel1 = new Panel();
this.rtfHistory = new ChatRichTextBox();
this.lblTooltip = new XConversationTip();
this.lblSMSSendInfo = new HtmlLabel();
this.pnlForWhiteBackground = new Panel();
this.rtfInput = new ChatRichTextBox();
this.pnlSendTypeImage = new Panel();
this.pictureBox1 = new PictureBox();
this.btnSend = new SendMessageButton();
this.menuSendType = new menu_widget(this.components);
this.tsSendEnter = new ToolStripMenuItem();
this.tsSendCtrlEnter = new ToolStripMenuItem();
this.tsSendMessage = new IMToolstrip();
this.tsbEmoticons = new ToolStripButton();
this.tsFont = new ToolStripButton();
this.pnlNav = new Panel();
this.fontDialog = new FontDialog();
this.menuHistoryChat = new menu_widget(this.components);
this.tsHistoryChatCopy = new ToolStripMenuItem();
this.tsHistoryChatSelectAll = new ToolStripMenuItem();
this.tsHistorySeparator = new ToolStripSeparator();
this.tsHistoryAddToCustomEmotion = new ToolStripMenuItem();
this.tsHistorySaveAsImage = new ToolStripMenuItem();
this.menuInputChat = new menu_widget(this.components);
this.tsInputChatUndo = new ToolStripMenuItem();
this.toolStripSeparator2 = new ToolStripSeparator();
this.tsInputChatCut = new ToolStripMenuItem();
this.tsInputChatCopy = new ToolStripMenuItem();
this.tsInputChatPaste = new ToolStripMenuItem();
this.tsInputChatDelete = new ToolStripMenuItem();
this.toolStripSeparator3 = new ToolStripSeparator();
this.tsInputChatSelectALl = new ToolStripMenuItem();
this.toolStripSeparator9 = new ToolStripSeparator();
this.tsInputChangeFont = new ToolStripMenuItem();
this.lblGroupMembersInfo = new Label();
this.saveFileDialog = new SaveFileDialog();
this.pnlContainer.SuspendLayout();
this.pnlCenter.SuspendLayout();
this.scMain.Panel1.SuspendLayout();
this.scMain.Panel2.SuspendLayout();
this.scMain.SuspendLayout();
this.panel1.SuspendLayout();
this.pnlForWhiteBackground.SuspendLayout();
this.pnlSendTypeImage.SuspendLayout();
((ISupportInitialize) this.pictureBox1).BeginInit();
this.menuSendType.SuspendLayout();
this.tsSendMessage.SuspendLayout();
this.menuHistoryChat.SuspendLayout();
this.menuInputChat.SuspendLayout();
base.SuspendLayout();
this.pnlTop.BackColor = Color.Transparent;
this.pnlTop.Dock = DockStyle.Top;
this.pnlTop.Location = new System.Drawing.Point(0, 0);
this.pnlTop.Name = "pnlTop";
this.pnlTop.Size = new Size(510, 0x44);
this.pnlTop.TabIndex = 0;
this.pnlRight.BackColor = Color.Transparent;
this.pnlRight.Dock = DockStyle.Right;
this.pnlRight.Location = new System.Drawing.Point(0x15a, 0x44);
this.pnlRight.Name = "pnlRight";
this.pnlRight.Padding = new Padding(4, 4, 0, 3);
this.pnlRight.Size = new Size(0x9a, 0x1b2);
this.pnlRight.TabIndex = 4;
this.pnlContainer.BackColor = Color.Transparent;
this.pnlContainer.Controls.Add(this.pnlCenter);
this.pnlContainer.Controls.Add(this.pnlRight);
this.pnlContainer.Controls.Add(this.pnlNav);
this.pnlContainer.Controls.Add(this.pnlTop);
this.pnlContainer.Dock = DockStyle.Fill;
this.pnlContainer.Location = new System.Drawing.Point(4, 0);
this.pnlContainer.Margin = new Padding(0);
this.pnlContainer.Name = "pnlContainer";
this.pnlContainer.Size = new Size(510, 0x1f6);
this.pnlContainer.TabIndex = 2;
this.pnlCenter.BackColor = Color.Transparent;
this.pnlCenter.Controls.Add(this.scMain);
this.pnlCenter.Dock = DockStyle.Fill;
this.pnlCenter.Location = new System.Drawing.Point(0, 0x44);
this.pnlCenter.Name = "pnlCenter";
this.pnlCenter.Padding = new Padding(2, 4, 0, 3);
this.pnlCenter.Size = new Size(0x15a, 0x1b2);
this.pnlCenter.TabIndex = 3;
this.scMain.BackColor = Color.Transparent;
this.scMain.BorderColor = Color.FromArgb(0xa4, 170, 220);
this.scMain.Dock = DockStyle.Fill;
this.scMain.Location = new System.Drawing.Point(2, 4);
this.scMain.Name = "scMain";
this.scMain.Orientation = Orientation.Horizontal;
this.scMain.Panel1.BackColor = Color.White;
this.scMain.Panel1.Controls.Add(this.panel1);
this.scMain.Panel1.Controls.Add(this.lblTooltip);
this.scMain.Panel1.Margin = new Padding(4);
this.scMain.Panel1.Padding = new Padding(1);
this.scMain.Panel1MinSize = 70;
this.scMain.Panel2.BackColor = Color.Transparent;
this.scMain.Panel2.Controls.Add(this.lblSMSSendInfo);
this.scMain.Panel2.Controls.Add(this.pnlForWhiteBackground);
this.scMain.Panel2.Controls.Add(this.pnlSendTypeImage);
this.scMain.Panel2.Controls.Add(this.btnSend);
this.scMain.Panel2.Controls.Add(this.tsSendMessage);
this.scMain.Panel2.Padding = new Padding(1);
this.scMain.Panel2MinSize = 110;
this.scMain.Size = new Size(0x158, 0x1ab);
this.scMain.SpliteImage = (Image) manager.GetObject("scMain.SpliteImage");
this.scMain.SplitterDistance = 0x12b;
this.scMain.SplitterWidth = 9;
this.scMain.TabIndex = 3;
this.scMain.TabStop = false;
this.panel1.BackColor = Color.Transparent;
this.panel1.Controls.Add(this.rtfHistory);
this.panel1.Dock = DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(1, 20);
this.panel1.Name = "panel1";
this.panel1.Padding = new Padding(4, 4, 0, 1);
this.panel1.Size = new Size(0x156, 0x116);
this.panel1.TabIndex = 1;
this.rtfHistory.BackColor = SystemColors.Window;
this.rtfHistory.BorderColor = Color.Empty;
this.rtfHistory.BorderStyle = BorderStyle.None;
this.rtfHistory.Dock = DockStyle.Fill;
this.rtfHistory.Location = new System.Drawing.Point(4, 4);
this.rtfHistory.Name = "rtfHistory";
this.rtfHistory.ReadOnly = true;
this.rtfHistory.Size = new Size(0x152, 0x111);
this.rtfHistory.TabIndex = 0;
this.rtfHistory.TabStop = false;
this.rtfHistory.Text = "";
this.lblTooltip.BackColor = Color.Transparent;
this.lblTooltip.Dock = DockStyle.Top;
this.lblTooltip.HTML = "";
this.lblTooltip.LineColor = Color.FromArgb(0xa4, 170, 220);
this.lblTooltip.Location = new System.Drawing.Point(1, 1);
this.lblTooltip.Name = "lblTooltip";
this.lblTooltip.Size = new Size(0x156, 0x13);
this.lblTooltip.TabIndex = 0;
this.lblTooltip.TabStop = false;
this.lblTooltip.TextFont = new Font("宋体", 9f);
this.lblTooltip.TipImage = (Image) manager.GetObject("lblTooltip.TipImage");
this.lblTooltip.UseSymbol = true;
this.lblTooltip.Visible = false;
this.lblSMSSendInfo.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.lblSMSSendInfo.BackColor = Color.Transparent;
this.lblSMSSendInfo.ForeColor = Color.MediumBlue;
this.lblSMSSendInfo.LinkColor = Color.Blue;
this.lblSMSSendInfo.Location = new System.Drawing.Point(0x65, 0x5c);
this.lblSMSSendInfo.Name = "lblSMSSendInfo";
this.lblSMSSendInfo.ShowBackgroundImage = false;
this.lblSMSSendInfo.Size = new Size(0x89, 0x1a);
this.lblSMSSendInfo.SpaceDistance = 6;
this.lblSMSSendInfo.TabIndex = 10;
this.lblSMSSendInfo.Text = "您还可以输入282个字符";
this.pnlForWhiteBackground.BackColor = Color.White;
this.pnlForWhiteBackground.Controls.Add(this.rtfInput);
this.pnlForWhiteBackground.Dock = DockStyle.Fill;
this.pnlForWhiteBackground.Location = new System.Drawing.Point(0x5f, 1);
this.pnlForWhiteBackground.Name = "pnlForWhiteBackground";
this.pnlForWhiteBackground.Size = new Size(0xf8, 90);
this.pnlForWhiteBackground.TabIndex = 10;
this.rtfInput.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Top;
this.rtfInput.BorderColor = Color.Empty;
this.rtfInput.BorderStyle = BorderStyle.None;
this.rtfInput.Font = new Font("Microsoft Sans Serif", 12f, FontStyle.Regular, GraphicsUnit.Point, 0);
this.rtfInput.Location = new System.Drawing.Point(5, 4);
this.rtfInput.Margin = new Padding(10);
this.rtfInput.MaxLength = 500;
this.rtfInput.Name = "rtfInput";
this.rtfInput.Size = new Size(0xf4, 0x54);
this.rtfInput.TabIndex = 0;
this.rtfInput.Text = "";
this.pnlSendTypeImage.BackColor = Color.White;
this.pnlSendTypeImage.Controls.Add(this.pictureBox1);
this.pnlSendTypeImage.Dock = DockStyle.Left;
this.pnlSendTypeImage.Location = new System.Drawing.Point(1, 1);
this.pnlSendTypeImage.Name = "pnlSendTypeImage";
this.pnlSendTypeImage.Padding = new Padding(3, 5, 2, 2);
this.pnlSendTypeImage.Size = new Size(0x5e, 90);
this.pnlSendTypeImage.TabIndex = 11;
this.pictureBox1.Dock = DockStyle.Top;
this.pictureBox1.Image = Resources.Con_SMS;
this.pictureBox1.Location = new System.Drawing.Point(3, 5);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new Size(0x59, 0x49);
this.pictureBox1.TabIndex = 1;
this.pictureBox1.TabStop = false;
this.btnSend.Anchor = AnchorStyles.Right | AnchorStyles.Bottom;
this.btnSend.BackColor = Color.FromArgb(0xf8, 0xef, 0xe4);
this.btnSend.BackgroundImage = (Image) manager.GetObject("btnSend.BackgroundImage");
this.btnSend.BorderColor = Color.FromArgb(0xa4, 170, 220);
this.btnSend.Disabled = true;
this.btnSend.DisabledBackgroudColor = Color.White;
this.btnSend.DisabledBackgroundImage = (Image) manager.GetObject("btnSend.DisabledBackgroundImage");
this.btnSend.DisabledBorderColor = Color.Gray;
this.btnSend.DisabledDropDownButtonImage = (Image) manager.GetObject("btnSend.DisabledDropDownButtonImage");
this.btnSend.DisabledForeColor = Color.Gray;
this.btnSend.DropDownButtonImage = (Image) manager.GetObject("btnSend.DropDownButtonImage");
this.btnSend.DropDownMenu = this.menuSendType;
this.btnSend.Font = new Font("宋体", 9f, FontStyle.Bold);
this.btnSend.Location = new System.Drawing.Point(0xf3, 0x5b);
this.btnSend.Name = "btnSend";
this.btnSend.Padding = new Padding(1);
this.btnSend.Size = new Size(100, 0x1c);
this.btnSend.TabIndex = 2;
this.btnSend.TabStop = false;
this.btnSend.Text = "发送";
this.btnSend.ToolTipText = "点击发送聊天信息";
this.btnSend.ButtonClick += new EventHandler(this.btnSend_ButtonClick);
this.menuSendType.Items.AddRange(new ToolStripItem[] { this.tsSendEnter, this.tsSendCtrlEnter });
this.menuSendType.Name = "contextMenuSendMessage";
this.menuSendType.Size = new Size(0xd7, 0x30);
this.menuSendType.UseMnemonic = true;
this.tsSendEnter.Checked = true;
this.tsSendEnter.CheckState = CheckState.Checked;
this.tsSendEnter.Name = "tsSendEnter";
this.tsSendEnter.Size = new Size(0xd6, 0x16);
this.tsSendEnter.Text = "按 Enter 键发送消息";
this.tsSendEnter.Click += new EventHandler(this.tsSendEnter_Click);
this.tsSendCtrlEnter.Name = "tsSendCtrlEnter";
this.tsSendCtrlEnter.Size = new Size(0xd6, 0x16);
this.tsSendCtrlEnter.Text = "按 Ctrl+Enter 键发送消息";
this.tsSendCtrlEnter.Click += new EventHandler(this.tsSendCtrlEnter_Click);
this.tsSendMessage.AutoSize = false;
this.tsSendMessage.BackgroundImageLayout = ImageLayout.Stretch;
this.tsSendMessage.Dock = DockStyle.Bottom;
this.tsSendMessage.GripStyle = ToolStripGripStyle.Hidden;
this.tsSendMessage.Items.AddRange(new ToolStripItem[] { this.tsbEmoticons, this.tsFont });
this.tsSendMessage.Location = new System.Drawing.Point(1, 0x5b);
this.tsSendMessage.Name = "tsSendMessage";
this.tsSendMessage.Padding = new Padding(2);
this.tsSendMessage.ShowBackGroundImage = true;
this.tsSendMessage.Size = new Size(0x156, 0x1b);
this.tsSendMessage.TabIndex = 1;
this.tsSendMessage.TabStop = true;
this.tsbEmoticons.AutoSize = false;
this.tsbEmoticons.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.tsbEmoticons.Image = Resources.face;
this.tsbEmoticons.ImageScaling = ToolStripItemImageScaling.None;
this.tsbEmoticons.ImageTransparentColor = Color.Transparent;
this.tsbEmoticons.Name = "tsbEmoticons";
this.tsbEmoticons.Size = new Size(30, 0x1b);
this.tsbEmoticons.Text = "显示表情";
this.tsbEmoticons.Click += new EventHandler(this.tsbEmoticons_Click);
this.tsFont.AutoSize = false;
this.tsFont.DisplayStyle = ToolStripItemDisplayStyle.Image;
this.tsFont.Image = (Image) manager.GetObject("tsFont.Image");
this.tsFont.ImageScaling = ToolStripItemImageScaling.None;
this.tsFont.ImageTransparentColor = Color.Transparent;
this.tsFont.Name = "tsFont";
this.tsFont.Size = new Size(30, 0x1b);
this.tsFont.Text = "设置字体";
this.tsFont.Click += new EventHandler(this.tsFont_Click);
this.pnlNav.Dock = DockStyle.Right;
this.pnlNav.Location = new System.Drawing.Point(500, 0x44);
this.pnlNav.Name = "pnlNav";
this.pnlNav.Size = new Size(10, 0x1b2);
this.pnlNav.TabIndex = 1;
this.fontDialog.ShowColor = true;
this.menuHistoryChat.Items.AddRange(new ToolStripItem[] { this.tsHistoryChatCopy, this.tsHistoryChatSelectAll, this.tsHistorySeparator, this.tsHistoryAddToCustomEmotion, this.tsHistorySaveAsImage });
this.menuHistoryChat.Name = "menuHistoryChat";
this.menuHistoryChat.Size = new Size(0x83, 0x62);
this.menuHistoryChat.UseMnemonic = true;
this.tsHistoryChatCopy.Name = "tsHistoryChatCopy";
this.tsHistoryChatCopy.Size = new Size(130, 0x16);
this.tsHistoryChatCopy.Text = "复制(&C)";
this.tsHistoryChatCopy.Click += new EventHandler(this.tsHistoryChatCopy_Click);
this.tsHistoryChatSelectAll.Name = "tsHistoryChatSelectAll";
this.tsHistoryChatSelectAll.Size = new Size(130, 0x16);
this.tsHistoryChatSelectAll.Text = "全选(&A)";
this.tsHistoryChatSelectAll.Click += new EventHandler(this.tsHistoryChatSelectAll_Click);
this.tsHistorySeparator.Name = "tsHistorySeparator";
this.tsHistorySeparator.Size = new Size(0x7f, 6);
this.tsHistoryAddToCustomEmotion.Name = "tsHistoryAddToCustomEmotion";
this.tsHistoryAddToCustomEmotion.Size = new Size(130, 0x16);
this.tsHistoryAddToCustomEmotion.Text = "添加为表情";
this.tsHistoryAddToCustomEmotion.Click += new EventHandler(this.tsHistoryAddToCustomEmotion_Click);
this.tsHistorySaveAsImage.Name = "tsHistorySaveAsImage";
this.tsHistorySaveAsImage.Size = new Size(130, 0x16);
this.tsHistorySaveAsImage.Text = "保存为图片";
this.tsHistorySaveAsImage.Click += new EventHandler(this.tsHistorySaveAsImage_Click);
this.menuInputChat.Items.AddRange(new ToolStripItem[] { this.tsInputChatUndo, this.toolStripSeparator2, this.tsInputChatCut, this.tsInputChatCopy, this.tsInputChatPaste, this.tsInputChatDelete, this.toolStripSeparator3, this.tsInputChatSelectALl, this.toolStripSeparator9, this.tsInputChangeFont });
this.menuInputChat.Name = "menuInputChat";
this.menuInputChat.Size = new Size(0x9b, 0xb0);
this.menuInputChat.UseMnemonic = true;
this.tsInputChatUndo.Name = "tsInputChatUndo";
this.tsInputChatUndo.Size = new Size(0x9a, 0x16);
this.tsInputChatUndo.Text = "撤销(&U)";
this.tsInputChatUndo.Click += new EventHandler(this.tsInputChatUndo_Click);
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new Size(0x97, 6);
this.tsInputChatCut.Name = "tsInputChatCut";
this.tsInputChatCut.Size = new Size(0x9a, 0x16);
this.tsInputChatCut.Text = "剪切(&T) ";
this.tsInputChatCut.Click += new EventHandler(this.tsInputChatCut_Click);
this.tsInputChatCopy.Name = "tsInputChatCopy";
this.tsInputChatCopy.Size = new Size(0x9a, 0x16);
this.tsInputChatCopy.Text = "复制(&C) ";
this.tsInputChatCopy.Click += new EventHandler(this.tsInputChatCopy_Click);
this.tsInputChatPaste.Name = "tsInputChatPaste";
this.tsInputChatPaste.Size = new Size(0x9a, 0x16);
this.tsInputChatPaste.Text = "粘贴(&P)";
this.tsInputChatPaste.Click += new EventHandler(this.tsInputChatPaste_Click);
this.tsInputChatDelete.Name = "tsInputChatDelete";
this.tsInputChatDelete.Size = new Size(0x9a, 0x16);
this.tsInputChatDelete.Text = "删除(&D)";
this.tsInputChatDelete.Click += new EventHandler(this.tsInputChatDelete_Click);
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new Size(0x97, 6);
this.tsInputChatSelectALl.Name = "tsInputChatSelectALl";
this.tsInputChatSelectALl.Size = new Size(0x9a, 0x16);
this.tsInputChatSelectALl.Text = "全选(&A)";
this.tsInputChatSelectALl.Click += new EventHandler(this.tsInputChatSelectALl_Click);
this.toolStripSeparator9.Name = "toolStripSeparator9";
this.toolStripSeparator9.Size = new Size(0x97, 6);
this.tsInputChangeFont.Name = "tsInputChangeFont";
this.tsInputChangeFont.Size = new Size(0x9a, 0x16);
this.tsInputChangeFont.Text = "修改字体(&F)...";
this.tsInputChangeFont.Click += new EventHandler(this.tsInputChangeFont_Click);
this.lblGroupMembersInfo.Anchor = AnchorStyles.Left | AnchorStyles.Bottom;
this.lblGroupMembersInfo.AutoSize = true;
this.lblGroupMembersInfo.BackColor = Color.Transparent;
this.lblGroupMembersInfo.Location = new System.Drawing.Point(8, 0x20c);
this.lblGroupMembersInfo.Name = "lblGroupMembersInfo";
this.lblGroupMembersInfo.Size = new Size(0x72, 13);
this.lblGroupMembersInfo.TabIndex = 5;
this.lblGroupMembersInfo.Text = "群在线12人/共123人";
base.AutoScaleDimensions = new SizeF(6f, 13f);
base.AutoScaleMode = AutoScaleMode.Font;
base.BaseHeight = 0x221;
base.BaseWidth = 0x206;
base.ClientSize = new Size(0x206, 0x221);
base.Controls.Add(this.lblGroupMembersInfo);
base.Controls.Add(this.pnlContainer);
base.DisplayLocation = new System.Drawing.Point(20, -249);
base.DisplaySize = new Size(0x206, 0x221);
base.Icon = (Icon) manager.GetObject("$this.Icon");
base.KeyPreview = true;
this.MinimumSize = new Size(510, 450);
base.Name = "GroupConversationForm";
base.Padding = new Padding(4, 0, 4, 0x2b);
base.Text = "GroupConversationForm";
base.KeyDown += new KeyEventHandler(this.GroupConversationForm_KeyDown);
this.pnlContainer.ResumeLayout(false);
this.pnlCenter.ResumeLayout(false);
this.scMain.Panel1.ResumeLayout(false);
this.scMain.Panel2.ResumeLayout(false);
this.scMain.ResumeLayout(false);
this.panel1.ResumeLayout(false);
this.pnlForWhiteBackground.ResumeLayout(false);
this.pnlSendTypeImage.ResumeLayout(false);
((ISupportInitialize) this.pictureBox1).EndInit();
this.menuSendType.ResumeLayout(false);
this.tsSendMessage.ResumeLayout(false);
this.tsSendMessage.PerformLayout();
this.menuHistoryChat.ResumeLayout(false);
this.menuInputChat.ResumeLayout(false);
base.ResumeLayout(false);
base.PerformLayout();
}
private void InitListControl()
{
try
{
this.listControl = new PGConversationRightControl(this._frameworkWnd, this.Group);
this.listControl.Dock = DockStyle.Fill;
this.pnlRight.Controls.Add(this.listControl);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void InitNavigaorSetup()
{
this.pnlRight.Visible = (this._folderNavigator.State & WndlessFolder.FolderState.Right) == WndlessFolder.FolderState.Right;
this.pnlTop.Visible = (this._folderNavigator.State & WndlessFolder.FolderState.Down) != WndlessFolder.FolderState.Down;
if (!this.pnlTop.Visible && !this.pnlRight.Visible)
{
this.tsSendMessage.Visible = false;
this.btnSend.Visible = false;
this.lblSMSSendInfo.Visible = false;
}
else
{
this.tsSendMessage.Visible = true;
this.btnSend.Visible = true;
}
}
private void InitNavigatorControl()
{
EventHandler handler = null;
try
{
WndlessControlCollection controls = new WndlessControlCollection(this.pnlNav);
this._folderNavigator = new WndlessFolder();
this._folderNavigator.Cursor = Cursors.Hand;
this._folderNavigator.Location = new System.Drawing.Point(1, this.scMain.Top);
this._folderNavigator.FolderColor = Color.White;
this._folderNavigator.TriangleSize = new Size(5, 3);
this._folderNavigator.State = (WndlessFolder.FolderState) this.CurrentUser.Configuration.UserSetting.ConversationSetting.GroupWindowState;
this.InitNavigaorSetup();
if (handler == null)
{
handler = delegate (object sender, EventArgs e) {
this.CurrentUser.Configuration.UserSetting.ConversationSetting.GroupWindowState = (int) this._folderNavigator.State;
this.InitNavigaorSetup();
};
}
this._folderNavigator.Click += handler;
controls.Add(this._folderNavigator);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void InitToolTipInfo()
{
string str = string.Empty;
if (((this._group.SuperManger == null) && this._group.GroupInfo.DestroyTime.HasValue) && (this._group.GroupInfo.DestroyTime.Value > DateTime.Now))
{
str = string.Format("超级管理员已注销飞信服务,该群将于{0}被删除,特此通知!", this._group.GroupInfo.DestroyTime.Value.ToString("yyyy年MM月dd日"));
}
if (!string.IsNullOrEmpty(str))
{
this.lblTooltip.BackColor = Color.FromArgb(0xf9, 0xf6, 0xdb);
this.lblTooltip.Visible = true;
this.lblTooltip.Text = str;
}
else
{
this.lblTooltip.Visible = false;
}
}
private void InitTopControl(bool sms)
{
try
{
this.topControl = new PGConversationTopControl(this._frameworkWnd, this.Group);
this.topControl.Dock = DockStyle.Fill;
this.topControl.SendSMS = sms;
this.pnlTop.Controls.Add(this.topControl);
this.topControl.SendSMSChanged += new EventHandler(this.topControl_SendSMSChanged);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
internal void LoadWindowSetting()
{
try
{
Imps.Client.Core.ConversationSetting conversationSetting = this.CurrentUser.Configuration.UserSetting.ConversationSetting;
this._inputChatManager.SelectionFont = this.CurrentUser.Configuration.UserSetting.ConversationSetting.Font;
this._inputChatManager.ForeColor = this.CurrentUser.Configuration.UserSetting.ConversationSetting.Color;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
protected override void OnFormClosed(FormClosedEventArgs e)
{
base.OnFormClosed(e);
try
{
this.SaveWindowSetting();
this.RemoveGlobalEvent();
this.RemoveConversationEvent();
if (this.CurrentConversation != null)
{
this.CurrentConversation.OwnerFormCreated = false;
this.CurrentConversation.CurrentDialog.MsgManager.SetNextNewLine();
}
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
protected override void OnKeyDown(KeyEventArgs e)
{
if (e.KeyCode == Keys.Escape)
{
if (string.IsNullOrEmpty(this._inputChatManager.Text.Trim()))
{
base.Close();
}
}
else
{
base.OnKeyDown(e);
}
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.InitListControl();
this.InitTopControl(this._operation == ConversationOperation.SmsChat);
this.InitNavigatorControl();
this.InitConversation();
this.AddGlobalEvent();
this.FormatSMSOrMessageDisplay();
this.InitCommonControls();
this.InitToolTipInfo();
ComponentResourceManager manager = new ComponentResourceManager(typeof(GroupConversationForm));
base.Icon = (Icon) manager.GetObject("$this.Icon");
ControlHelper.SetDoubleBuffered(this.pnlNav);
}
private void opEmotionDown_ImpsError(object sender, ImpsErrorEventArgs e)
{
try
{
AsyncBizOperation operation = sender as AsyncBizOperation;
OleKey contextForUi = operation.ContextForUi as OleKey;
Image loadingFailed = ImpsIcons.LoadingFailed;
this._historyChatManager.UpdateCustomEmotion(contextForUi, loadingFailed);
operation.Successed -= new EventHandler(this.opEmotionDown_Successed);
operation.ImpsError -= new EventHandler(this.opEmotionDown_ImpsError);
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void opEmotionDown_Successed(object sender, EventArgs e)
{
try
{
AsyncBizOperation operation = sender as AsyncBizOperation;
OleKey contextForUi = operation.ContextForUi as OleKey;
Imps.Client.Core.CustomEmotion.CustomEmotion contextForBiz = operation.ContextForBiz as Imps.Client.Core.CustomEmotion.CustomEmotion;
Image customEmotionImage = this.GetCustomEmotionImage(contextForBiz.Id);
if (customEmotionImage != null)
{
this._historyChatManager.UpdateCustomEmotion(contextForUi, customEmotionImage);
}
operation.Successed -= new EventHandler(this.opEmotionDown_Successed);
operation.ImpsError -= new EventHandler(this.opEmotionDown_ImpsError);
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void PersonalGroupManager_GroupDeleted(object sender, PersonalGroupEventArgs e)
{
try
{
if (e.PersonalGroup == this.Group)
{
this.lblGroupMembersInfo.Visible = false;
this._historyChatManager.AppentString(string.Format("{0}({1})已经被删除!", StringHelper.EncodString((string) e.PersonalGroup.GroupInfo.Name), e.PersonalGroup.GroupInfo.Id));
this._historyChatManager.AppendCRLF();
this._historyChatManager.ScrollToEnd();
this.pnlContainer.Enabled = false;
this.topControl.Disable();
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void PersonalGroupManager_GroupInfoChanged(object sender, PersonalGroupEventArgs e)
{
if (e.PersonalGroup == this._group)
{
this.InitGroupCaption();
}
}
private void PersonalGroupManager_GroupRemoved(object sender, PersonalGroupEventArgs e)
{
try
{
if (e.PersonalGroup == this.Group)
{
this.lblGroupMembersInfo.Visible = false;
if (((UserIdentity) e.PersonalGroup.UserInfo.GroupUserIdentity.Value) == UserIdentity.SuperManager)
{
this._historyChatManager.AppentString(string.Format("{0}({1})已经被删除!", StringHelper.EncodString((string) e.PersonalGroup.GroupInfo.Name), e.PersonalGroup.GroupInfo.Id));
this._historyChatManager.AppendCRLF();
this._historyChatManager.ScrollToEnd();
}
else
{
this._historyChatManager.AppentString(string.Format("您已经退出了群 {0}({1})!", StringHelper.EncodString((string) e.PersonalGroup.GroupInfo.Name), e.PersonalGroup.GroupInfo.Id));
this._historyChatManager.AppendCRLF();
this._historyChatManager.ScrollToEnd();
}
this.pnlContainer.Enabled = false;
this.topControl.Disable();
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void PersonalGroupManager_MeBeDeleted(object sender, PersonalGroupEventArgs e)
{
try
{
if (e.PersonalGroup == this.Group)
{
this._historyChatManager.AppentString(string.Format("您已经被{0}({1})的管理员或超级管理员移除!", StringHelper.EncodString((string) e.PersonalGroup.GroupInfo.Name), e.PersonalGroup.GroupInfo.Id));
this._historyChatManager.AppendCRLF();
this._historyChatManager.ScrollToEnd();
this.pnlContainer.Enabled = false;
this.topControl.Disable();
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void PersonalGroupManager_MemberDeleted(object sender, GroupMemberDeletedEventArgs e)
{
this.InitGroupMembersLable();
}
private void PersonalGroupManager_MemberDestroyed(object sender, MemberDestroyedEventArgs e)
{
UserIdentity local1 = e.Member.GroupMemeberInfo.GroupUserIdentity.Value;
this.InitToolTipInfo();
this.InitGroupMembersLable();
}
private void PersonalGroupManager_MemberExited(object sender, PersonalGroupMemberEventArgs e)
{
this.InitGroupMembersLable();
}
private void PersonalGroupManager_MemberJoined(object sender, PersonalGroupMemberEventArgs e)
{
this.InitGroupMembersLable();
}
private void PersonalGroupManager_MembersInfoChanged(object sender, GroupMembersInfoChangedEventArgs e)
{
this.InitGroupMembersLable();
}
private void RemoveConversationEvent()
{
try
{
if (this.CurrentDialog != null)
{
this.CurrentDialog.MessageRecieved -= new EventHandler(this.dialog_MessageRecieved);
this.CurrentDialog.SendMessageFailed -= new EventHandler(this.diallg_SendMessageFailed);
this.CurrentDialog.Closed -= new EventHandler(this.dialog_Closed);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void RemoveGlobalEvent()
{
this.CurrentUser.StatusChanged -= new EventHandler(this.CurrentUser_StatusChanged);
this.CurrentUser.Configuration.UserSetting.ConversationSetting.PropertiesChanged -= new EventHandler(this.ConversationSetting_PropertiesChanged);
this.CurrentUser.PersonalGroupManager.GroupDeleted -= new EventHandler(this.PersonalGroupManager_GroupDeleted);
this.CurrentUser.PersonalGroupManager.GroupRemoved -= new EventHandler(this.PersonalGroupManager_GroupRemoved);
this.CurrentUser.PersonalGroupManager.MeBeDeleted -= new EventHandler(this.PersonalGroupManager_MeBeDeleted);
this.CurrentUser.PersonalGroupManager.MemberDestroyed -= new EventHandler(this.PersonalGroupManager_MemberDestroyed);
this.CurrentUser.PersonalGroupManager.MembersInfoChanged -= new EventHandler(this.PersonalGroupManager_MembersInfoChanged);
this.CurrentUser.PersonalGroupManager.GroupInfoChanged -= new EventHandler(this.PersonalGroupManager_GroupInfoChanged);
this.CurrentUser.PersonalGroupManager.MemberDeleted -= new EventHandler(this.PersonalGroupManager_MemberDeleted);
this.CurrentUser.PersonalGroupManager.MemberExited -= new EventHandler(this.PersonalGroupManager_MemberExited);
this.CurrentUser.PersonalGroupManager.MemberJoined -= new EventHandler(this.PersonalGroupManager_MemberJoined);
}
private int richEdit_LinkClick(object sender, ChatEditClickEventArgs e)
{
try
{
if (e.EventType == ChatEditEventType.Link)
{
ConversationManagerImp.ExecuteFile(this, e.Text);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
return 1;
}
private void SaveWindowSetting()
{
try
{
Imps.Client.Core.ConversationSetting conversationSetting = this.CurrentUser.Configuration.UserSetting.ConversationSetting;
if (this._inputChatManager.SelectionFont != null)
{
conversationSetting.Font = this._inputChatManager.SelectionFont;
}
Color foreColor = this._inputChatManager.ForeColor;
conversationSetting.Color = this._inputChatManager.ForeColor;
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void SelectEmotion()
{
try
{
this.tsbEmoticons.Checked = true;
System.Drawing.Point point = this.tsSendMessage.PointToScreen(this.tsbEmoticons.Bounds.Location);
point.Y += this.tsbEmoticons.Bounds.Height;
this.workAreaRectangle = Screen.GetWorkingArea(this.workAreaRectangle);
if ((this.de == null) || this.de.IsDisposed)
{
this.InitDisplayEmoticon();
}
if ((point.X + this.de.Width) > this.workAreaRectangle.Width)
{
point.X = this.workAreaRectangle.Width - this.de.Width;
}
point.Y -= this.tsbEmoticons.Bounds.Height + this.de.Height;
this.de.Display(point.X, point.Y);
}
catch (Exception exception)
{
ClientLogger.WriteException(exception);
}
}
private void SelectFont()
{
try
{
this.fontDialog.Font = this._inputChatManager.SelectionFont;
this.fontDialog.Color = this._inputChatManager.ForeColor;
this.fontDialog.AllowVectorFonts = false;
this.fontDialog.AllowVerticalFonts = false;
this.fontDialog.MinSize = 6;
this.fontDialog.MaxSize = 0x80;
if (this.fontDialog.ShowDialog(this) == DialogResult.OK)
{
this._inputChatManager.SelectionFont = this.fontDialog.Font;
this._inputChatManager.ForeColor = this.fontDialog.Color;
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void SendMessage()
{
try
{
string hTML = this._inputChatManager.HTML;
if (!string.IsNullOrEmpty(hTML))
{
List ownerEmotions = this._inputChatManager.OwnerEmotions;
if ((this._inputChatManager.SystemEmotions.Count + ownerEmotions.Count) > 15)
{
this._frameworkWnd.UnifiedMessageBox.ShowInfo(this, "发送表情的数量不能超过15个!");
}
else
{
Imps.Client.Core.Message message;
if (ownerEmotions.Count > 0)
{
this.CurrentUser.CustomEmotionManager.AsyncUploadEmotionImages(ownerEmotions);
}
if ((this.CurrentConversation == null) || (this.CurrentConversation.CurrentDialog == null))
{
this.CurrentUser.PersonalGroupManager.AsyncStartGroupConversation(this._group);
}
if (this.topControl.SendSMS)
{
if (this._smsOperation == null)
{
this._smsOperation = new AsyncBizOperation();
this._smsOperation.ImpsError += new EventHandler(this._smsOperation_ImpsError);
}
message = this.CurrentConversation.CurrentDialog.AsyncSendSms(hTML, this._smsOperation);
}
else
{
if (hTML.Length >= this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.MaxLengthOneMessageWithHtmlTag)
{
hTML = this._inputChatManager.GetHtmlWithTags(new string[] { "OBJECT" });
if (hTML.Length >= this.CurrentUser.Configuration.SystemSetting.SysConversationSetting.MaxLengthOneMessageWithHtmlTag)
{
hTML = ConvertString(this._inputChatManager.Text);
}
}
message = this.CurrentConversation.CurrentDialog.AsyncSendIm(hTML);
}
this._inputChatManager.Text = "";
this.AppendMessage(message);
this._inputChatManager.Focus();
}
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void This_ActivatedOrShown(object sender, EventArgs e)
{
this._inputChatManager.Focus();
}
private void Timer_UpdateEmotion_Tick(object sender, EventArgs e)
{
this._historyChatManager.UpdateImage();
this._inputChatManager.UpdateImage();
}
private void topControl_SendSMSChanged(object sender, EventArgs e)
{
this.FormatSMSOrMessageDisplay();
}
private void tsbEmoticons_Click(object sender, EventArgs e)
{
this.SelectEmotion();
}
private void tsFont_Click(object sender, EventArgs e)
{
this.SelectFont();
}
private void tsHistoryAddToCustomEmotion_Click(object sender, EventArgs e)
{
try
{
Imps.Client.Core.CustomEmotion.CustomEmotion selectedObject = this._historyChatManager.SelectedObject as Imps.Client.Core.CustomEmotion.CustomEmotion;
if (selectedObject != null)
{
string receivedCustomEmotionImagePath = this.CurrentUser.CustomEmotionManager.GetReceivedCustomEmotionImagePath(selectedObject.Id);
if (!File.Exists(receivedCustomEmotionImagePath))
{
receivedCustomEmotionImagePath = this.CurrentUser.CustomEmotionManager.GetOwnerEmotionImagePath(selectedObject.Id);
if (!File.Exists(receivedCustomEmotionImagePath))
{
receivedCustomEmotionImagePath = string.Empty;
}
}
this._frameworkWnd.ConversationManager.AddToOwnerEmotion(this, selectedObject.ShortCut, selectedObject.Name, receivedCustomEmotionImagePath);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void tsHistoryChatCopy_Click(object sender, EventArgs e)
{
this._historyChatManager.DoCopy();
}
private void tsHistoryChatSelectAll_Click(object sender, EventArgs e)
{
this.rtfHistory.SelectAll();
}
private void tsHistorySaveAsImage_Click(object sender, EventArgs e)
{
try
{
Imps.Client.Core.CustomEmotion.CustomEmotion selectedObject = this._historyChatManager.SelectedObject as Imps.Client.Core.CustomEmotion.CustomEmotion;
if (selectedObject != null)
{
Image customEmotionImage = this.GetCustomEmotionImage(selectedObject.Id);
if (customEmotionImage != null)
{
this.saveFileDialog.InitialDirectory = Environment.SpecialFolder.Personal.ToString();
string formatDescription = "jpg";
try
{
formatDescription = ImageHelper.GetImageCodecInfo(customEmotionImage.RawFormat).FormatDescription;
}
catch (Exception)
{
}
this.saveFileDialog.Filter = string.Format("*.{0}|*.{0}", formatDescription);
if (!string.IsNullOrEmpty(selectedObject.ShortCut))
{
this.saveFileDialog.FileName = selectedObject.ShortCut;
}
if (this.saveFileDialog.ShowDialog(this) == DialogResult.OK)
{
customEmotionImage.Save(this.saveFileDialog.FileName);
}
}
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private void tsInputChangeFont_Click(object sender, EventArgs e)
{
this.SelectFont();
}
private void tsInputChatCopy_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this._inputChatManager.DoCopy();
}
else
{
this._historyChatManager.DoCopy();
}
}
private void tsInputChatCut_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this._inputChatManager.DoCut();
}
}
private void tsInputChatDelete_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this.rtfInput.SelectedText = "";
}
}
private void tsInputChatPaste_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this._inputChatManager.DoPaste();
}
}
private void tsInputChatSelectALl_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this.rtfInput.SelectAll();
}
else
{
this.rtfHistory.SelectAll();
}
}
private void tsInputChatUndo_Click(object sender, EventArgs e)
{
if (this.rtfInput.Focused)
{
this._inputChatManager.DoUndo();
}
}
private void tsSendCtrlEnter_Click(object sender, EventArgs e)
{
ProposedData data = new ProposedData(this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey.OriginalValue);
data.Value = false;
this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey = data;
}
private void tsSendEnter_Click(object sender, EventArgs e)
{
ProposedData data = new ProposedData(this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey.OriginalValue);
data.Value = true;
this.CurrentUser.Configuration.UserSetting.ConversationSetting.SendMessageByEnterKey = data;
}
public bool BeActivated
{
get
{
return this._activated;
}
set
{
this._activated = value;
}
}
private Imps.Client.Core.Conversation CurrentConversation
{
get
{
return this._group.GroupConversation;
}
}
private PersonalGroupDialog CurrentDialog
{
get
{
if ((this.CurrentConversation != null) && (this.CurrentConversation.Dialogs.Count != 0))
{
return (this.CurrentConversation.Dialogs[0] as PersonalGroupDialog);
}
return null;
}
}
private Imps.Client.Core.User CurrentUser
{
get
{
return this._frameworkWnd.AccountManager.CurrentUser;
}
}
public PersonalGroup Group
{
get
{
return this._group;
}
set
{
this._group = value;
}
}
public bool SendSMS
{
get
{
return this.topControl.SendSMS;
}
set
{
this.topControl.SendSMS = value;
}
}
}
}