private void OnTextChanged(object sender, System.EventArgs e) { SsoPage ssoPage = (SsoPage)((SsoSampleWizard)Owner).GetPage(typeof(SsoPage)); OK.Enabled = Application.Text.Length > 0 && Administrator.Text.Length > 0 && User.Text.Length > 0 && !SsoConfigurator.Exists(Application.Text) && !ssoPage.Exists(Application.Text); }
private void AddMapping_Click(object sender, System.EventArgs e) { string[] apps = SsoConfigurator.GetApplications(); if (Applications.Count == 0 && apps.Length == 0) { MessageBox.Show("You must create at least one affiliate application", "No affiliate applications", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } AddMapping dlg = new AddMapping(); if (DialogResult.OK == dlg.ShowDialog(this)) { SsoMapping mapping = new SsoMapping(); mapping.Application = dlg.Applications.Text; mapping.User = dlg.User.Text; mapping.XU = dlg.XU.Text; mapping.XP = dlg.XP.Text; Mappings.Add(mapping); } }
private void AddMapping_Load(object sender, System.EventArgs e) { string[] apps = SsoConfigurator.GetApplications(); foreach (string app in apps) { Applications.Items.Add(app); } SsoPage ssoPage = (SsoPage)((SsoSampleWizard)Owner).GetPage(typeof(SsoPage)); if (ssoPage.Applications.Count != 0) { foreach (SsoApplication application in ssoPage.Applications) { Applications.Items.Add(application.Name); } } Applications.SelectedIndex = 0; }
/// <summary> /// Called when the PageBase is activated /// </summary> /// <returns>True if activation successfull, otherwise false</returns> public override bool OnSetActive() { if (!base.OnSetActive()) { return(false); } // Fill the applications drop down box string selected = null; if (Applications.Items.Count != 0) { selected = Applications.Text; } Applications.Items.Clear(); string[] apps = SsoConfigurator.GetApplications(); foreach (string app in apps) { Applications.Items.Add(app); } SsoPage ssoPage = (SsoPage)Wizard.GetPage(typeof(SsoPage)); if (ssoPage.Applications.Count != 0) { foreach (SsoApplication application in ssoPage.Applications) { Applications.Items.Add(application.Name); } } if (selected != null) { Applications.SelectedIndex = Applications.Items.IndexOf(selected); } else { if (Applications.Items.Count != 0) { Applications.SelectedIndex = 0; } } // Fill the URI field IisPage iisPage = (IisPage)Wizard.GetPage(typeof(IisPage)); int firstSlash = SendPortUri.Text.LastIndexOf("/"); if (firstSlash != -1) { int secondSlash = SendPortUri.Text.LastIndexOf("/", firstSlash - 1); if (secondSlash != -1) { SendPortUri.Text = SendPortUri.Text.Replace( SendPortUri.Text.Substring(secondSlash + 1, firstSlash - secondSlash - 1), iisPage.SendName.Text); } } OnTextChanged(null, null); return(true); }
/// <summary> /// Executes the chosen actions in a separate thread /// </summary> protected void Execute() { WelcomePage welcomePage = (WelcomePage)Wizard.GetPage(typeof(WelcomePage)); IisPage iisPage = (IisPage)Wizard.GetPage(typeof(IisPage)); SsoPage ssoPage = (SsoPage)Wizard.GetPage(typeof(SsoPage)); BtsPage btsPage = (BtsPage)Wizard.GetPage(typeof(BtsPage)); int actionsNumber = (welcomePage.StepIis.Checked?4:0) + (welcomePage.StepSso.Checked?2:0) + (welcomePage.StepBizTalk.Checked?2:0); // Create IIS configuration if (welcomePage.StepIis.Checked) { this.Invoke(LabelDelegate, new object[] { Status, "Creating IIS configuration..." }); this.Invoke(LabelDelegate, new object[] { Details, "Creating receive virtual directory" }); if (!IisConfigurator.CreateVirtualDirectory(iisPage.ReceiveName.Text, iisPage.ReceivePath.Text, false)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to create virtual directory '" + iisPage.ReceiveName.Text + "'", "IIS Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); this.Invoke(LabelDelegate, new object[] { Details, "Configuring receive COM+ application identity" }); if (!IisConfigurator.SetVirtualDirectoryHostIdentity(iisPage.ReceiveName.Text)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to configure COM+ application '" + iisPage.ReceiveName.Text + "'", "COM+ Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); this.Invoke(LabelDelegate, new object[] { Details, "Creating send virtual directory" }); if (!IisConfigurator.CreateVirtualDirectory(iisPage.SendName.Text, iisPage.SendPath.Text, true)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to create virtual directory '" + iisPage.SendName.Text + "'", "IIS Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); this.Invoke(LabelDelegate, new object[] { Details, "Configuring send COM+ application identity" }); if (!IisConfigurator.SetVirtualDirectoryHostIdentity(iisPage.SendName.Text)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to configure COM+ application '" + iisPage.SendName.Text + "'", "COM+ Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); } // Create SSO configuration if (welcomePage.StepSso.Checked) { this.Invoke(LabelDelegate, new object[] { Status, "Creating SSO configuration..." }); if (!SsoConfigurator.EnableTickets()) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to enable SSO tickets", "SSO Configuration error" }); } foreach (SsoApplication application in ssoPage.Applications) { this.Invoke(LabelDelegate, new object[] { Details, "Creating SSO application: " + application.Name }); if (!SsoConfigurator.AddApplication(application.Name, application.Administrator, application.User)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to create SSO application '" + application.Name + "'", "SSO Configuration error" }); } } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); this.Invoke(LabelDelegate, new object[] { Details, "Creating SSO mappings" }); foreach (SsoMapping mapping in ssoPage.Mappings) { if (!SsoConfigurator.AddMapping(mapping.Application, mapping.User, mapping.XU, mapping.XP)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to add mapping for SSO application '" + mapping.Application + "'", "SSO Configuration error" }); } } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); } // Create BizTalk configuration if (welcomePage.StepBizTalk.Checked) { this.Invoke(LabelDelegate, new object[] { Status, "Creating BizTalk configuration..." }); this.Invoke(LabelDelegate, new object[] { Details, "Creating receive port and receive location" }); string strBTSExpMsg = string.Empty; if (!BtsConfigurator.CreateHttpRequestResponsePort(iisPage.ReceiveName.Text, btsPage.ReceivePortName.Text, btsPage.ReceiveLocationName.Text, ref strBTSExpMsg)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to create receive port: " + strBTSExpMsg, "BizTalk Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); this.Invoke(LabelDelegate, new object[] { Details, "Creating send port" }); strBTSExpMsg = string.Empty; string appText = this.Invoke(GetApplicationsDelegate, new object[] { btsPage.Applications }).ToString(); if (!BtsConfigurator.CreateHttpSolicitResponsePort(btsPage.SendPortUri.Text, btsPage.SendPortName.Text, btsPage.ReceivePortName.Text, appText, ref strBTSExpMsg)) { this.Invoke(MessageBoxDelegate, new object[] { "Failed to create send port: " + strBTSExpMsg, "BizTalk Configuration error" }); } this.Invoke(ProgBarDelegate, new object[] { ProgressBar, 100 / actionsNumber }); } this.Invoke(LabelDelegate, new object[] { Details, "" }); this.Invoke(LabelDelegate, new object[] { Status, "Configuration completed." }); this.Invoke(ProgBarResetDelegate, new object[] { ProgressBar, 100 }); this.Invoke(CursorsWriteDelegate, new object[] { this, Cursors.Default }); Wizard.SetWizardButtons(WizardButtonType.Next); }