コード例 #1
0
        // In AwakeFromNib a lot of setup is done for the server. The first sections cover the setup for the list
        // of chats and the list of clients. It creates a new DataSource that holds all necessary information
        // for the list (holding a list of items and providing the amount of rows). After that, a delegate is
        // instantiated, containing some logic behind the lists.
        // After this, a message is added that no messages are present yet. The same is done for the clients.
        // The default buffer size value is also inserted into the input field.
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            _chatListDataSource = new ChatListDataSource();
            ChatList.DataSource = _chatListDataSource;
            ChatList.Delegate   = new ChatListDelegate(_chatListDataSource);

            _clientListDataSource = new ClientListDataSource();
            ClientList.DataSource = _clientListDataSource;
            ClientList.Delegate   = new ClientListDelegate(_clientListDataSource);

            var noMessages = new Message(
                MessageType.Info,
                "System",
                "No messages yet",
                DateTime.Now);

            var noClients = "No clients yet";

            UI.AddMessage(noMessages, _chatListDataSource, ChatList);
            AddClient(noClients);

            EnteredBufferSize.StringValue  = "1024";
            UpdateBufferSizeButton.Enabled = false;
        }
コード例 #2
0
 public ClientListDelegate(ClientListDataSource dataSource)
 {
     _dataSource = dataSource;
 }