Ejemplo n.º 1
0
        private void CloseConnectionInTick(bool showConnectionLost)
        {
            DateTime time = new DateTime(DateTime.Now.Ticks);

            while (!connection.CanClose() && (DateTime.Now - time).TotalMilliseconds < 2500)
            {
                ;                                                                             // нечего передавать и время работы
            }
            connection.Close();
            connection = new CircleConnection(this, this.dataController, getLogin.login, getLogin.backComName, getLogin.forwardComName);
            this.Invoke((Action <bool>)(delegate(bool idle)
            {
                onlineUsersList.Items.Clear();
                if (showConnectionLost)
                {
                    LogBox.AppendText("# Соединение потеряно" + Environment.NewLine);
                }
            }), true);
        }