messagehistoryfrom.cs

来自「破解的飞信源代码」· CS 代码 · 共 1,211 行 · 第 1/5 页

CS
1,211
字号
namespace Imps.Client.Pc.MessageHistory2
{
    using Imps.Client;
    using Imps.Client.Core;
    using Imps.Client.Core.History;
    using Imps.Client.Pc;
    using Imps.Client.Pc.BizControls;
    using Imps.Client.Pc.Controls;
    using Imps.Client.Resource;
    using Imps.Client.Utils;
    using Imps.Utils;
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class MessageHistoryFrom : XIMChatHistory
    {
        private IList<Player> _chatFriendCollection;
        private int _currentPage;
        private string _currentPlayerUri;
        private IFrameworkWindow _framework;
        private static bool _hiddeDetail;
        private IHistoryManager _messageManager;
        private int _msgCount;
        private TreeNode _newSelectNode;
        private ChatEditCtrlManager _rtfManager;
        private DataGridViewTextBoxColumn Body;
        private UButton btnDelete;
        private UButton btnHiddeDetail;
        private UButton btnRefresh;
        private UButton btnSearch;
        private ContextMenuStrip cmCopy;
        private ContextMenuStrip cmTree;
        private IContainer components;
        private DataGridViewTextBoxColumn DateString;
        private DataGridView dvMessageView;
        private ImageList imageList;
        private Label label1;
        private Label lDateTime;
        private LinkLabel llFirst;
        private LinkLabel llLast;
        private LinkLabel llNext;
        private LinkLabel llPrevious;
        private HtmlLabel lMessageInfo;
        private Label lPlayer;
        private Label lReceivers;
        private ToolStripMenuItem miCopy;
        private ToolStripMenuItem miDelete;
        private ToolStripMenuItem miOpen;
        private ToolStripMenuItem miOperation;
        private ToolStripMenuItem miRefresh;
        private ToolStripSeparator miSplit;
        private DataGridViewTextBoxColumn MobileNo;
        private DataGridViewImageColumn MsgType;
        private UPanel operatePanel;
        private PictureBox pictureBox;
        private PictureBox pictureBox1;
        private TreeView playerNavigation;
        private UPanel pMessage;
        private UPanel pMessageView;
        private UPanel pPlayerNavigation;
        private Panel pProgress;
        private ProgressBar progressBar1;
        private DataGridViewTextBoxColumn Receiver;
        private DataGridViewTextBoxColumn Sender;
        private BindingSource sourceManager;
        private SplitContainer splitContainer;
        private ChatRichTextBox tbMessage;
        private BListControlToolbar tbSearchString;

        public MessageHistoryFrom(IFrameworkWindow framework) : this(framework, string.Empty)
        {
        }

        public MessageHistoryFrom(IFrameworkWindow framework, string playerUri)
        {
            this.InitializeComponent();
            this.tbSearchString.SearchTextBox.EmptyTextTip = StringTable.MessageHistory.MsgHistorySearchTip;
            base.HemlineStyle = HemlineStyle.None;
            this.InitializeContext(framework);
            this.AutoComponentSize();
            this.InitializePlayerList();
            this.ShowMessage(playerUri);
            this.CurrentUser.ContactList.ContactTypeChanged += new EventHandler<ContactTypeChangedEventArgs>(this, (IntPtr) this.ContactList_ContactTypeChanged);
            this._framework.MessageHistoryManager.HistoryDeleted += new EventHandler(this.MessageHistoryManager_HistoryDeleted);
        }

        private int _rtfManager_LinkClick(object sender, ChatEditClickEventArgs e)
        {
            if (e.EventType == ChatEditEventType.Link)
            {
                try
                {
                    string url = e.Text;
                    TreeNode selectedNode = this.playerNavigation.SelectedNode;
                    if (((selectedNode != null) && (selectedNode.Tag is Player)) && ConversationManagerImp.IsShareContentUrl(this.CurrentUser, (selectedNode.Tag as Player).Uri, url))
                    {
                        url = url + "&c=" + HttpWebRequestHelper.UrlEncode(this.CurrentUser.SsiCredential);
                    }
                    ConversationManagerImp.ExecuteFile(this, url);
                }
                catch (Exception exception)
                {
                    ClientLogger.WriteException(exception);
                }
            }
            return 1;
        }

        private void AddPlayer(TreeNode parent, List<Imps.Client.Core.Contact> playerList)
        {
            try
            {
                playerList.Sort(ContactComparer.Instance);
                List<Imps.Client.Core.Contact>.Enumerator enumerator = playerList.GetEnumerator();
                try
                {
                    while (enumerator.MoveNext())
                    {
                        Imps.Client.Core.Contact contact = enumerator.get_Current();
                        Player player = new Player(contact.Uri.Raw, contact.DisplayName, PlayerType.Contact);
                        TreeNode node = new TreeNode(contact.DisplayName);
                        node.Tag = player;
                        parent.Nodes.Add(node);
                        if (this._chatFriendCollection.Contains(player))
                        {
                            this._chatFriendCollection.Remove(player);
                        }
                        if (contact.Uri.Raw == this._currentPlayerUri)
                        {
                            node.Parent.Expand();
                            this.playerNavigation.SelectedNode = node;
                            node.Checked = true;
                            if (parent.Parent != null)
                            {
                                node.Parent.set_ImageKey("OpenfolderHS");
                                node.Parent.set_SelectedImageKey("OpenfolderHS");
                            }
                        }
                        if (contact.PersonalInfo.Portrait != null)
                        {
                            this.imageList.Images.Add(contact.Uri.Raw, contact.PersonalInfo.Portrait);
                            node.set_ImageKey(contact.Uri.Raw);
                            node.set_SelectedImageKey(contact.Uri.Raw);
                        }
                        else
                        {
                            node.set_ImageKey("Player");
                            node.set_SelectedImageKey("Player");
                        }
                    }
                }
                finally
                {
                    enumerator.Dispose();
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void AddPlayer(TreeNode parent, IList<Player> playerList, PlayerType playerType)
        {
            try
            {
                if (playerList is List<Player>)
                {
                    ((List<Player>) playerList).Sort(PlayerComparer.Instance);
                }
                using (IEnumerator<Player> enumerator = playerList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        Player player = enumerator.get_Current();
                        if (player.Type != playerType)
                        {
                            continue;
                        }
                        TreeNode node = new TreeNode(player.Name);
                        node.Tag = player;
                        switch (playerType)
                        {
                            case PlayerType.Contact:
                                node.set_ImageKey("Player");
                                node.set_SelectedImageKey("Player");
                                break;

                            case PlayerType.Group:
                                node.set_ImageKey("Group");
                                node.set_SelectedImageKey("Group");
                                goto Label_0087;
                        }
                    Label_0087:
                        parent.Nodes.Add(node);
                        if (player.Uri == this._currentPlayerUri)
                        {
                            node.Parent.Expand();
                            this.playerNavigation.SelectedNode = node;
                            node.Checked = true;
                            if (parent.Parent != null)
                            {
                                node.Parent.set_ImageKey("OpenfolderHS");
                                node.Parent.set_SelectedImageKey("OpenfolderHS");
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                ClientLogger.WriteException(exception);
            }
        }

        private void AutoComponentSize()
        {
            this.splitContainer.get_Panel1().SuspendLayout();
            this.splitContainer.get_Panel2().SuspendLayout();
            this.splitContainer.SuspendLayout();
            this.pPlayerNavigation.SuspendLayout();
            this.pMessage.SuspendLayout();
            this.pMessageView.SuspendLayout();
            this.operatePanel.SuspendLayout();
            this.pProgress.SuspendLayout();
            base.SuspendLayout();
            this.pPlayerNavigation.Location = new System.Drawing.Point(3, 3);
            this.pPlayerNavigation.Size = new Size(this.splitContainer.get_Panel1().get_Width() - 6, this.splitContainer.get_Panel1().get_Height() - 6);
            this.playerNavigation.Location = new System.Drawing.Point(1, 1);
            this.playerNavigation.Size = new Size(this.pPlayerNavigation.Width - 2, this.pPlayerNavigation.Height - 2);
            int num = this.splitContainer.get_Panel2().get_Width();
            this.splitContainer.get_Panel2().get_Height();
            this.operatePanel.Location = new System.Drawing.Point(3, 3);
            this.operatePanel.Size = new Size(num - 6, 0x36);
            this.lMessageInfo.Location = new System.Drawing.Point(3, 60);
            this.llLast.Location = new System.Drawing.Point(num - 0x22, 60);
            this.llNext.Location = new System.Drawing.Point((this.llLast.Location.X - 0x2b) - 6, this.llLast.Location.Y);
            this.llPrevious.Location = new System.Drawing.Point((this.llNext.Location.X - 0x2b) - 6, this.llLast.Location.Y);
            this.llFirst.Location = new System.Drawing.Point((this.llPrevious.Location.X - 0x22) - 6, this.llLast.Location.Y);
            this.AutoMessageListSize();

⌨️ 快捷键说明

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