Пример #1
0
        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);
        }
Пример #2
0
        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);
        }