public override void Refresh(object sender, EventArgs e) { Children.Clear(); ActionHelper.Execute(delegate() { var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken(_serverDto.ServerName); var service = SnapInContext.Instance.ServiceGateway; var identityProviders = service.IdentityProvider.GetAll(_serverDto, _tenantName, auth.Token); var tenantConfig = new TenantConfigurationDto(); try{ tenantConfig = service.Tenant.GetConfig(_serverDto, _tenantName, auth.Token, TenantConfigType.PROVIDER); } catch (Exception exc) { // do nothing } var systemDomains = identityProviders.Where(x => x.DomainType == DomainType.SYSTEM_DOMAIN.ToString()); if (systemDomains != null) { foreach (var provider in systemDomains) { var systemDomain = new IdentitySourceNode(provider, _tenantName, true, provider.Name + " (System Domain)", tenantConfig) { Parent = this }; systemDomain.Refresh(this, EventArgs.Empty); Children.Add(systemDomain); } } var localOsDomains = identityProviders.Where(x => x.DomainType == DomainType.LOCAL_OS_DOMAIN.ToString()); ((TenantNode)this.Parent).IsSystemTenant = (localOsDomains != null && localOsDomains.Count() > 0); if (localOsDomains != null) { foreach (var provider in localOsDomains) { var localOsDomain = new IdentitySourceNode(provider, _tenantName, false, provider.Name + " (Local OS Domain)", tenantConfig) { Parent = this }; localOsDomain.Refresh(this, EventArgs.Empty); Children.Add(localOsDomain); } } var externalDomains = identityProviders.Where(x => x.DomainType == DomainType.EXTERNAL_DOMAIN.ToString()).ToList(); var externalDomainNode = new ExternalDomainsNode(_tenantName, externalDomains) { Parent = this }; externalDomainNode.PopulateChildren(externalDomains); Children.Add(externalDomainNode); NSNotificationCenter.DefaultCenter.PostNotificationName("ReloadOutlineView", this); }); }
public override void Refresh (object sender, EventArgs e) { Children.Clear (); ActionHelper.Execute (delegate() { var auth = SnapInContext.Instance.AuthTokenManager.GetAuthToken (_serverDto.ServerName); var service = SnapInContext.Instance.ServiceGateway; var identityProviders = service.IdentityProvider.GetAll (_serverDto, _tenantName, auth.Token); var tenantConfig = new TenantConfigurationDto (); ActionHelper.Execute (delegate() { tenantConfig = service.Tenant.GetConfig (_serverDto, _tenantName, auth.Token, TenantConfigType.PROVIDER); }); var systemDomains = identityProviders.Where (x => x.DomainType == DomainType.SYSTEM_DOMAIN.ToString ()); if (systemDomains != null) { foreach (var provider in systemDomains) { var systemDomain = new IdentitySourceNode (provider, _tenantName, true, provider.Name + " (System Domain)", tenantConfig){ Parent = this }; systemDomain.Refresh (this, EventArgs.Empty); Children.Add (systemDomain); } } var localOsDomains = identityProviders.Where (x => x.DomainType == DomainType.LOCAL_OS_DOMAIN.ToString ()); ((TenantNode)this.Parent).IsSystemTenant = (localOsDomains != null && localOsDomains.Count() > 0); if (localOsDomains != null) { foreach (var provider in localOsDomains) { var localOsDomain = new IdentitySourceNode (provider, _tenantName, false, provider.Name + " (Local OS Domain)", tenantConfig){ Parent = this }; localOsDomain.Refresh (this, EventArgs.Empty); Children.Add (localOsDomain); } } var externalDomains = identityProviders.Where (x => x.DomainType == DomainType.EXTERNAL_DOMAIN.ToString ()).ToList (); var externalDomainNode = new ExternalDomainsNode (_tenantName, externalDomains){ Parent = this }; externalDomainNode.PopulateChildren(externalDomains); Children.Add (externalDomainNode); NSNotificationCenter.DefaultCenter.PostNotificationName ("ReloadOutlineView", this); }); }