private void UpdateServices(InfrastructureDto dto) { lblStatus.Text = dto.Active ? Constants.Active : Constants.InActive; lblStatus.ForeColor = HealthHelper.GetHealthColor(dto.Active); var description = CdcDcStateHelper.GetActiveServiceDesc(dto); toolTip1.SetToolTip(lblStatus, description); lstServices.Items.Clear(); foreach (ServiceDto service in dto.Services) { var status = service.Alive ? Constants.Active : Constants.InActive; var message = string.Format("Last Heartbeat for server {0} service {1} is {2}, UTC: {3}", dto.Name, service.ServiceName, service.LastHeartbeat.ToString("dd-MMM-yyyy HH:mm:ss"), DateTime.UtcNow.ToString("dd-MMM-yyyy HH:mm:ss")); PscHighAvailabilityAppEnvironment.Instance.Logger.Log(message, LogLevel.Info); var hb = DateTimeConverter.ToDurationAgo(service.LastHeartbeat); message = string.Format("Last Heartbeat shown on UI for server {0} service {1} is {2}", dto.Name, service.ServiceName, hb); PscHighAvailabilityAppEnvironment.Instance.Logger.Log(message, LogLevel.Info); var port = service.Port == 0 ? string.Empty : service.Port.ToString(); var values = new string[] { service.ServiceName, service.Description, port, status, hb }; ListViewItem item = new ListViewItem(values) { ImageIndex = (int)ImageIndex.Service }; item.BackColor = service.Alive ? Color.LightGreen : Color.Pink; lstServices.Items.Add(item); } lstServices.Refresh(); }
private void UpdateState() { SetLegacyControlStatus(); lblState.Text = _dto.State.Description; var health = CdcDcStateHelper.GetHealth(_dto.State, _infraDtos); lblStatus.Text = health.ToString().ToUpper(); var description = CdcDcStateHelper.GetHealthDescription(health); toolTip1.SetToolTip(lblStatus, description); lblStatus.ForeColor = HealthHelper.GetHealthColor(health); lblLastRefreshed.Text = DateTime.Now.ToString(Constants.DateFormat); btnHA.Text = _dto.Legacy ? Constants.EnableDefaultHA : Constants.EnableLegacy; legacyMode = _dto.Legacy; txtDomainControllerName.Text = _dto.DomainController.Name; }