Esempio n. 1
0
        private void PopulateForestsAndDomains()
        {
            var currentDomain = Domain.GetCurrentDomain();

            this.Forests.Add(forestFactory.CreateViewModel(currentDomain.Forest));

            foreach (var domain in currentDomain.Forest.Domains.OfType <Domain>())
            {
                this.Domains.Add(domainFactory.CreateViewModel(domain));
            }

            foreach (var trust in currentDomain.Forest.GetAllTrustRelationships().OfType <TrustRelationshipInformation>())
            {
                if (trust.TrustDirection == TrustDirection.Inbound || trust.TrustDirection == TrustDirection.Bidirectional)
                {
                    var forest = Forest.GetForest(new DirectoryContext(DirectoryContextType.Forest, trust.TargetName));
                    this.Forests.Add(forestFactory.CreateViewModel(forest));

                    foreach (var domain in forest.Domains.OfType <Domain>())
                    {
                        this.Domains.Add(domainFactory.CreateViewModel(domain));
                    }
                }
            }

            this.RefreshData();
        }
        private async Task PopulateForestsAndDomains()
        {
            foreach (Forest forest in this.domainTrustProvider.GetForests())
            {
                this.Forests.Add(forestFactory.CreateViewModel(forest));

                foreach (Domain domain in this.domainTrustProvider.GetDomains(forest))
                {
                    this.Domains.Add(domainFactory.CreateViewModel(domain));
                }
            }

            await this.RefreshData();
        }