public ChatMessageView(BitChat chat, ChatListItem chatItem) { InitializeComponent(); _chat = chat; _chatItem = chatItem; _chat.MessageReceived += _chat_MessageReceived; _chat.PeerAdded += _chat_PeerAdded; _chat.PeerTyping += _chat_PeerTyping; _chat.PeerHasRevokedCertificate += _chat_PeerHasRevokedCertificate; _chat.PeerSecureChannelException += _chat_PeerSecureChannelException; if (_chat.NetworkType == BitChatClient.Network.BitChatNetworkType.PrivateChat) { if (_chat.NetworkName == null) this.Title = _chat.PeerEmailAddress.Address; else this.Title = _chat.NetworkName + " <" + _chat.PeerEmailAddress.Address + ">"; } else { this.Title = _chat.NetworkName; } }
public BitChatPanel(BitChat chat, ChatListItem chatItem) { InitializeComponent(); _chat = chat; _chat.FileAdded += _chat_FileAdded; _chat.PeerAdded += _chat_PeerAdded; _chat.MessageReceived += _chat_MessageReceived; //create view _view = new ChatMessageView(_chat, chatItem); _view.Dock = DockStyle.Fill; _view.AllowDrop = true; _view.SettingsModified += _view_SettingsModified; _view.DragEnter += lstFiles_DragEnter; _view.DragDrop += lstFiles_DragDrop; //load all peers foreach (BitChat.Peer peer in _chat.GetPeerList()) { lstUsers.AddItem(new UserListItem(peer)); peer.StateChanged += _view.peer_StateChanged; peer.StateChanged += peer_StateChanged; } //load all files foreach (SharedFile sharedFile in _chat.GetSharedFileList()) _chat_FileAdded(chat, sharedFile); //add view to panel bitChatPanelSplitContainer.Panel1.Controls.Add(_view); }
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 { } } }
public BitChatPanel(BitChat chat, ChatListItem chatItem) { InitializeComponent(); _chat = chat; _chat.PeerAdded += chat_PeerAdded; _chat.FileAdded += chat_FileAdded; _chat.MessageReceived += chat_MessageReceived; //create view _view = new ChatMessageView(_chat, chatItem); _view.Dock = DockStyle.Fill; _view.AllowDrop = true; _view.SettingsModified += view_SettingsModified; _view.ShareFile += view_ShareFile; _view.DragEnter += lstFiles_DragEnter; _view.DragDrop += lstFiles_DragDrop; //load all peers foreach (BitChat.Peer peer in _chat.GetPeerList()) { lstUsers.AddItem(new UserListItem(peer)); peer.StateChanged += peer_StateChanged; } //load all files foreach (SharedFile sharedFile in _chat.GetSharedFileList()) { chat_FileAdded(chat.SelfPeer, null, sharedFile); } //add view to panel bitChatPanelSplitContainer.Panel1.Controls.Add(_view); }
private void AddChatView(BitChat chat) { string title; if (chat.NetworkType == BitChatClient.Network.BitChatNetworkType.PrivateChat) { if (chat.NetworkName == null) title = chat.PeerEmailAddress.Address; else title = chat.NetworkName; } else { title = chat.NetworkName; } ChatListItem itm = new ChatListItem(title); BitChatPanel chatPanel = new BitChatPanel(chat, itm); chatPanel.Dock = DockStyle.Fill; chatPanel.SettingsModified += chatPanel_SettingsModified; chatPanel.MessageNotification += chatPanel_MessageNotification; mainContainer.Panel2.Controls.Add(chatPanel); itm.Tag = chatPanel; lstChats.AddItem(itm); if (lstChats.Controls.Count == 1) ShowSelectedChatView(); }