Пример #1
0
        private void OnServerLoggedIn(LoginResult result)
        {
            //Login failed
            if (!result.Result)
            {
                string faultMessage = this.Name + ": user name or password doesn't match";

                if (m_WebSocket != null)
                {
                    m_WebSocket.Closed -= m_WebSocket_Closed;
                    m_WebSocket.Closed += (s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send<IEnumerable<InstanceViewModel>>(null);
                    };
                    m_WebSocket.Close();
                }
                
                Messenger.Default.Send<AlertMessage>(new AlertMessage(faultMessage));
                return;
            }

            State = ConnectionState.Connected;
            OnServerUpdated(result.ServerInfo);
        }
Пример #2
0
        private void OnServerLoggedIn(LoginResult result)
        {
            //Login failed
            if (!result.Result)
            {
                string faultMessage = this.Name + ": user name or password doesn't match";

                if (m_WebSocket != null)
                {
                    m_WebSocket.Closed -= m_WebSocket_Closed;
#if SILVERLIGHT
                    m_WebSocket.Closed += new EventHandler(CreateAsyncOperation<object, EventArgs>((s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send<IEnumerable<InstanceViewModel>>(null);
                    }));
#else
                    m_WebSocket.Closed += (s, e) =>
                    {
                        SetClosedStatus(ConnectionState.Fault);
                        Description = faultMessage;
                        Instances.Clear();
                        Messenger.Default.Send<IEnumerable<InstanceViewModel>>(null);
                    };
#endif
                    m_WebSocket.Close();
                }
                
                Messenger.Default.Send<AlertMessage>(new AlertMessage(faultMessage));
                return;
            }

            State = ConnectionState.Connected;
            OnServerUpdated(result.ServerInfo);

            if (!FirstLoaded)
                FirstLoaded = true;
        }