⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 groupconversationform.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
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<string, Image> _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.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 _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.get_Checked() && (e.KeyCode == Keys.Return)) && !e.Control) || ((this.tsSendCtrlEnter.get_Checked() && e.Control) && (e.KeyCode == Keys.Return)))
                {
                    e.set_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<MessageEventArgs>(this, (IntPtr) this.dialog_MessageRecieved);
                    this.CurrentDialog.SendMessageFailed += new EventHandler<MessageSendFailedEventArgs>(this, (IntPtr) 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<UserSatusChangedEventArgs>(this, (IntPtr) this.CurrentUser_StatusChanged);
            this.CurrentUser.Configuration.UserSetting.ConversationSetting.PropertiesChanged += new EventHandler<PropertiesChangedEventArgs>(this, (IntPtr) this.ConversationSetting_PropertiesChanged);
            this.CurrentUser.PersonalGroupManager.GroupDeleted += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_GroupDeleted);
            this.CurrentUser.PersonalGroupManager.GroupRemoved += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_GroupRemoved);
            this.CurrentUser.PersonalGroupManager.MeBeDeleted += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_MeBeDeleted);
            this.CurrentUser.PersonalGroupManager.MemberDestroyed += new EventHandler<MemberDestroyedEventArgs>(this, (IntPtr) this.PersonalGroupManager_MemberDestroyed);
            this.CurrentUser.PersonalGroupManager.MembersInfoChanged += new EventHandler<GroupMembersInfoChangedEventArgs>(this, (IntPtr) this.PersonalGroupManager_MembersInfoChanged);
            this.CurrentUser.PersonalGroupManager.GroupInfoChanged += new EventHandler<PersonalGroupEventArgs>(this, (IntPtr) this.PersonalGroupManager_GroupInfoChanged);
            this.CurrentUser.PersonalGroupManager.MemberDeleted += new EventHandler<GroupMemberDeletedEventArgs>(this, (IntPtr) this.PersonalGroupManager_MemberDeleted);
            this.CurrentUser.PersonalGroupManager.MemberExited += new EventHandler<PersonalGroupMemberEventArgs>(this, (IntPtr) this.PersonalGroupManager_MemberExited);
            this.CurrentUser.PersonalGroupManager.MemberJoined += new EventHandler<PersonalGroupMemberEventArgs>(this, (IntPtr) 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 text = string.Empty;
                if (!string.IsNullOrEmpty(msg.FromSid))
                {
                    text = string.Format(" ({0})", msg.FromSid);
                }
                this._historyChatManager.AppentString(string.Format(StringTable.Conversation.MsgSendIMFormat, ConvertString(msg.From) + text), 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);
                }
            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -