Пример #1
0
 public NetworkClient(ref MessageQueue messageQueue, ref ConnectionTable connectionTable, string name)
 {
     _clientRunning = true;
     _name = name;
     _messageQueue = messageQueue;
     _connectionTable = connectionTable;
     _cpuCounter = new PerformanceCounter { CategoryName = "Processor", CounterName = "% Processor Time", InstanceName = "_Total" };
     _threadMessages = new Thread(MessageWorker);
     _threadMessages.Start();
 }
Пример #2
0
        private void ClientsTable_Load(object sender, EventArgs e)
        {
            _running = true;
            _connectionTable = ConnectionTable.GetRemote(_ip, _port);
            _messageQueue = MessageQueue.GetRemote(_ip, _port);
            clientListView.ItemChecked += clientListView_CheckedIndexChanged;

            CreateGroups();

            Thread thread = new Thread(new ThreadStart(() =>
            {
                while (_running)
                {
                    UpdateClientTable();
                    Thread.Sleep(2000);
                }
            }));
            thread.Start();
        }
Пример #3
0
 public void SetTable(ref ConnectionTable connectionTable)
 {
     _connectionTable = connectionTable;
 }
Пример #4
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);
            }
        }
Пример #5
0
 public ServerClientDetailForm(ConnectionTable.ClientInformation information)
 {
     InitializeComponent();
     _information = information;
 }
Пример #6
0
 public void SetTable(ref ConnectionTable connectionTable)
 {
     _connectionTable = connectionTable;
     _control.SetTable(ref connectionTable);
 }
Пример #7
0
        private void MainServerForm_Load(object sender, EventArgs e)
        {
            TraceOps.LoadLog();
            try
            {
                _name = "Server";

                Services.PrepareSetService(_port);
                Services.SetService(typeof(ConnectionTable));
                Services.SetService(typeof(MessageQueue));

                _connectionTable = ConnectionTable.GetRemote("localhost",_port);
                _messageQueue = MessageQueue.GetRemote("localhost", _port);

                _taskManager = new TaskManager(ref _messageQueue, ref _name);
                _taskManager.Task += TaskManagerOnTask;

                var ci = new ConnectionTable.ClientInformation(_name);
                ci.SetGroup("server");
                ci.SetIp(NetworkOps.GetIpString(HashOps.GetFqdn()));
                ci.SetPort(_port);
                _connectionTable.Set(_name, ci);

                LoadClientsTable();
                LoadPlugIns();
            }
            catch (Exception ex)
            {
                TraceOps.Out(ex.Message);
            }
        }