Пример #1
0
        public void Connect(User user)
        {
            //connect to proxy, and subscribe to its events
            proxySingleton.Connect(user);
            int limit = 0;

            while (!proxySingleton.IsConnected && limit++ < 30 && proxySingleton.ProxyState != CommunicationState.Opened)
            {
                Thread.Sleep(1000);
                System.Windows.Forms.Application.DoEvents();
            }
        }
Пример #2
0
        public static void Initialize(User user)
        {
            users          = new List <User>();
            clientMessages = Queue.Synchronized(new Queue());

            ChatServer.OpenHost();
            if (ChatServer.IsOpened)
            {
                proxySingleton.Connect(user);

                int limit = 0;
                while (!proxySingleton.IsConnected && limit++ < 30 && proxySingleton.ProxyState != CommunicationState.Opened)
                {
                    Thread.Sleep(1000);
                }

                proxySingleton.ProxyEvent         += ProxyEvent;
                proxySingleton.ProxyCallBackEvent += ProxyCallBackEvent;
            }
        }