示例#1
0
        public const string GROUP_NUM = "18";                       // Authors group number.

        //Methods
        /// <summary>
        /// Initiates all ChatRoom Components and reads SystemFiles/Users.bin to get Registered users list.
        /// </summary>
        /// <returns>String that represents the status of the initation.</returns>
        public static string Initiate()
        {
            _logger = new EventLogger();
            _logger.Initiate();
            _registeredUsers = new List <User>();
            _userHandler     = new UserHandler();
            try
            {
                _messages = new MessageFrame();
            }
            catch (Exception e)
            {
                _logger.log(3, "Failed to load message frame module");
            }
            try
            {
                _registeredUsers = _userHandler.Read();
                if (_registeredUsers.Count == 0)
                {
                    return(System.String.Empty);
                }
            }
            catch (Exception e)
            {
                _logger.log(3, "Failed to load registered users list located: SystemFiles\\Users.bin\r\n" + e.Message);
            }
            _logger.log(1, "Chat-Room Client loaded successfully.");
            _logger.log(1, "Successfully loaded registered users list located: SystemFiles\\Users.bin");
            return(null);
        }