Exemple #1
0
        private void Connect()
        {
            if (_disposing || _connecting)
            {
                return;
            }

            _connecting = true;
            try
            {
                while (!_stopConnectThread && !_disposing)
                {
                    try
                    {
                        if (!_rpc.IsConnected)
                        {
                            _rpc.Connect(_events);
                        }

                        break;
                    }
                    catch (Exception ex)
                    {
                        ConnectError?.Invoke(this, ex.Message, ex.StackTrace);
                        Thread.Sleep(10000);
                    }
                }
            }
            catch (Exception ex)
            {
                _connecting = false;
                throw ex;
            }
            _connecting = false;
        }