📄 conversationwindow.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.Controls;
using Imps.Client.Pc.Properties;
using Imps.Client.Pc.WndlessControls;
using Imps.Client.Resource;
using Imps.Client.Utils;
using Imps.Client.Utils.Win32;
using Imps.Common;
using Imps.Utils;
using Imps.Utils.TagParser;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.IO;
using System.Media;
using System.Runtime.InteropServices;
using System.Text.RegularExpressions;
using System.Threading;
using System.Windows.Forms;
using System.Xml;
public class ConversationWindow : XConversationForm
{
private bool _activated;
private buddylist_drawer<string> _buddy_list_drawer;
private Imps.Client.Core.Conversation _curConversation;
private int _decimalCount;
private Size _defaultEmotionSize = ImpsEmoticons.EmoticonSize;
private Dictionary<OleKey, OleKey> _dicLinkButtonSaveHistory;
private Dictionary<OleKey, ShareContent> _dicLinkButtonShareContent;
private Dictionary<string, Image> _dicMd5Images;
private Dictionary<OleKey, ShareContent> _dicShareContent;
private WndlessFolder _folderNavigator;
private IFrameworkWindow _frameworkWnd;
private List<Imps.Client.Core.Contact> _hasEventContacts;
private ChatEditCtrlManager _historyChatManager;
private ChatEditCtrlManager _inputChatManager;
private bool _isSendMessage;
private DateTime? _lastSendNudgeTime;
private listbox_widget_t<buddylistbox_item<string>> _lstContacts;
private ConversationManagerImp _manager;
private Size _messageEmotionSize = ImpsEmoticons.EmoticonSize;
private string _moibleNo;
private string _myUri;
private AsyncBizOperation _op;
private int _richIdentity = 12;
private WndlessScorePictureBox _scoreBox;
private Image _separate = ImpsResources.GetImage("Images.line.png");
private Size _smallSize = new Size(0x13, 0x13);
private AsyncBizOperation _smsOperation;
private object _syncObjTempImageFile;
private string _uri;
private SendMessageButton btnSend;
private IContainer components;
private ToolTip contactToolTip = new ToolTip();
private DisplayEmoticons de;
private FontDialog fontDialog;
private bool hasShowMoreMessage;
private bool isExpanded = true;
private HtmlLabel lblSMSSendInfo;
private XConversationTip lblTooltip;
private menu_widget mainMenuHelp;
private menu_widget mainMenuOperate;
private menu_widget mainMenuTools;
private menu_widget menuBlockUsers;
private menu_widget menuCaptureScreen;
private menu_widget menuContctOperate;
private menu_widget menuHistoryChat;
private menu_widget menuInputChat;
private menu_widget menuSendFile;
private ToolStripMenuItem menuSendFileDirect;
private ToolStripMenuItem menuSendFileToMobile;
private menu_widget menuSendType;
private ToolStripMenuItem miEdit;
private ToolStripMenuItem miHelp;
private ToolStripMenuItem miOperate;
private ToolStripMenuItem miTools;
private ToolTip myToolTip = new ToolTip();
private OpenFileDialog openFileDialog;
private Panel panel1;
private ContactInfoControl picContact;
private WndlessPortrait picOwner;
private PictureBox picSendTypeImage;
private Panel pnlCenter;
private Panel pnlContainer;
private Panel pnlForWhiteBackground;
private Panel pnlImageOwner;
private Panel pnlNav;
private Panel pnlRight;
private int pnlRightWidth = 0x76;
private Panel pnlSendTypeImage;
private Panel pnlTop;
private ChatRichTextBox rtfHistory;
private ChatRichTextBox rtfInput;
private SaveFileDialog saveFileDialog;
private const string SaveHistoryAgree = "SaveHistoryAgree";
private const string SaveHistoryRefuse = "SaveHistoryRefuse";
private IMSplitContainer scMain;
private int splitContainerPadding;
private string tipInfo;
private ToolStripMenuItem toolStripMenuItem1;
private ToolStripSeparator toolStripSeparator1;
private ToolStripSeparator toolStripSeparator10;
private ToolStripSeparator toolStripSeparator11;
private ToolStripSeparator toolStripSeparator2;
private ToolStripSeparator toolStripSeparator3;
private ToolStripSeparator toolStripSeparator4;
private ToolStripSeparator toolStripSeparator5;
private ToolStripSeparator toolStripSeparator6;
private ToolStripSeparator toolStripSeparator7;
private ToolStripSeparator toolStripSeparator8;
private ToolStripSeparator toolStripSeparator9;
private ToolStripMenuItem tsAddToFriend;
private ToolStripButton tsbEmoticons;
private ToolStripDropDownButton tsBlock;
private ToolStripMenuItem tsBlockContact;
private ToolStripSplitButton tsCaptureScreen;
private ToolStripMenuItem tsCaptureScreenDirect;
private ToolStripMenuItem tsCaptureScreenMinForm;
private ToolStripButton tsFont;
private ToolStripDropDownButton tsHistory;
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 ToolStripButton tsInvite;
private ToolStripMenuItem tsInviteContactOpenFetion;
private ToolStripSeparator tsInviteOperater;
private ToolStripButton tsIVR;
private IMToolstrip tsMain;
private ToolStripMenuItem tsMainHelpAbout;
private ToolStripMenuItem tsMainHelpTopic;
private ToolStripMenuItem tsOpenMobileToContact;
private ToolStripMenuItem tsOperationBlock;
private ToolStripMenuItem tsOperationClose;
private ToolStripMenuItem tsOperationContactInfo;
private ToolStripMenuItem tsOperationInvite;
private ToolStripMenuItem tsOperationIVR;
private ToolStripMenuItem tsOperationMessageHistory;
private ToolStripMenuItem tsOperationSendFile;
private menu_radioitem tsOperationSendMessage;
private menu_radioitem tsOperationSendSMS;
private ToolStripMenuItem tsSaveContactPortrait;
private ToolStripMenuItem tsSendCtrlEnter;
private ToolStripMenuItem tsSendEnter;
private ToolStripSplitButton tsSendFile;
private IMToolstrip tsSendMessage;
private ToolStripButton tsSendNudge;
private ToolStripButton tsSendSMS;
private ToolStripMenuItem tsStartTwoConversation;
private ToolStripMenuItem tsToolsFront;
private ToolStripMenuItem tsToolsOptions;
private ToolStripMenuItem tsUserContactPortrait;
private ToolStripMenuItem tsViewContactDetail;
private Rectangle workAreaRectangle;
public ConversationWindow(ConversationManagerImp manager, Imps.Client.Core.Conversation conv)
{
this.InitializeComponent();
base.SupportCationLink = true;
this._manager = manager;
this._curConversation = conv;
this.InitPicOwner();
this.InitFields(this._manager);
this.InitChatControl();
this.InitNavigatorControl();
base.initComponentRegion();
}
private void _curConversation_Closed(object sender, EventArgs e)
{
if ((sender as Imps.Client.Core.Conversation) == this._curConversation)
{
this.CloseCurrentConversation();
}
}
private void _dialog_StatusChange_Nudge(object sender, DialogStatusChangeEventArgs e)
{
try
{
if ((sender as Dialog).Status != DialogStatus.Inviting)
{
this.CurrentConversation.CurrentDialog.StatusChange -= new EventHandler<DialogStatusChangeEventArgs>(this, (IntPtr) this._dialog_StatusChange_Nudge);
this.SendNudge();
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
}
private int _historyChatManager_BeforeContextMenuShow(object sender, ChatEditEventArgs e)
{
try
{
this._historyChatManager.Focus();
this.tsHistoryChatSelectAll.set_Enabled(this.rtfHistory.Text != string.Empty);
this.tsHistoryChatCopy.set_Enabled(this._historyChatManager.CanCopy);
this.tsHistorySeparator.set_Visible(false);
this.tsHistorySaveAsImage.set_Visible(false);
this.tsHistoryAddToCustomEmotion.set_Visible(false);
if (e.EventType == ChatEditEventType.CustomEmotion)
{
if (!(e.Context is Imps.Client.Core.CustomEmotion.CustomEmotion))
{
return 1;
}
this.tsHistorySeparator.set_Visible(true);
this.tsHistorySaveAsImage.set_Visible(true);
this.tsHistoryAddToCustomEmotion.set_Visible(true);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
return 1;
}
private int _historyChatManager_DoubleClick(object sender, ChatEditClickEventArgs e)
{
try
{
if (e.EventType == ChatEditEventType.PROGRESSBAR)
{
this.ProgressbarDoubleClick(e.Key);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
return 1;
}
private int _historyChatManager_DragDrop(object sender, ChatEditDropEventArgs e)
{
if ((e.EventType == ChatEditDropType.Contact) && (e.Contact != null))
{
this.TryAddContact(e.Contact);
}
return 1;
}
private int _inputChatManager_BeforeContextMenuShow(object sender, ChatEditEventArgs e)
{
if (this.rtfInput.RectangleToScreen(this.rtfInput.ClientRectangle).Contains(Control.MousePosition))
{
this._inputChatManager.Focus();
this.InitEditMenu();
}
return 1;
}
private int _inputChatManager_DoubleClick(object sender, ChatEditClickEventArgs e)
{
try
{
if (e.EventType == ChatEditEventType.PROGRESSBAR)
{
this.ProgressbarDoubleClick(e.Key);
}
}
catch (Exception exception)
{
this.HandleException(exception);
}
return 1;
}
private int _inputChatManager_DragDrop(object sender, ChatEditDropEventArgs e)
{
try
{
if (e.EventType == ChatEditDropType.FILE)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -