Example #1
0
 protected void Add(WizardStep step)
 {
     if (!WizardSteps.ContainsKey(step.OnForm))
     {
         WizardSteps[step.OnForm] = new List <WizardStep>();
     }
     WizardSteps[step.OnForm].Add(step);
 }
 public static PanelDesc Panel(WizardSteps step)
 {
     if (_panels.Count <= 0)
     {
         return(null);
     }
     return(_panels[step]);
 }
 private void FireGoToEvent(WizardSteps step, object state = null)
 {
     EventHandler<GoToWizardStepEventArgs> _goTo = GoTo;
     if (_goTo != null)
     {
         _goTo(this, new GoToWizardStepEventArgs(step, state));
     }
 }
        private void FireGoToEvent(WizardSteps step, object state = null)
        {
            EventHandler <GoToWizardStepEventArgs> _goTo = GoTo;

            if (_goTo != null)
            {
                _goTo(this, new GoToWizardStepEventArgs(step, state));
            }
        }
        private void FireGoToEvent(WizardSteps step, object state = null, bool isNavigatingBack = false)
        {
            EventHandler <GoToWizardStepEventArgs> _goTo = GoTo;

            if (_goTo != null)
            {
                _goTo(this, new GoToWizardStepEventArgs(step, state, isNavigatingBack));
            }
        }
Example #6
0
        public void AddStep(object obj)
        {
            var newStep = new WizardStep()
            {
                Name = "Step " + (WizardSteps.Count + 1)
            };

            newStep.Parent = WizardSteps;
            WizardSteps.Add(newStep);
            SelectedStep = newStep;
        }
Example #7
0
 /// <summary>
 /// Returns the Previous Step and sets the step pointer to that step.
 /// </summary>
 /// <exception cref="WizardStepException">Thrown if the current step is the first step.</exception>
 /// <returns>The previous step.</returns>
 public virtual IWizardStep GetPreviousStep()
 {
     if (CurrentStep > 0)
     {
         _visitedSteps.Pop();
         IWizardStep previousStep = _visitedSteps.Peek();
         CurrentStep = WizardSteps.IndexOf(previousStep);
         return(previousStep);
     }
     throw new WizardStepException("Invalid Wizard Step: " + (CurrentStep - 1));
 }
Example #8
0
        private void SetWizardStepValue(CheckoutStepEnum step, string value)
        {
            var wizardStep = WizardSteps
                             .Where(x => x.Step == step)
                             .FirstOrDefault();

            if (wizardStep != null)
            {
                wizardStep.Value = value;
            }
        }
Example #9
0
        public void Run(WizardOnAction action)
        {
            if (!WizardSteps.ContainsKey(Navigator.GetType()))
            {
                return;
            }

            foreach (var step in WizardSteps[Navigator.GetType()].Where(step => step.OnAction.Contains(action)))
            {
                step.Run(this, action);
            }
        }
 public PanelDesc(WizardSteps step, PanelActionResize resize,
                  PanelActionDrawContents drawContents,
                  PanelActionClearContents clear,
                  PanelActionNextClicked nextClicked)
 {
     _step          = step;
     _resize        = resize;
     _clearContents = clear;
     _drawContents  = drawContents;
     _nextClicked   = nextClicked;
     _panels[step]  = this;
 }
Example #11
0
        public string GetHeader(WizardOnAction action)
        {
            if (!WizardSteps.ContainsKey(Navigator.GetType()))
            {
                return(null);
            }

            return(WizardSteps[Navigator.GetType()]
                   .Where(step => step.OnAction.Contains(action))
                   .Where(r => r.EnabledHandler == null || r.EnabledHandler(this, action))
                   .Select(step => step.Header)
                   .FirstOrDefault());
        }
 private void SetPreviousStep()
 {
     if (_currentStep == WizardSteps.Four)
     {
         if (RdoIdentitySource.SelectedRow == 0)
         {
             _currentStep = WizardSteps.One;
         }
         else
         {
             _currentStep = IsUnsecuredConnection() ? WizardSteps.Two : _currentStep - 1;
         }
     }
     else
     {
         _currentStep--;
     }
 }
Example #13
0
 private void SetNextStep()
 {
     if (_currentStep == WizardSteps.One && RdoIdentitySource.SelectedRow == 0)
     {
         _currentStep = WizardSteps.Four;
     }
     else
     {
         if (_currentStep == WizardSteps.Two && IsUnsecuredConnection())
         {
             _currentStep = WizardSteps.Four;
         }
         else
         {
             _currentStep++;
         }
     }
 }
Example #14
0
        public void RemoveEntry(object obj)
        {
            int id = -1;

            if (int.TryParse(obj.ToString(), out id))
            {
                for (int i = 0; i < WizardSteps.Count; i++)
                {
                    if (WizardSteps[i].Id == id)
                    {
                        var response = MessageBox.Show("Delete this step?", "Remove Step", MessageBoxButton.OKCancel);
                        if (response == MessageBoxResult.OK)
                        {
                            WizardSteps.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
        }
            protected override void CreateWizardSteps()
            {
                // The WizardSteps should be empty when this is called
                Debug.Assert(WizardSteps.Count == 0);

                WizardStep s = new WizardStep();

                _fieldName    = new DropDownList();
                _fieldName.ID = fieldNameID;
                if (OldProviderNames != null)
                {
                    for (int i = 0; i < OldProviderNames.Length / 2; i++)
                    {
                        ListItem item = new ListItem(OldProviderNames[2 * i], OldProviderNames[2 * i + 1]);
                        // Ignore case when setting selected value, since we ignore case when
                        // returing the connection data. (VSWhidbey 434566)
                        if (String.Equals(item.Value, _owner.FieldName, StringComparison.OrdinalIgnoreCase))
                        {
                            item.Selected = true;
                        }
                        _fieldName.Items.Add(item);
                    }
                }
                else
                {
                    _fieldName.Items.Add(new ListItem(SR.GetString(SR.RowToFieldTransformer_NoProviderSchema)));
                    _fieldName.Enabled = false;
                }

                Label fieldNameLabel = new Label();

                fieldNameLabel.Text = SR.GetString(SR.RowToFieldTransformer_FieldName);
                fieldNameLabel.AssociatedControlID = _fieldName.ID;

                s.Controls.Add(fieldNameLabel);
                s.Controls.Add(new LiteralControl(" "));
                s.Controls.Add(_fieldName);

                WizardSteps.Add(s);
            }
        private void OnPagePreRenderComplete(object sender, EventArgs e)
        {
            // Copy current schemas into arrays
            string[] providerNames = ConvertSchemaToArray(ProviderSchema);
            string[] consumerNames = ConvertSchemaToArray(ConsumerSchema);

            // If current schemas are not the same as the old schemas, or if the WizardSteps have
            // not been created yet, update the old schemas and recreate the Wizard steps.
            if (StringArraysDifferent(providerNames, OldProviderNames) ||
                StringArraysDifferent(consumerNames, OldConsumerNames) || WizardSteps.Count == 0)
            {
                OldProviderNames = providerNames;
                OldConsumerNames = consumerNames;

                WizardSteps.Clear();
                ClearChildState();

                CreateWizardSteps();
                ActiveStepIndex = 0;
            }

            // We should always have at least 1 WizardStep before we Render
            Debug.Assert(WizardSteps.Count > 0);
        }
Example #17
0
        private void GoToStep(WizardSteps step, object state, bool isNavigatingBack = false)
        {
            this.SuspendLayout();

            if (_previousControl != null)
            {
                this.contentPanel.Controls.Remove(_previousControl);
            }

            IWizardStep wizardStep = _steps[step];

            wizardStep.SetState(state, isNavigatingBack);

            Control wizardStepControl = (Control)wizardStep;

            wizardStepControl.Dock = DockStyle.Fill;

            this.contentPanel.Controls.Add(wizardStepControl);
            this.contentPanel.ResumeLayout(false);
            this.contentPanel.PerformLayout();
            this.ResumeLayout(false);

            _previousControl = wizardStepControl;
        }
        private static void RunApplication(string[] arguments)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            processArguments(arguments);

            MigrateFiles("Languages", "*.txt", "Languages", false);

            Settings = Settings.Load(SettingsFile);

            SelectedSteps = Settings.LastSelectedSteps;

            // Load the translations.
            Lib.SetCommunicationsObject(LibCommunications.GetInstance());

            Settings.LoadTranslations();

            MigrateDataFiles();
            #if FULL_TOOLSET
            LoadedAssemblyModules = new List<AssemblyInfo>();
            string ToolsDirectory = Settings.MakeDirectory("Tools");
            ToolList = ModuleLoader<ToolInfo>.LoadAll(
                new string[] { ToolsDirectory, "Tools" }, "*.dll");
            MainForm = new MainForm(Settings.TranslationProvider);
            Application.Run(MainForm);
            #else
            NextForm = new Welcome(Program.Settings.TranslationProvider);

            while (NextForm != null)
            {
                Application.Run(NextForm);
            }
            #endif
        }
        /// <summary>
        /// Constructs the list of wizard steps to be run.
        /// </summary>
        /// <param name="steps"></param>
        internal static void ConstructSteps(WizardSteps steps)
        {
            SelectedSteps = steps;
            Program.Settings.LastSelectedSteps = steps;

            CurrentStep = -1;
            List<Type> constructedSteps = new List<Type>();

            // Using flags, generate the steps to run
            if ((steps & WizardSteps.Extract_General_Files) != 0)
                constructedSteps.Add(typeof(ExtractGeneralFiles));
            if ((steps & WizardSteps.Copy_Original_Files) != 0)
                constructedSteps.Add(typeof(CopyOriginalFiles));
            if ((steps & WizardSteps.Extract_Materials) != 0)
                constructedSteps.Add(typeof(ExtractMaterials));
            if ((steps & WizardSteps.Convert_And_Copy_Materials) != 0)
                constructedSteps.Add(typeof(ConvertAndCopyMaterials));
            if ((steps & WizardSteps.Decompile_Maps) != 0)
                constructedSteps.Add(typeof(DecompileMaps));
            if ((steps & WizardSteps.Fix_Decompiled_Maps) != 0)
                constructedSteps.Add(typeof(FixDecompiledMaps));
            if ((steps & WizardSteps.Extract_Base_Files) != 0)
                constructedSteps.Add(typeof(CopyBaseFiles));
            if ((steps & WizardSteps.Extract_Original_Models) != 0)
                constructedSteps.Add(typeof(ExtractModels));
            if ((steps & WizardSteps.Update_And_Patch_Files) != 0)
                constructedSteps.Add(typeof(UpdateAndPatchFiles));
            if ((steps & WizardSteps.View_Changelog) != 0)
                constructedSteps.Add(typeof(ViewChangelog));

            StepsToRun = constructedSteps.ToArray();
            LibCommunications.gAddLog("Steps to run:");
            foreach (Type type in constructedSteps)
            {
                LibCommunications.gAddLog(" -> " + type.FullName);
            }
            LibCommunications.gAddLog("Fin.");
        }
Example #20
0
        /// <summary>
        /// Display a wizard form of the given type in the main tab container.
        /// If the an existing form of the same type exist, make it visible, otherwise create a new one
        /// </summary>
        /// <param name="step">The type of wizard step to display</param>
        private void LoadForm(WizardSteps step)
        {
            WizardForm form = null;
            //search for the list of wizard forms currently available for the given type.
            //if an existing form already exist, make it visible.
            foreach (Control control in pnlContent.Controls)
            {
                if (control is WizardForm)
                {
                    form = control as WizardForm;
                    if (form.WizardStep == step)
                        break;
                    else
                        form = null;
                }
            }
            //wizard form of the given type not found. create a new one.
            if (form == null)
            {
                switch (step)
                {
                    case WizardSteps.Welcome:
                        form = new WelcomeForm();
                        break;
                    case WizardSteps.Keyboards:
                        form = new KeyboardForm();
                        break;
                    case WizardSteps.Fonts:
                        form = new FontForm();
                        break;
                    case WizardSteps.Review:
                        form = new ReviewForm();
                        break;
                    case WizardSteps.Finish:
                        form = new FinishForm();
                        break;
                    default:
                        throw new ApplicationException("Wizard form type not supported: " + step);
                }

                //wizard forms are displayed as child controls of the tab container.
                form.TopMost = false;
                form.TopLevel = false;

                //occupy all the available real estate in the container.
                form.Dock = DockStyle.Fill;

                //add the form to container.
                pnlContent.Controls.Add(form);

            }

            //customize the command buttons based on the current active wizard form.
            switch (step)
            {
                case WizardSteps.Welcome:
                    imgArrow.Location = new Point(6, lnkWelcome.Location.Y - 4 + lnkWelcome.Size.Height / 2);
                    btnNext.Text = languageResource.GetString("Next") + " >>";
                    btnNext.Enabled = true;
                    btnBack.Enabled = false;
                    break;
                case WizardSteps.Keyboards:
                    imgArrow.Location = new Point(6, lnkKeyboard.Location.Y - 4 + lnkKeyboard.Size.Height / 2);
                    btnNext.Text = languageResource.GetString("Next") +" >>";
                    btnNext.Enabled = true;
                    btnBack.Enabled = true;
                    break;
                case WizardSteps.Fonts:
                    imgArrow.Location = new Point(6, lnkFonts.Location.Y - 4 + lnkFonts.Size.Height / 2);
                    btnNext.Text = languageResource.GetString("Next") + " >>";
                    btnNext.Enabled = true;
                    btnBack.Enabled = true;
                    break;
                case WizardSteps.Review:
                    imgArrow.Location = new Point(6, lnkReview.Location.Y - 4 + lnkReview.Size.Height / 2);
                    btnNext.Text = languageResource.GetString("Install");
                    btnNext.Enabled = true;

                    //display a list of selected keyboards and fonts when in the review form.
                    ReviewForm rform = form as ReviewForm;
                    foreach (Control control in pnlContent.Controls)
                    {
                        if (control is KeyboardForm)
                        {
                            KeyboardForm kform = control as KeyboardForm;
                            rform.SelectedKeyboards = kform.GetSelectedKeyboards();
                        }
                        else if (control is FontForm)
                        {
                            FontForm fontform = control as FontForm;
                            rform.SelectedFonts = fontform.GetSelectedFonts();
                        }
                    }
                    //allow user to proceed to install screen only if a keyboard/font has been selected.
                    if ((rform.SelectedKeyboards!=null && rform.SelectedKeyboards.Count > 0) ||
                        (rform.SelectedFonts!=null && rform.SelectedFonts.Count > 0))
                    {
                        btnNext.Enabled = true;
                    }
                    else
                    {
                        btnNext.Enabled = false;
                    }
                    break;
                default:
                    break ;
            }
            //show the wizard form, or bring it to the front so it shows.
            form.Show();
            form.BringToFront();
            CurrentStep = step;
        }
		private void SetPreviousStep()
		{
			if (_currentStep == WizardSteps.Four) {
				if (RdoIdentitySource.SelectedRow == 0) {
					_currentStep = WizardSteps.One;
				} else {
						_currentStep = IsUnsecuredConnection() ? WizardSteps.Two : _currentStep - 1;
				}
			} else {	
				_currentStep--;
			}
		}
            protected override void CreateWizardSteps()
            {
                // The WizardSteps should be empty when this is called
                Debug.Assert(WizardSteps.Count == 0);

                int oldProviderNamesLength = (OldProviderNames != null) ? OldProviderNames.Length : 0;

                if (oldProviderNamesLength > 0)
                {
                    _consumerFieldNames = new DropDownList[oldProviderNamesLength / 2];

                    ListItem[] consumerItems          = null;
                    int        oldConsumerNamesLength = (OldConsumerNames != null) ? OldConsumerNames.Length : 0;
                    if (oldConsumerNamesLength > 0)
                    {
                        consumerItems = new ListItem[oldConsumerNamesLength / 2];
                        for (int i = 0; i < oldConsumerNamesLength / 2; i++)
                        {
                            consumerItems[i] = new ListItem(OldConsumerNames[2 * i], OldConsumerNames[2 * i + 1]);
                        }
                    }

                    for (int i = 0; i < oldProviderNamesLength / 2; i++)
                    {
                        WizardStep s = new WizardStep();

                        s.Controls.Add(new LiteralControl(
                                           SR.GetString(SR.RowToParametersTransformer_ProviderFieldName) + " "));
                        Label label = new Label();

                        // HtmlEncode the string, since it comes from the provider schema and it may contain
                        // unsafe characters.
                        label.Text = HttpUtility.HtmlEncode(OldProviderNames[2 * i]);

                        label.Font.Bold = true;
                        s.Controls.Add(label);

                        s.Controls.Add(new LiteralControl("<br />"));

                        DropDownList consumerFieldName = new DropDownList();
                        consumerFieldName.ID = consumerFieldNameID + i;
                        if (consumerItems != null)
                        {
                            consumerFieldName.Items.Add(new ListItem());

                            // Calculate consumerFieldValue based on the current providerFieldValue,
                            // and the ProviderFieldNames and ConsumerFieldNames on the Transformer
                            string[] providerFieldNames = _owner._providerFieldNames;
                            string[] consumerFieldNames = _owner._consumerFieldNames;
                            string   providerFieldValue = OldProviderNames[2 * i + 1];
                            string   consumerFieldValue = null;
                            if (providerFieldNames != null)
                            {
                                for (int j = 0; j < providerFieldNames.Length; j++)
                                {
                                    // Ignore case when getting the value, since we ignore case when
                                    // returing the connection data. (VSWhidbey 434566)
                                    if (String.Equals(providerFieldNames[j], providerFieldValue,
                                                      StringComparison.OrdinalIgnoreCase) &&
                                        consumerFieldNames != null && consumerFieldNames.Length > j)
                                    {
                                        consumerFieldValue = consumerFieldNames[j];
                                        break;
                                    }
                                }
                            }

                            foreach (ListItem consumerItem in consumerItems)
                            {
                                ListItem item = new ListItem(consumerItem.Text, consumerItem.Value);
                                // Ignore case when setting selected value, since we ignore case when
                                // returing the connection data. (VSWhidbey 434566)
                                if (String.Equals(item.Value, consumerFieldValue, StringComparison.OrdinalIgnoreCase))
                                {
                                    item.Selected = true;
                                }
                                consumerFieldName.Items.Add(item);
                            }
                        }
                        else
                        {
                            consumerFieldName.Items.Add(new ListItem(
                                                            SR.GetString(SR.RowToParametersTransformer_NoConsumerSchema)));
                            consumerFieldName.Enabled = false;
                        }
                        _consumerFieldNames[i] = consumerFieldName;

                        Label consumerFieldNameLabel = new Label();
                        consumerFieldNameLabel.Text = SR.GetString(SR.RowToParametersTransformer_ConsumerFieldName);
                        consumerFieldNameLabel.AssociatedControlID = consumerFieldName.ID;

                        s.Controls.Add(consumerFieldNameLabel);
                        s.Controls.Add(new LiteralControl(" "));
                        s.Controls.Add(consumerFieldName);

                        WizardSteps.Add(s);
                    }
                }
                else
                {
                    WizardStep s = new WizardStep();
                    s.Controls.Add(new LiteralControl(SR.GetString(SR.RowToParametersTransformer_NoProviderSchema)));
                    WizardSteps.Add(s);
                }

                // We should always have at least 1 WizardStep when we return
                Debug.Assert(WizardSteps.Count > 0);
            }
        private void FireGoToEvent(WizardSteps step, object state = null, bool isNavigatingBack = false)
        {
            EventHandler<GoToWizardStepEventArgs> _goTo = GoTo;
            if (_goTo != null)
            {
                _goTo(this, new GoToWizardStepEventArgs(step, state, isNavigatingBack));

            }
        }
Example #24
0
        public override void AwakeFromNib()
        {
            base.AwakeFromNib();

            _certificates = new List <CertificateDto> ();
            var title = string.Empty;

            if (IdentityProviderDto != null)
            {
                var tag = GetIdFromIdentitySourceType(IdentityProviderDto.Type);

                if (tag == 1)
                {
                    title        = VMIdentityConstants.AD_WIN_AUTH_TITLE;
                    _currentStep = WizardSteps.Four;
                }
                else
                {
                    if (tag == 2)
                    {
                        title = VMIdentityConstants.AD_AS_LDAP_TITLE;
                    }
                    else
                    {
                        title = VMIdentityConstants.OPEN_LDAP_TITLE;
                    }
                    _currentStep = WizardSteps.Two;
                }

                isUpdate = true;
            }
            else
            {
                title        = VMIdentityConstants.NEW_EXTERNAL_DOMAIN_TITLE;
                _currentStep = WizardSteps.One;
                isUpdate     = false;
            }
            this.Window.Title = (NSString)title;
            SetWizardStep();
            ReloadCertificates();

            //Events
            this.BtnTestConnection.Activated += TestConnection;
            this.BtnNext.Activated           += OnClickNextButton;
            this.BtnBack.Activated           += OnClickBackButton;
            this.BtnAddCertificate.Activated += (object sender, EventArgs e) => {
                var openPanel = new NSOpenPanel();
                openPanel.ReleasedWhenClosed = true;
                openPanel.Prompt             = "Select file";

                var result = openPanel.RunModal();
                if (result == 1)
                {
                    var filePath = openPanel.Url.AbsoluteString.Replace("file://", string.Empty);
                    var cert     = new X509Certificate2();
                    ActionHelper.Execute(delegate() {
                        cert.Import(filePath);
                        var certfificateDto = new CertificateDto {
                            Encoded = cert.ExportToPem(), Chain = cert.GetFormattedThumbPrint()
                        };
                        _certificates.Add(certfificateDto);
                        ReloadCertificates();
                    });
                }
            };

            this.RdoIdentitySource.Activated += (object sender, EventArgs e) =>
            {
                SetSpnControls();
            };
            this.RdoDomainController.Activated += (object sender, EventArgs e) =>
            {
                var anyDc = RdoDomainController.SelectedTag == 1;
                if (anyDc)
                {
                    SetConnectionString();
                }
                else
                {
                    TxtLdapConnection.StringValue = (NSString)string.Empty;
                }
                ChkProtect.Enabled = anyDc;
                EnableDisableConnectionString(!anyDc);
            };
            this.BtnRemoveCertificate.Activated += (object sender, EventArgs e) => {
                if (LstCertificates.SelectedRows.Count > 0)
                {
                    foreach (var row in LstCertificates.SelectedRows)
                    {
                        _certificates.RemoveAt((int)row);
                    }
                    ReloadCertificates();
                }
            };
            this.BtnPrimaryImport.Activated += (object sender, EventArgs e) => {
            };

            this.BtnSecondaryImport.Activated += (object sender, EventArgs e) => {
            };
            this.TxtDomainName.Changed        += (object sender, EventArgs e) => {
                SetConnectionString();
            };

            this.ChkProtect.Activated += (object sender, EventArgs e) => {
                SetConnectionString();
            };
            this.RdoSpn.Activated += (object sender, EventArgs e) => {
                SetSpnControls();
            };
            BtnPrimaryImport.Enabled      = false;
            BtnSecondaryImport.Enabled    = false;
            this.TxtPrimaryUrl.Activated += (object sender, EventArgs e) =>
            {
                BtnPrimaryImport.Enabled = this.TxtPrimaryUrl.StringValue != null && this.TxtPrimaryUrl.StringValue.StartsWith("ldaps://");
            };
            this.TxtSecondaryConnection.Activated += (object sender, EventArgs e) =>
            {
                BtnSecondaryImport.Enabled = this.TxtSecondaryConnection.StringValue != null && this.TxtSecondaryConnection.StringValue.StartsWith("ldaps://");
            };
            BtnPrimaryImport.Activated += (object sender, EventArgs e) =>
            {
                ImportCertificates(TxtPrimaryUrl.StringValue);
            };
            BtnSecondaryImport.Activated += (object sender, EventArgs e) =>
            {
                ImportCertificates(TxtSecondaryConnection.StringValue);
            };
            if (IdentityProviderDto != null)
            {
                DtoToView();
            }
            else
            {
                IdentityProviderDto = new IdentityProviderDto();
            }
            this.BtnAdvanced.Activated += (object sender, EventArgs e) =>
            {
                var form = new ExternalDomainAdvancedSettingsController()
                {
                    IdentityProviderDto = new IdentityProviderDto
                    {
                        Schema        = IdentityProviderDto.Schema == null ? new Dictionary <string, SchemaObjectMappingDto>() :new Dictionary <string, SchemaObjectMappingDto>(IdentityProviderDto.Schema),
                        AttributesMap = IdentityProviderDto.AttributesMap == null ?  new Dictionary <string, string>() : new Dictionary <string, string>(IdentityProviderDto.AttributesMap),
                        BaseDnForNestedGroupsEnabled = IdentityProviderDto.BaseDnForNestedGroupsEnabled,
                        MatchingRuleInChainEnabled   = IdentityProviderDto.MatchingRuleInChainEnabled,
                        DirectGroupsSearchEnabled    = IdentityProviderDto.DirectGroupsSearchEnabled
                    }
                };
                var result = NSApplication.SharedApplication.RunModalForWindow(form.Window);

                if (result == 1)
                {
                    IdentityProviderDto.Schema        = GetSchema(form.IdentityProviderDto.Schema);
                    IdentityProviderDto.AttributesMap = new Dictionary <string, string>(form.IdentityProviderDto.AttributesMap);
                    IdentityProviderDto.BaseDnForNestedGroupsEnabled = form.IdentityProviderDto.BaseDnForNestedGroupsEnabled;
                    IdentityProviderDto.MatchingRuleInChainEnabled   = form.IdentityProviderDto.MatchingRuleInChainEnabled;
                    IdentityProviderDto.DirectGroupsSearchEnabled    = form.IdentityProviderDto.DirectGroupsSearchEnabled;
                }
            };
            SetSpnControls();
        }
        private void GoToStep(WizardSteps step, object state, bool isNavigatingBack = false)
        {
            this.SuspendLayout();

            if (_previousControl != null)
            {
                this.contentPanel.Controls.Remove(_previousControl);
            }

            IWizardStep wizardStep = _steps[step];
            wizardStep.SetState(state, isNavigatingBack);

            Control wizardStepControl = (Control)wizardStep;
            wizardStepControl.Dock = DockStyle.Fill;

            this.contentPanel.Controls.Add(wizardStepControl);
            this.contentPanel.ResumeLayout(false);
            this.contentPanel.PerformLayout();
            this.ResumeLayout(false);

            _previousControl = wizardStepControl;
        }
Example #26
0
 public GoToWizardStepEventArgs(WizardSteps step, object state = null, bool isNavigatingBack = false)
 {
     this.GoTo             = step;
     this.State            = state;
     this.IsNavigatingBack = isNavigatingBack;
 }
Example #27
0
 /// <summary>
 /// Adds a step to the Wizard.  These are added in order.  To add items out of order use the WizardSteps property.
 /// </summary>
 /// <param name="step">The IWizardStep to add.</param>
 public void AddStep(IWizardStep step)
 {
     WizardSteps.Add(step);
 }
		private void SetNextStep()
		{
			if (_currentStep == WizardSteps.One && RdoIdentitySource.SelectedRow == 0) {
				_currentStep = WizardSteps.Four;
			} else {	
				if (_currentStep == WizardSteps.Two && IsUnsecuredConnection ()) {
					_currentStep = WizardSteps.Four;
				} else {
					_currentStep++;
				}
			}
		}
 public GoToWizardStepEventArgs(WizardSteps step, object state = null, bool isNavigatingBack =false)
 {
     this.GoTo = step;
     this.State = state;
     this.IsNavigatingBack = isNavigatingBack;
 }
		public override void AwakeFromNib ()
		{
			base.AwakeFromNib ();
			_certificates = new List<CertificateDto> ();
			_currentStep = WizardSteps.One;
			SetWizardStep ();
			ReloadCertificates ();

			//Events
			this.BtnTestConnection.Activated += TestConnection;
			this.BtnNext.Activated += OnClickNextButton;
			this.BtnBack.Activated += OnClickBackButton;
			this.BtnAddCertificate.Activated +=	(object sender, EventArgs e) => {
				var openPanel = new NSOpenPanel();
				openPanel.ReleasedWhenClosed = true;
				openPanel.Prompt = "Select file";

				var result = openPanel.RunModal();
				if (result == 1)
				{
					var filePath = openPanel.Url.AbsoluteString.Replace("file://",string.Empty);
					var cert = new X509Certificate2 ();
					ActionHelper.Execute (delegate() {
						cert.Import (filePath);
						var certfificateDto = new CertificateDto { Encoded = cert.ToPem(), Chain = cert.GetFormattedThumbPrint()};
						_certificates.Add(certfificateDto);
						ReloadCertificates();
					});
				}
			};

			this.RdoIdentitySource.Activated += (object sender, EventArgs e) => 
			{
				SetSpnControls();
			};
			this.RdoDomainController.Activated += (object sender, EventArgs e) => 
			{
				var anyDc = RdoDomainController.SelectedTag == 1;
				if(anyDc)
				{
					SetConnectionString();
				}
				else
				{
					TxtLdapConnection.StringValue = (NSString) string.Empty;
				}
				ChkProtect.Enabled = anyDc;
				EnableDisableConnectionString(!anyDc);
			};
			this.BtnRemoveCertificate.Activated += (object sender, EventArgs e) => {
				if (LstCertificates.SelectedRows.Count > 0) {
					foreach (var row in LstCertificates.SelectedRows) {
						_certificates.RemoveAt ((int)row);
					}
					ReloadCertificates();
				}
			};
			this.BtnPrimaryImport.Activated += (object sender, EventArgs e) => {
				
			};

			this.BtnSecondaryImport.Activated += (object sender, EventArgs e) => {

			};
			this.TxtDomainName.Changed += (object sender, EventArgs e) => {
				SetConnectionString();
			};

			this.ChkProtect.Activated += (object sender, EventArgs e) => {
				SetConnectionString();
			};
			this.RdoSpn.Activated += (object sender, EventArgs e) => {
				SetSpnControls();
			};
			BtnPrimaryImport.Enabled = false;
			BtnSecondaryImport.Enabled = false;
			this.TxtPrimaryUrl.Activated += (object sender, EventArgs e) => 
			{
				BtnPrimaryImport.Enabled = this.TxtPrimaryUrl.StringValue!= null && this.TxtPrimaryUrl.StringValue.StartsWith("ldaps://");
			};
			this.TxtSecondaryConnection.Activated += (object sender, EventArgs e) => 
			{
				BtnSecondaryImport.Enabled = this.TxtSecondaryConnection.StringValue!= null && this.TxtSecondaryConnection.StringValue.StartsWith("ldaps://");
			};
			BtnPrimaryImport.Activated += (object sender, EventArgs e) => 
			{
				ImportCertificates(TxtPrimaryUrl.StringValue);
			};
			BtnSecondaryImport.Activated += (object sender, EventArgs e) => 
			{
				ImportCertificates(TxtSecondaryConnection.StringValue);
			};
			if (IdentityProviderDto != null)
				DtoToView ();
			else
				IdentityProviderDto = new IdentityProviderDto ();
			this.BtnAdvanced.Activated += (object sender, EventArgs e) => 
			{
				var form = new ExternalDomainAdvancedSettingsController ()
				{
					IdentityProviderDto = new IdentityProviderDto
					{
						Schema = IdentityProviderDto.Schema == null ? new Dictionary<string, SchemaObjectMappingDto>() :new Dictionary<string, SchemaObjectMappingDto>(IdentityProviderDto.Schema),
						AttributesMap = IdentityProviderDto.AttributesMap == null ?  new Dictionary<string, string>() : new Dictionary<string, string>(IdentityProviderDto.AttributesMap),
						BaseDnForNestedGroupsEnabled = IdentityProviderDto.BaseDnForNestedGroupsEnabled,
						MatchingRuleInChainEnabled = IdentityProviderDto.MatchingRuleInChainEnabled,
						DirectGroupsSearchEnabled = IdentityProviderDto.DirectGroupsSearchEnabled
					}
				};
				var result = NSApplication.SharedApplication.RunModalForWindow (form.Window);

				if(result == 1)
				{
					IdentityProviderDto.Schema = GetSchema(form.IdentityProviderDto.Schema);
					IdentityProviderDto.AttributesMap = new Dictionary<string, string>(form.IdentityProviderDto.AttributesMap);
					IdentityProviderDto.BaseDnForNestedGroupsEnabled = form.IdentityProviderDto.BaseDnForNestedGroupsEnabled;
					IdentityProviderDto.MatchingRuleInChainEnabled = form.IdentityProviderDto.MatchingRuleInChainEnabled;
					IdentityProviderDto.DirectGroupsSearchEnabled = form.IdentityProviderDto.DirectGroupsSearchEnabled;
				}
			};
			SetSpnControls ();
		}
        internal WizardStepItem(TranslationProvider Provider, string name, string Parent)
        {
            Step = (WizardSteps)Enum.Parse(typeof(WizardSteps), name);
            string trName = "!" + name;
            TranslatedName = Provider.Translate(trName, Parent);
            TranslatedDescription = Provider.Translate(trName + "_Description", Parent);

            if (TranslatedName == null)
                TranslatedName = "!!Missing: " + trName;
            if (TranslatedDescription == null)
                TranslatedDescription = "!!Missing: " + trName + "_Description";
        }