public void RunStarted(object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams) { bool?success = false; try { string targetFolderPath = "", projectFolderPath = "", projectFullName = ""; GetSelectionData(automationObject, ref targetFolderPath, ref projectFolderPath, ref projectFullName); var itemName = Regex.Replace(replacementsDictionary["$rootname$"], @"[\.\-\s]?component", "", RegexOptions.IgnoreCase); if (string.IsNullOrWhiteSpace(itemName)) { itemName = "my"; } var wnd = new AngularComponentWizardWindow(); wnd.compName.Text = itemName; ReadSettings(wnd, projectFullName); InitWizard(wnd, automationObject, replacementsDictionary, runKind, customParams); success = wnd.ShowDialog(); if (success == true) { SaveSettings(wnd, projectFullName); if (wnd.createCompFolder.IsChecked != true) { wnd.compFolderName.Text = ""; } else { wnd.compFolderName.Text += "\\"; } var compFolderPath = Path.Combine(targetFolderPath, wnd.compFolderName.Text); var nodeModulesRelativePath = new Uri(compFolderPath).MakeRelativeUri( new Uri(Path.Combine(projectFolderPath, node_modules))); replacementsDictionary.Add($"${nameof(wnd.compFolderName)}$", wnd.compFolderName.Text); replacementsDictionary.Add($"${nameof(compFolderPath)}$", compFolderPath); replacementsDictionary.Add($"${nameof(nodeModulesRelativePath)}$", nodeModulesRelativePath.OriginalString); replacementsDictionary.Add($"${nameof(wnd.compName)}$", wnd.compName.Text); replacementsDictionary.Add($"${nameof(wnd.compSelector)}$", wnd.compSelector.Text); replacementsDictionary.Add($"${nameof(wnd.compSelectorPrefix)}$", wnd.compSelectorPrefix.Text); replacementsDictionary.Add($"${nameof(wnd.compClassName)}$", wnd.compClassName.Text); replacementsDictionary.Add($"${nameof(wnd.compTemplateFileName)}$", wnd.compTemplateFileName.Text); replacementsDictionary.Add($"${nameof(wnd.compClassFileName)}$", wnd.compClassFileName.Text); replacementsDictionary.Add($"${nameof(wnd.compClassFileName)}WithoutExtension$", Path.GetFileNameWithoutExtension(wnd.compClassFileName.Text)); replacementsDictionary.Add($"${nameof(wnd.compStyleFileName)}$", wnd.compStyleFileName.Text); replacementsDictionary.Add($"${nameof(wnd.compTestFileName)}$", wnd.compTestFileName.Text); files.Add(fileNames[ComponentFile.Class], wnd.createCompClassFile.IsChecked.GetValueOrDefault()); files.Add(fileNames[ComponentFile.Template], wnd.createCompTemplateFile.IsChecked.GetValueOrDefault()); files.Add(fileNames[ComponentFile.Style], wnd.createCompStyleFile.IsChecked.GetValueOrDefault()); files.Add(fileNames[ComponentFile.Test], wnd.createCompTestFile.IsChecked.GetValueOrDefault()); } } catch (Exception ex) { success = false; MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } if (success != true) { throw new WizardCancelledException(); } }