Esempio n. 1
0
        /// <summary>
        /// Disconnects from the channel.  The result of the attempt will be returned in a Disconnected event.
        /// </summary>
        /// <returns>Whether or not the disconnect attempt was valid.</returns>
        public virtual bool Disconnect()
        {
            if (m_ChatState == ChatState.Connected ||
                m_ChatState == ChatState.Connecting)
            {
                ErrorCode ret = m_Chat.Disconnect();
                if (Error.Failed(ret))
                {
                    string err = Error.GetString(ret);
                    ReportError(string.Format("Error disconnecting: {0}", err));
                }

                FireDisconnected();
            }
            else if (m_ChatState == ChatState.Disconnected)
            {
                FireDisconnected();
            }
            else
            {
                return(false);
            }

            return(Shutdown());
        }