Пример #1
0
        private void ConnectToServer(string ip, int port)
        {
            TraceOps.Out("Connect to: " + ip + " : " + port);
            Services.GetService(ip, port, typeof(ConnectionTable));
            Services.GetService(ip, port, typeof(MessageQueue));
            _connectionTable = ConnectionTable.GetRemote(ip, port);
            _messageQueue = MessageQueue.GetRemote(ip, port);
            _name = HashOps.GetFqdn();

            try
            {
                foreach (IClientPlugin plugin in _plugins)
                {
                    plugin.SetForm(this);
                    plugin.SetName(ref _name);
                    plugin.SetQueue(ref _messageQueue);
                    plugin.SetTable(ref _connectionTable);
                }

                _networkClient = new NetworkClient(ref _messageQueue, ref _connectionTable, _name);
                _taskManager = new TaskManager(ref _messageQueue, ref _name);
                _taskManager.Task += TaskManagerOnTask;
                if (_plugins != null) _taskManager.SetListener(_plugins);
            }
            catch (Exception ex)
            {
                TraceOps.Out(ex.Message);
            }
        }