public MonadConnectionInfo GetMonadConnectionInfo(IUIService uiService, OrganizationSetting forestInfo) { lock (this.forestConnectionInfos) { if (this.forestConnectionInfos.ContainsKey(forestInfo.Key)) { return(this.forestConnectionInfos[forestInfo.Key]); } } MonadConnectionInfo monadConnectionInfo = this.DiscoverForestConnectionInfo(uiService, forestInfo); MonadConnectionInfo result; lock (this.forestConnectionInfos) { this.forestConnectionInfos[forestInfo.Key] = monadConnectionInfo; result = monadConnectionInfo; } return(result); }
public string Add(string displayName, Uri uri, bool logonWithDefaultCredential, OrganizationType type, SupportedVersionList supportedVersionList) { if (!this.HasAvailableSlots) { throw new IndexOutOfRangeException("No more slots are available."); } OrganizationSetting organizationSetting = new OrganizationSetting(); organizationSetting.DisplayName = displayName; organizationSetting.Uri = uri; organizationSetting.LogonWithDefaultCredential = logonWithDefaultCredential; organizationSetting.Type = type; organizationSetting.Key = this.AllocateSlot(supportedVersionList); this.organizationSettings.Add(organizationSetting); if (type != OrganizationType.Cloud && !this.RecentServerUris.Contains(uri)) { this.RecentServerUris.Add(uri); } return(organizationSetting.Key); }
private MonadConnectionInfo DiscoverForestConnectionInfo(IUIService uiService, OrganizationSetting forestInfo) { SupportedVersionList supportedVersionList = null; switch (forestInfo.Type) { case OrganizationType.LocalOnPremise: return(new ConnectionRetryDiscoverer(uiService, OrganizationType.LocalOnPremise, Strings.MicrosoftExchangeOnPremise, PSConnectionInfoSingleton.GetRemotePowerShellUri(this.GetAutoDiscoveredServer()), true).DiscoverConnectionInfo(out supportedVersionList, string.Empty)); case OrganizationType.RemoteOnPremise: case OrganizationType.Cloud: return(new ConnectionRetryDiscoverer(forestInfo, uiService).DiscoverConnectionInfo(out supportedVersionList, string.Empty)); default: return(null); } }
public ConnectionRetryDiscoverer(OrganizationSetting orgSetting, IUIService uiService) : this(new WindowUIInteractionHandler((Control)uiService.GetDialogOwnerWindow()), orgSetting.Type, orgSetting.DisplayName, orgSetting.Uri, orgSetting.LogonWithDefaultCredential, orgSetting.CredentialKey, null) { }