public override void Execute() { WizardRunCmdletBase cmdlet = (WizardRunCmdletBase)Cmdlet; WizardHelper.InvokeWizard(cmdlet); }
public void Init() { helper = new WizardHelper(); controllerContext = repository.DynamicMock<IControllerContext>(); engineContext = repository.DynamicMock<IEngineContext>(); controller = repository.DynamicMock<IController>(); wizardStepPage = repository.DynamicMock<IWizardStepPage>(); }
public void Init() { helper = new WizardHelper(); controllerContext = repository.DynamicMock <IControllerContext>(); engineContext = repository.DynamicMock <IEngineContext>(); controller = repository.DynamicMock <IController>(); wizardStepPage = repository.DynamicMock <IWizardStepPage>(); }
public void OnFocus() { // Display the contents of the current SyncScope for review this.displayBox.Text = "Running SyncSvcUtil command...\n"; this.displayBox.Text += WizardHelper.ExecuteProcessAndReturnLog( string.Format(WizardHelper.PROV_PARAM_FORMAT, WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.CONFIG_FILE_NAME], WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_PROV_MODE], WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_CONFIG_NAME], WizardHelper.Instance.ProvisioningWizardHelper[WizardHelper.SELECTED_DB_NAME])); }
private void SetUpWizardHelper(Controller controller) { if (controller == null) { return; } WizardHelper helper = new WizardHelper(); helper.SetController(controller); controller.Helpers["wizardhelper"] = helper; }
// This method is only called for item templates, // not for project templates. public void ProjectItemFinishedGenerating(ProjectItem projectItem) { // Add the module reference.., if (this.Name == "PriCustomForm.cs" || this.Name == "PriCustomForm.vb") { // Add the module reference.., WizardHelper.AddModuleReference(projectItem.ContainingProject, "Primavera.Extensibility.CustomForm"); WizardHelper.AddModuleReference(projectItem.ContainingProject, "DevExpress.Utils.v18.1"); } else { WizardHelper.AddModuleReference(projectItem.ContainingProject, "Primavera.Extensibility.CustomCode"); } }
protected override bool OnFinish(IWizardHostService host) { bool retVal = base.OnFinish(host); WizardPage firstPageWithError = WizardHelper.GetErrorPage(this.Host, this.Pages); if (firstPageWithError != null) { if (host.CurrentWizard.CurrentPage != firstPageWithError) { host.CurrentWizard.CurrentPage = firstPageWithError; } retVal = false; } return(retVal); }
private void SetUpWizardHelper(IEngineContext engineContext, IWizardController wizController, IController controller, IControllerContext controllerContext) { if (controller == null) { return; } var helper = new WizardHelper { WizardController = wizController }; helper.SetContext(engineContext); helper.SetController(controller, controllerContext); controllerContext.Helpers.Add(helper); }
// This method is only called for item templates, // not for project templates. public void ProjectItemFinishedGenerating(ProjectItem projectItem) { foreach (MyTreeNode type in selectedTypes) { this.SelectedNode = type; if (this.Name == "PriCustomTab.cs" || this.Name == "PriCustomTab.vb") { WizardHelper.AddModuleReference(projectItem.ContainingProject, "Primavera.Extensibility.CustomTab"); } // Add the module reference.., WizardHelper.AddModuleReference(projectItem.ContainingProject, "Primavera.Extensibility." + type.Module); ProjectItemsEvents_ItemAdded(projectItem); // Add dependencies to the select modules. WizardHelper.AddDependenciesReference(projectItem.ContainingProject, type.Module); } }
/// <summary> /// Called whenever a FilterColumn is unchecked from the UI. Removed the particular filter from the uber filter clause. /// Does the following /// 1. Remove from FilterColumns /// 2. Remove from FilterParameters /// 3. Remove text from FilterClause /// </summary> /// <param name="table">Table for which the filter param applies to</param> /// <param name="colConfig">The actual column being unchecked</param> private void RemoveFilterColumnInfo(SyncTableConfigElement table, SyncColumnConfigElement colConfig) { var filterParamName = "@" + WizardHelper.SanitizeName(colConfig.Name); var andFilterClause = string.Format(AndFilterClauseFormat, colConfig.Name, filterParamName); var FilterClause = string.Format(FilterClauseFormat, colConfig.Name, filterParamName); // Remove from Filter columns table.FilterColumns.Remove(colConfig.Name); //Remove from Filter parameters table.FilterParameters.Remove(filterParamName); // Check to see if you can remove the filter clause table.FilterClause = table.FilterClause.Replace(andFilterClause, string.Empty); table.FilterClause = table.FilterClause.Replace(FilterClause, string.Empty); if (table.FilterClause.StartsWith(" AND ")) { table.FilterClause = table.FilterClause.Substring(5); } }
public void OnFocus() { string sourceSpecificParams = null; string commonParams = null; if (WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CODEGEN_SOURCE] == WizardHelper.CONFIG_FILE_CODEGEN_SOURCE) { // Display the contents of the current SyncScope for review this.displayBox.Text = "Running SyncSvcUtil command...\n"; sourceSpecificParams = string.Format(WizardHelper.CONFIG_CODEGEN_PARAM_FORMAT, WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CONFIG_FILE_NAME], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CONFIG_NAME], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_DB_NAME]); } else { sourceSpecificParams = string.Format(WizardHelper.CSDL_CODEGEN_PARAM_FORMAT, WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CSDL_CODEGEN_URL], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.SELECTED_CONFIG_NAME]); } commonParams = string.Format(WizardHelper.CODEGEN_COMMON_PARAMS_FORMAT, WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_LANGUAGE], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_NAMESPACE], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_TARGET], WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTDIRECTORY]); if (!string.IsNullOrEmpty(WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTPREFIX])) { commonParams = string.Format(WizardHelper.CODEGEN_OUTPREFIX_PARAM_FORMAT, commonParams, WizardHelper.Instance.CodeGenWizardHelper[WizardHelper.CODEGEN_OUTPREFIX]); } this.displayBox.Text += WizardHelper.ExecuteProcessAndReturnLog(sourceSpecificParams + commonParams); }
public void ProjectFinishedGenerating(Project project) { if (selectedTypes != null) { string validationErrors = string.Empty; string itemPath = null; string fileExtension = null; EnvDTE80.Events2 objEvents2; EnvDTE80.Solution2 solution = project.DTE.Solution as EnvDTE80.Solution2; OutputWindowManager outPutWindowmng = new OutputWindowManager(); // Subscribe all the IDE events envDTE = project.DTE; objEvents2 = ((EnvDTE80.Events2)(envDTE.Events)); // Subscribe the item added event projectItemsEvents = objEvents2.ProjectItemsEvents; projectItemsEvents.ItemAdded += ProjectItemsEvents_ItemAdded; // Write the post-build command to register the assembly. if (VSOptionsValidator.CanCreatePostBuildEvent(ref validationErrors)) { // Build the command to call. string erpPath = Path.Combine(GeneralOptions.Instance.Path, "RegisterExtension.exe"); if (File.Exists(erpPath)) { // Add command-line parameters. string command = $"Call {string.Format("\"{0}\"", erpPath)} " + $" {GeneralOptions.Instance.Company} {GeneralOptions.Instance.UserName}" + $" {GeneralOptions.Instance.Password} {GeneralOptions.Instance.ProductLine}" + $" $(TargetPath) {GeneralOptions.Instance.CommonExtension}"; EnvDTE.Properties configmg = project.Properties; configmg.Item("PostBuildEvent").Value = command; outPutWindowmng.WriteMessage("The post-build command was added to the project.", OutputWindowMessagesType.Message); // Set start external program string erpEpp = string.Format("Erp100L{0}.exe", GeneralOptions.Instance.ProductLine == 0 ? "E" : "P"); Configuration activeConfig = project.ConfigurationManager.ActiveConfiguration; activeConfig.Properties.Item("StartAction").Value = prjStartAction.prjStartActionProgram; activeConfig.Properties.Item("StartProgram").Value = Path.Combine(GeneralOptions.Instance.Path, erpEpp); outPutWindowmng.WriteMessage("The start external program was set.", OutputWindowMessagesType.Message); } else { StringBuilder msg = new StringBuilder(); msg.Append("The post-build command could not be registered. \n"); msg.Append("The command line utility does not exist on the folder."); msg.Append(GeneralOptions.Instance.Path); msg.Append("Download it from https://developers.primaverabss.com/v10/como-automatizar-registo-extensoes/ \n"); outPutWindowmng.WriteMessage(msg.ToString(), OutputWindowMessagesType.Error); } } else { outPutWindowmng.WriteMessage("The post-build event has not been configured because of the following validation issues:", OutputWindowMessagesType.Warning); outPutWindowmng.WriteMessage(validationErrors, OutputWindowMessagesType.Message); outPutWindowmng.WriteMessage("Check this on Tools | Options | PRIMAVERA Extensibility.", OutputWindowMessagesType.Message); } if (project.Kind == PrjKind.prjKindCSharpProject) { itemPath = solution.GetProjectItemTemplate("PriClass.zip", "CSharp"); fileExtension = ".cs"; } else { itemPath = solution.GetProjectItemTemplate("PriClass.zip", "VisualBasic"); fileExtension = ".vb"; } if (!String.IsNullOrEmpty(itemPath)) { // Add generic references WizardHelper.AddBaseReferences(project, "Bas", GeneralOptions.Instance.Path); WizardHelper.AddBaseReferences(project, "Ext", GeneralOptions.Instance.Path); foreach (MyTreeNode type in selectedTypes) { this.SelectedNode = type; ProjectItem rootFolder = project.ProjectItems.Cast <ProjectItem>() .FirstOrDefault(i => i.Name == type.Module) ?? project.ProjectItems.AddFolder(type.Module); // Add the module reference. WizardHelper.AddModuleReference(project, "Primavera.Extensibility." + type.Module); // Add dependencies to the select modules. WizardHelper.AddDependenciesReference(project, type.Module); switch (type.ModuleType) { case "Editors": rootFolder.ProjectItems.AddFromTemplate(itemPath, "Ui" + type.ClassName + fileExtension); break; case "Services": rootFolder.ProjectItems.AddFromTemplate(itemPath, "Api" + type.ClassName + fileExtension); break; } } } outPutWindowmng.WriteMessage("The project was created with success."); // UnSubscribing event. projectItemsEvents.ItemAdded -= ProjectItemsEvents_ItemAdded; } }
/// <summary> /// Called whenever a checkbox from the list of columns (sync/filter) is checked or unchecked /// If Column index is 1 then its a sync column /// If column is removed then remove from sync columns collection. Also disable the column if it was a filter column. /// Disable the filter col checkbox so it cannot be added as a filter without adding it as a sync column first /// If column is enabled then add it to sync columns collection. Enable filter col checkbox so it can be clicked /// If Column index is 2 then its a filter column. /// If filter col is disabled then remove the column from filter params/clause/columns collection /// If filter col is enabled then add the column to the filter params/clause/columns collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void colsView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { var table = selectedScope.SyncTables.GetElement(tablesBox.SelectedItem.ToString()); if (e.ColumnIndex > 0) { // Check to see if its a column being added/removed from sync var cell = colsView.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewCheckBoxCell; var col = tableDesc.Columns[e.RowIndex]; if (e.ColumnIndex == 1) { if (cell.Value == null || !(bool)cell.Value) { // Sync column unchecked var colConfig = table.SyncColumns.GetElement(colsView.Rows[e.RowIndex].Cells[0].Value.ToString()); if (colConfig != null) { table.SyncColumns.Remove(colConfig.Name); RemoveFilterColumnInfo(table, colConfig); colsView.Rows[e.RowIndex].Cells[2].Value = false; // Make filter col readonly colsView.Rows[e.RowIndex].Cells[2].ReadOnly = true; } } else if (table.SyncColumns.GetElement(col.UnquotedName) == null) { // Sync column is checked. Add it back to the SyncColumn list var colConfig = new SyncColumnConfigElement { Name = col.UnquotedName, IsPrimaryKey = false, IsNullable = col.IsNullable, SqlType = col.Type }; table.SyncColumns.Add(colConfig); // Set the filter col to enabled. colsView.Rows[e.RowIndex].Cells[2].ReadOnly = false; } table.IncludeAllColumns = table.SyncColumns.Count == colsView.Rows.Count; } else { // Its a filter column var colConfig = table.SyncColumns.GetElement(colsView.Rows[e.RowIndex].Cells[0].Value.ToString()); if (colConfig != null) { var filterParamName = "@" + WizardHelper.SanitizeName(colConfig.Name); var andFilterClause = string.Format(AndFilterClauseFormat, colConfig.Name, filterParamName); var FilterClause = string.Format(FilterClauseFormat, colConfig.Name, filterParamName); if (cell.Value != null && !(bool)cell.Value) { // Filter column unchecked RemoveFilterColumnInfo(table, colConfig); } else if (table.FilterColumns.GetElement(colConfig.Name) == null) { // Add Filter column table.FilterColumns.Add(new FilterColumnConfigElement { Name = colConfig.Name }); // Add Filter parameter table.FilterParameters.Add(new FilterParameterConfigElement { Name = filterParamName, SqlType = tableDesc.Columns[e.RowIndex].Type }); if ((tableDesc.Columns[e.RowIndex].SizeSpecified)) { // Set size table.FilterParameters.GetElementAt(table.FilterParameters.Count - 1).DataSize = int.Parse(tableDesc.Columns[e.RowIndex].Size); } if (string.IsNullOrEmpty(table.FilterClause)) { table.FilterClause = string.Format(FilterClauseFormat, colConfig.Name, filterParamName); } else { table.FilterClause += string.Format(AndFilterClauseFormat, colConfig.Name, filterParamName); } } } filterClauseTxtBox.Text = table.FilterClause; } } }
public void ProjectFinishedGenerating(Project project) { if (_selectedTypes != null) { string _validationErrors = string.Empty; string _itemPath = null; string _fileExtension = null; EnvDTE80.Events2 _objEvents2; EnvDTE80.Solution2 _solution = project.DTE.Solution as EnvDTE80.Solution2; OutputWindowManager outPutWindowmng = new OutputWindowManager(); // Subscribe all the IDE events _envDTE = project.DTE; _objEvents2 = ((EnvDTE80.Events2)(_envDTE.Events)); // Write the post-build command to register the assembly. if (VSOptionsValidator.CanCreatePostBuildEvent(ref _validationErrors)) { // Add command-line parameters. string command = $"copy /Y \"$(TargetPath)\" \"{WebApiOptions.Instance.Path}\\$(ProjectName).dll\""; EnvDTE.Properties configmg = project.Properties; configmg.Item("PostBuildEvent").Value = command; outPutWindowmng.WriteMessage("The post-build command was added to the project.", OutputWindowMessagesType.Message); } else { outPutWindowmng.WriteMessage("The post-build event has not been configured because of the following validation issues:", OutputWindowMessagesType.Warning); outPutWindowmng.WriteMessage(_validationErrors, OutputWindowMessagesType.Message); outPutWindowmng.WriteMessage("Check this on Tools | Options | PRIMAVERA Extensibility.", OutputWindowMessagesType.Message); } if (project.Kind == PrjKind.prjKindCSharpProject) { _itemPath = _solution.GetProjectItemTemplate("PriWebApiControler.zip", "CSharp"); _fileExtension = ".cs"; } else { _itemPath = _solution.GetProjectItemTemplate("PriWebApiControler.zip", "VisualBasic"); _fileExtension = ".vb"; } // Add folder to keep all controllers. ProjectItem rootFolder = project.ProjectItems.AddFolder("Controllers"); // Add the class to the project. rootFolder.ProjectItems.AddFromTemplate(_itemPath, _controllerName + _fileExtension); // Add generic references //WizardHelper.AddApiBaseDependencies(project); WizardHelper.AddBaseReferences(project, "Bas", GeneralOptions.Instance.Path); WizardHelper.AddBaseReferences(project, "Api", WebApiOptions.Instance.Path); // Add references to the select modules foreach (TreeNode type in _selectedTypes) { if (!String.IsNullOrEmpty(_itemPath)) { // Add dependencies to the select modules. WizardHelper.AddDependenciesReference(project, type.Text); } } outPutWindowmng.WriteMessage("The project was created with success."); } }
public WelcomePage() { InitializeComponent(); _image.Source = WizardHelper.GetWizardIcon(); }
private void SetUpWizardHelper(IEngineContext engineContext, IWizardController wizController, IController controller, IControllerContext controllerContext) { if (controller == null) { return; } var helper = new WizardHelper { WizardController = wizController }; helper.SetContext(engineContext); helper.SetController(controller, controllerContext); controllerContext.Helpers.Add(helper); }
/// <summary> /// Called whenever a checkbox from the list of columns (sync/filter) is checked or unchecked /// If Column index is 1 then its a sync column /// If column is removed then remove from sync columns collection. Also disable the column if it was a filter column. /// Disable the filter col checkbox so it cannot be added as a filter without adding it as a sync column first /// If column is enabled then add it to sync columns collection. Enable filter col checkbox so it can be clicked /// If Column index is 2 then its a filter column. /// If filter col is disabled then remove the column from filter params/clause/columns collection /// If filter col is enabled then add the column to the filter params/clause/columns collection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void colsView_CellEndEdit(object sender, DataGridViewCellEventArgs e) { SyncTableConfigElement table = selectedScope.SyncTables.GetElement(this.tablesBox.SelectedItem.ToString()); if (e.ColumnIndex > 0) { // Check to see if its a column being added/removed from sync DataGridViewCheckBoxCell cell = this.colsView.Rows[e.RowIndex].Cells[e.ColumnIndex] as DataGridViewCheckBoxCell; DbSyncColumnDescription col = tableDesc.Columns[e.RowIndex]; if (e.ColumnIndex == 1) { if (cell.Value == null || !(bool)cell.Value) { // Sync column unchecked SyncColumnConfigElement colConfig = table.SyncColumns.GetElement(this.colsView.Rows[e.RowIndex].Cells[0].Value.ToString()); if (colConfig != null) { table.SyncColumns.Remove(colConfig.Name); this.RemoveFilterColumnInfo(table, colConfig); this.colsView.Rows[e.RowIndex].Cells[2].Value = false; // Make filter col readonly this.colsView.Rows[e.RowIndex].Cells[2].ReadOnly = true; } } else if (table.SyncColumns.GetElement(col.UnquotedName) == null) { // Sync column is checked. Add it back to the SyncColumn list SyncColumnConfigElement colConfig = new SyncColumnConfigElement() { Name = col.UnquotedName, IsPrimaryKey = false, IsNullable = col.IsNullable, SqlType = col.Type, }; table.SyncColumns.Add(colConfig); // Set the filter col to enabled. this.colsView.Rows[e.RowIndex].Cells[2].ReadOnly = false; } table.IncludeAllColumns = table.SyncColumns.Count == colsView.Rows.Count; } else { // Its a filter column SyncColumnConfigElement colConfig = table.SyncColumns.GetElement(colsView.Rows[e.RowIndex].Cells[0].Value.ToString()); if (colConfig != null) { string filterParamName = "@" + WizardHelper.SanitizeName(colConfig.Name); string andFilterClause = string.Format(AndFilterClauseFormat, colConfig.Name, filterParamName); string FilterClause = string.Format(FilterClauseFormat, colConfig.Name, filterParamName); if (cell.Value != null && !(bool)cell.Value) { // Filter column unchecked this.RemoveFilterColumnInfo(table, colConfig); } else if (table.FilterColumns.GetElement(colConfig.Name) == null) { // Add Filter column table.FilterColumns.Add(new FilterColumnConfigElement() { Name = colConfig.Name }); // Add Filter parameter table.FilterParameters.Add(new FilterParameterConfigElement() { Name = filterParamName, SqlType = tableDesc.Columns[e.RowIndex].Type, }); // Fix by xperiandi, Thks ! if ((tableDesc.Columns[e.RowIndex].SizeSpecified)) { // Set size DbSyncColumnDescription column = tableDesc.Columns[e.RowIndex]; string columnsSize = column.Size; if (string.Compare(columnsSize, "max", StringComparison.OrdinalIgnoreCase) == 0 && (string.Compare(column.Type, "nvarchar", StringComparison.OrdinalIgnoreCase) * string.Compare(column.Type, "varchar", StringComparison.OrdinalIgnoreCase)) == 0) { table.FilterParameters.GetElementAt(table.FilterParameters.Count - 1).DataSize = 4000; } else { table.FilterParameters.GetElementAt(table.FilterParameters.Count - 1).DataSize = int.Parse(columnsSize); } } if (string.IsNullOrEmpty(table.FilterClause)) { table.FilterClause = string.Format(FilterClauseFormat, colConfig.Name, filterParamName); } else { table.FilterClause += string.Format(AndFilterClauseFormat, colConfig.Name, filterParamName); } } } this.filterClauseTxtBox.Text = table.FilterClause; } } }