예제 #1
0
 private static void AddServer(AgentUpdateInfo agentUpdateInfo, dynamic client)
 {
     var serverModel = new ServerModel
                           {
                               MacAddress = agentUpdateInfo.Server.MacAddress,
                               Name = agentUpdateInfo.Server.Name,
                               ServerId = agentUpdateInfo.Server.Id
                           };
     client.addServer(serverModel);
 }
예제 #2
0
 private static void UpdateSpaceStatistics(AgentUpdateInfo agentUpdateInfo, dynamic client)
 {
     double freeSpace = BytesConverter.BytesToGigaBytes(agentUpdateInfo.Server.FreeSpace);
     double usedSpace = BytesConverter.BytesToGigaBytes(agentUpdateInfo.Server.UsedSpace);
     var spaceStatisticsModel = new SpaceStatisticsModel
                                    {
                                        ServerId = agentUpdateInfo.Server.Id,
                                        FreeSpace = freeSpace,
                                        UsedSpace = usedSpace
                                    };
     client.updateSpaceStatistics(spaceStatisticsModel);
 }
예제 #3
0
        public void NotifyClients(AgentUpdateInfo agentUpdateInfo)
        {
            dynamic client = this.hub.Clients.User(agentUpdateInfo.UserId);

            if (agentUpdateInfo.IsNew)
            {
                AddServer(agentUpdateInfo, client);
            }
            else
            {
                UpdateSpaceStatistics(agentUpdateInfo, client);
            }
        }