Jibbr.ViewModels.AccountViewModel.clientConnection_OnReadXml C# (CSharp) Method

clientConnection_OnReadXml() private method

private clientConnection_OnReadXml ( object sender, string xml ) : void
sender object
xml string
return void
        void clientConnection_OnReadXml(object sender, string xml)
        {
            if (connectionState == XmppConnectionState.Connected)
            {
                try
                {
                    agsXMPP.Xml.Dom.Document document = new agsXMPP.Xml.Dom.Document();
                    document.LoadXml(xml);
                    if (document.ChildNodes.Count > 0)
                    {
                        foreach (agsXMPP.Xml.Dom.Node node in document.ChildNodes)
                        {
                            if (node is agsXMPP.protocol.Base.Stream)
                            {
                                agsXMPP.protocol.Base.Stream stream = node as agsXMPP.protocol.Base.Stream;
                                if (stream.From != serverName && stream.From != connectServer)
                                {
                                    //Do reset here.
                                    SignOut();
                                    AutoResolveConnectServer = false;
                                    ConnectServer = serverName;
                                    ServerName = stream.From;
                                    reconnectOnDisconnect = true;
                                }
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                }
            }
        }