protected override void InitWizard(AngularComponentWizardWindow wnd, object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
 {
     base.InitWizard(wnd, automationObject, replacementsDictionary, runKind, customParams);
     wnd.createCompFolder.IsChecked       = false;
     wnd.createCompStyleFile.IsChecked    = false;
     wnd.createCompClassFile.IsChecked    = false;
     wnd.createCompTemplateFile.IsChecked = false;
 }
Exemple #2
0
        protected virtual void SaveSettings(AngularComponentWizardWindow wnd, string projectFullName)
        {
            var store = GetProjectSettingsStore(projectFullName);

            store.SetString(projectSettingsCollection, nameof(wnd.compStyleLanguage), $"{wnd.compStyleLanguage.SelectedValue}");
            store.SetString(projectSettingsCollection, nameof(wnd.compSelectorPrefix), $"{wnd.compSelectorPrefix.Text}");
            store.SetBoolean(projectSettingsCollection, nameof(wnd.createCompClassFile), wnd.createCompClassFile.IsChecked.GetValueOrDefault());
            store.SetBoolean(projectSettingsCollection, nameof(wnd.createCompFolder), wnd.createCompFolder.IsChecked.GetValueOrDefault());
            store.SetBoolean(projectSettingsCollection, nameof(wnd.createCompStyleFile), wnd.createCompStyleFile.IsChecked.GetValueOrDefault());
            store.SetBoolean(projectSettingsCollection, nameof(wnd.createCompTemplateFile), wnd.createCompTemplateFile.IsChecked.GetValueOrDefault());
            store.SetBoolean(projectSettingsCollection, nameof(wnd.createCompTestFile), wnd.createCompTestFile.IsChecked.GetValueOrDefault());
        }
Exemple #3
0
        protected virtual void ReadSettings(AngularComponentWizardWindow wnd, string projectFullName)
        {
            var store = GetProjectSettingsStore(projectFullName);

            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.compStyleLanguage)))
            {
                var styleLanguage = store.GetString(projectSettingsCollection, nameof(wnd.compStyleLanguage));
                if (Enum.TryParse <StylesheetLanguage>(styleLanguage, out var result))
                {
                    wnd.compStyleLanguage.SelectedValue = result;
                    wnd.UpdateFields();
                }
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.compSelectorPrefix)))
            {
                wnd.compSelectorPrefix.Text = store.GetString(projectSettingsCollection, nameof(wnd.compSelectorPrefix));
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.createCompClassFile)))
            {
                wnd.createCompClassFile.IsChecked = store.GetBoolean(projectSettingsCollection, nameof(wnd.createCompClassFile));
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.createCompFolder)))
            {
                wnd.createCompFolder.IsChecked = store.GetBoolean(projectSettingsCollection, nameof(wnd.createCompFolder));
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.createCompStyleFile)))
            {
                wnd.createCompStyleFile.IsChecked = store.GetBoolean(projectSettingsCollection, nameof(wnd.createCompStyleFile));
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.createCompTemplateFile)))
            {
                wnd.createCompTemplateFile.IsChecked = store.GetBoolean(projectSettingsCollection, nameof(wnd.createCompTemplateFile));
            }
            if (store.PropertyExists(projectSettingsCollection, nameof(wnd.createCompTestFile)))
            {
                wnd.createCompTestFile.IsChecked = store.GetBoolean(projectSettingsCollection, nameof(wnd.createCompTestFile));
            }
        }
Exemple #4
0
        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();
            }
        }
Exemple #5
0
 protected virtual void InitWizard(AngularComponentWizardWindow wnd, object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
 {
 }
 protected override void InitWizard(AngularComponentWizardWindow wnd, object automationObject, Dictionary <string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
 {
     wnd.compStyleLanguage.SelectedValue = StylesheetLanguage.LESS;
     base.InitWizard(wnd, automationObject, replacementsDictionary, runKind, customParams);
 }
 protected override void SaveSettings(AngularComponentWizardWindow wnd, string projectFullName)
 {
 }