Beispiel #1
0
        public Client()
        {
            InitializeComponent();

            var current = null as ClientHost;

            do
            {
                if (currentService >= maxService)
                {
                    currentService = 0;
                }

                current = _ClientHosts.ElementAtOrDefault(currentService);
                Interlocked.Increment(ref currentService);
            } while (current == null);

            lock (current.lockObj)
            {
                #region NamePipe, Tcp сбрасывать соединение
                switch (Mode)
                {
                case ClientMode.Server:
                case ClientMode.Tcp:
                case ClientMode.NamedPipe:
                {
                    var _time = DateTime.Now;
                    if (current.IdleTimeout <= _time)
                    {
                        current.Dispose();
                        current.IdleTimeout = _time.Add(InactivityTimeout);
                    }
                }
                break;
                }
                #endregion

                if (!current.IsInitialize)
                {
                    current.Dispose();
                    current.Initialize();
                }

                this.Архив        = current.Архив;
                this.Конфигуратор = current.Конфигуратор;
                this.Бухгалтерия  = current.Бухгалтерия;
                this.Сервисы      = current.Сервисы;
                this.Файлы        = current.Файлы;
            }
        }