public ChatMessageView(BitChat chat, ChatListItem chatItem)
        {
            InitializeComponent();

            _chat     = chat;
            _chatItem = chatItem;

            _chat.MessageReceived             += chat_MessageReceived;
            _chat.MessageDeliveryNotification += chat_MessageDeliveryNotification;
            _chat.FileAdded  += chat_FileAdded;
            _chat.PeerAdded  += chat_PeerAdded;
            _chat.PeerTyping += chat_PeerTyping;
            _chat.PeerHasRevokedCertificate  += chat_PeerHasRevokedCertificate;
            _chat.PeerSecureChannelException += chat_PeerSecureChannelException;
            _chat.PeerHasChangedCertificate  += chat_PeerHasChangedCertificate;

            this.Title = _chat.NetworkDisplayTitle;

            if (_chat.NetworkType == BitChatCore.Network.BitChatNetworkType.GroupChat)
            {
                _chat.GroupImageChanged += chat_GroupImageChanged;
            }

            //load stored messages
            int totalMessageCount = _chat.GetMessageCount();

            if (totalMessageCount > 0)
            {
                try
                {
                    customListView1.ReplaceItems(ConvertToListViewItems(_chat.GetLastMessages(totalMessageCount, MESSAGE_COUNT_PER_SCROLL), true));
                    customListView1.ScrollToBottom();
                }
                catch
                { }
            }
        }