Esempio n. 1
0
 /// <summary>
 /// Processes a ClientApplicationRefreshEventMessage message.
 /// </summary>
 /// <param name="message">Message to process</param>
 private void ProcessClientApplicationRefreshEventMessage(ClientApplicationRefreshEventMessage message)
 {
     if (_applicationListForm != null)
     {
         _applicationListForm.GetClientApplicationRefreshEventMessage(message);
     }
 }
        /// <summary>
        /// Processes a ClientApplicationRefreshEventMessage.
        /// </summary>
        /// <param name="message">Message to process</param>
        private void RefreshClientApplication(ClientApplicationRefreshEventMessage message)
        {
            lock (_applicationList)
            {
                try
                {
                    EmptyList();

                    //Find application in list and change properties
                    foreach (var application in _applicationList)
                    {
                        if (message.Name.Equals(application.ApplicationName, StringComparison.OrdinalIgnoreCase))
                        {
                            application.ConnectedClients = message.CommunicatorCount;
                            return;
                        }
                    }

                    //Add to list if it is not in list
                    _applicationList.Add(
                        new ApplicationListItem
                    {
                        ApplicationName  = message.Name,
                        ConnectedClients = message.CommunicatorCount
                    });
                }
                finally
                {
                    RefreshList();
                }
            }
        }
 /// <summary>
 /// This method is called by MainForm when a ClientApplicationRefreshEventMessage received from MDS Server.
 /// </summary>
 /// <param name="message">Incoming message</param>
 public void GetClientApplicationRefreshEventMessage(ClientApplicationRefreshEventMessage message)
 {
     RefreshClientApplication(message);
 }