Пример #1
0
        /// <summary>
        /// Refreshes the psc table view.
        /// </summary>
        void RefreshPscTableView()
        {
            var serverDto = new ServerDto {
                Server   = _mgmtDto.Name,
                UserName = ServerDto.UserName,
                Upn      = ServerDto.Upn,
                Password = ServerDto.Password
            };

            if (_isConnected)
            {
                //var mgmtDto = _service.GetManagementNodeDetails (serverDto);
                var mgmtDto = RootNode.Hosts.FirstOrDefault(x => x.Sitename == _mgmtDto.Sitename && x.Name == _mgmtDto.Name) as ManagementDto;

                if (mgmtDto != null)
                {
                    var infraNodes = FilterBySiteName(mgmtDto.DomainControllers);
                    if (_mgmtDto.DomainController != null)
                    {
                        DomainControllerTextField.StringValue = _mgmtDto.DomainController.Name;

                        foreach (var node in infraNodes)
                        {
                            node.IsAffinitized = (node.Name == _mgmtDto.DomainController.Name || node.Ip == _mgmtDto.DomainController.Ip);
                        }
                    }
                    PscTableView.Delegate   = new MonitorTableViewDelegate(this);
                    PscDataSource           = new PscDataSource(infraNodes);
                    PscTableView.DataSource = PscDataSource;
                    PscTableView.ReloadData();

                    if (infraNodes != null && infraNodes.Count > 0 && PscTableView.SelectedRowCount <= 0)
                    {
                        PscTableView.SelectRow(0, true);
                    }

                    if (_mgmtDto.State != null)
                    {
                        Health health     = CdcDcStateHelper.GetHealth(_mgmtDto.State, infraNodes);
                        var    healthText = health.ToString().ToUpper();
                        CurrentStatusTextField.StringValue = healthText;
                        CurrentStatusTextField.TextColor   = GetHealthColor(health);
                        var healthDesc = CdcDcStateHelper.GetHealthDescription(health);
                        CurrentStatusTextField.ToolTip = healthDesc;
                    }
                    SiteAffinityButton.Title = "Enable " + (_mgmtDto.Legacy ? Constants.HA : Constants.Legacy);
                    LegacyModeWarning.Hidden = !_mgmtDto.Legacy;
                    LoadServices();
                }
            }
        }
        /// <summary>
        /// Gets the type of the image on node.
        /// </summary>
        /// <returns>The image on node type.</returns>
        /// <param name="datasource">Datasource.</param>
        /// <param name="row">Row.</param>
        /// <param name="ob">Ob.</param>
        private NSImage GetImageOnNodeType(PscDataSource datasource, nint row, VMPSCHighAvailabilityMainWindowController ob)
        {
            var collection = datasource.Entries;
            var isInfra    = false;

            if (collection != null)
            {
                var item = collection [(int)row];
                isInfra = (item.NodeType == VMPSCHighAvailability.Common.NodeType.Infrastructure);
            }
            return(isInfra
                                ? _ob.CachedImages [(int)ImageIndex.Infrastructure]
                                        : _ob.CachedImages [(int)ImageIndex.Management]);
        }