示例#1
0
        private void HandleDataQunatityResponse(MessageReceivedEventArgs args)
        {
            var message = (DataQuantityResponseMessage)args.Message;

            _totalDataQunatity += message.Quantity;
            if (message.IsLastServerNode)
            {
                DataQunatityComputed?.Invoke(this, new DataQuantityEventArgs(_totalDataQunatity));
                _totalDataQunatity = 0;
            }
        }
示例#2
0
        public void GetDataQuantity()
        {
            var dataQuantityRequestMessage = new DataQuantityRequestMessage();

            _totalDataQunatity = BytesHelper.GetDataSizeInBytes(_dataManager.GetEmployees().ToList());
            if (_knowedServerNodesConnectors.Count == 0)
            {
                DataQunatityComputed?.Invoke(this, new DataQuantityEventArgs(_totalDataQunatity));
            }
            for (int i = 0; i < _knowedServerNodesConnectors.Count; i++)
            {
                dataQuantityRequestMessage.IsLastServerNode = i == _knowedServerNodesConnectors.Count - 1;
                _knowedServerNodesConnectors[i].SendMessage(dataQuantityRequestMessage);
            }
        }