コード例 #1
0
        public void AddUser(User user)
        {
            if (_activeUsers.Contains(user))
                return;

            // YOUR CODE GOES HERE (Add connections)

            _activeUsers.Add(user);
        }
コード例 #2
0
        public void RemoveUser(User user)
        {
            if (!_activeUsers.Contains(user))
                return;

            // YOUR CODE GOES HERE (Delete connections)

            _activeUsers.Remove(user);
        }
コード例 #3
0
 public ChatWindow(ChatManager chatManager, User user)
 {
     InitializeComponent();
     _chatManager = chatManager;
     _user = user;
     
     // YOUR CODE GOES HERE 
     
     this.Title = _user.Username;
 }
コード例 #4
0
 private void PlaceChildWindows()
 {
     var left = (System.Windows.SystemParameters.PrimaryScreenWidth - ChatWindowWidth * userNames.Length) / 2;
     var top = (System.Windows.SystemParameters.PrimaryScreenHeight - ChatWindowHeight - MainWindowHeight) / 2;
     for (int i = 0; i < userNames.Length; i++)
     {
         var user = new User(userNames[i]);
         var userWindow = new ChatWindow(_chatManager, user);
         userWindow.Left = left + i * ChatWindowWidth;
         userWindow.Width = ChatWindowWidth;
         userWindow.Height = ChatWindowHeight;
         userWindow.Top = top;
         userWindow.Show();
     }
     this.Top = top + ChatWindowHeight;
     this.Left = left;
     this.Width = userNames.Length * ChatWindowWidth;
     this.Height = MainWindowHeight;
 }