Esempio n. 1
0
        private void AddGlobalParam(object sender, RoutedEventArgs e)
        {
            GlobalAppModelParameter newModelGlobalParam = new GlobalAppModelParameter();

            SetUniquePlaceHolderName(newModelGlobalParam);

            string newParamPlaceholder = newModelGlobalParam.PlaceHolder;

            while (InputBoxWindow.GetInputWithValidation("Add Model Global Parameter", "Parameter Name:", ref newParamPlaceholder, System.IO.Path.GetInvalidPathChars().Where(c => c != '<' && c != '>').ToArray <char>()))
            {
                newModelGlobalParam.PlaceHolder = newParamPlaceholder;
                if (!IsParamPlaceholderNameConflict(newModelGlobalParam))
                {
                    newModelGlobalParam.OptionalValuesList.Add(new OptionalValue()
                    {
                        Value = GlobalAppModelParameter.CURRENT_VALUE, IsDefault = true
                    });
                    WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newModelGlobalParam);
                    newModelGlobalParam.StartDirtyTracking();

                    //making sure rows numbers are ok
                    xModelsGlobalParamsGrid.Grid.UpdateLayout();
                    xModelsGlobalParamsGrid.Renum();
                    break;
                }
            }
        }
Esempio n. 2
0
        private void RenameTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string originalName  = mTreeView.Tree.GetSelectedTreeNodeName();
            string newFolderName = originalName;

            if (InputBoxWindow.GetInputWithValidation("Rename Folder", "New Folder Name:", ref newFolderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(newFolderName))
                {
                    string path = Path.Combine(Path.GetDirectoryName(this.NodePath().TrimEnd('\\', '/')), newFolderName);
                    if (System.IO.Directory.Exists(path) == true && originalName.ToUpper() != newFolderName.ToUpper())
                    {
                        Reporter.ToUser(eUserMsgKey.FolderExistsWithName);
                        return;
                    }
                    else
                    {
                        try
                        {
                            if (RenameTreeFolder(originalName, newFolderName, path) == false)
                            {
                                Reporter.ToUser(eUserMsgKey.RenameItemError, path);
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            Reporter.ToUser(eUserMsgKey.RenameItemError, ex.Message);
                            Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}", ex);
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        public static RunSetConfig CreateNewRunset(string runSetName = "", RepositoryFolder <RunSetConfig> runSetsFolder = null)
        {
            if (string.IsNullOrEmpty(runSetName))
            {
                if (!InputBoxWindow.GetInputWithValidation(string.Format("Add New {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)), string.Format("{0} Name:", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ref runSetName, System.IO.Path.GetInvalidPathChars()))
                {
                    return(null);
                }
            }

            RunSetConfig runSetConfig = new RunSetConfig();

            runSetConfig.Name = runSetName;
            runSetConfig.GingerRunners.Add(new GingerRunner()
            {
                Name = "Runner 1"
            });

            if (runSetsFolder == null)
            {
                WorkSpace.Instance.SolutionRepository.AddRepositoryItem(runSetConfig);
            }
            else
            {
                runSetsFolder.AddRepositoryItem(runSetConfig);
            }

            return(runSetConfig);
        }
 private void AddSingleAPIModel(ApplicationAPIUtils.eWebApiType type)
 {
     string apiName = string.Empty; ;
     if (InputBoxWindow.GetInputWithValidation(string.Format("Add {0} API",type.ToString()), "API Name:", ref apiName, System.IO.Path.GetInvalidPathChars()))
     {
         ApplicationAPIModel newApi = new ApplicationAPIModel();
         newApi.APIType = type;
         newApi.Name = apiName;
         newApi.ContainingFolder = mAPIModelFolder.FolderFullPath;              
         mAPIModelFolder.AddRepositoryItem(newApi);                            
     }
 }
Esempio n. 5
0
        private void MergeSelectedParams(object sender, RoutedEventArgs e)
        {
            if (ModelParametersGrid.Grid.SelectedItems.Count < 1)
            {
                return;
            }

            string newParamName = ((AppModelParameter)ModelParametersGrid.Grid.SelectedItems[0]).PlaceHolder;

            if (InputBoxWindow.GetInputWithValidation("Merge Parameters", "Set Palceholder for Merged Parameters", ref newParamName, new char[0]))
            {
                //Create new Merged param
                AppModelParameter mergedParam = new AppModelParameter();
                mergedParam.PlaceHolder = newParamName;

                //Merged optional values
                SetMergedOptionalValues(mergedParam);

                //Set Grid selected index
                int selctedIndex = ModelParametersGrid.Grid.SelectedIndex;

                List <string> placeHoldersToReplace = new List <string>();
                //Save Placeholders and remove old params for merge, and add the new merged one

                List <AppModelParameter> tobeRemoved = new List <AppModelParameter>();
                for (int i = 0; i < ModelParametersGrid.Grid.SelectedItems.Count; i++)
                {
                    AppModelParameter paramToRemove = (AppModelParameter)ModelParametersGrid.Grid.SelectedItems[i];
                    placeHoldersToReplace.Add(paramToRemove.PlaceHolder);
                    tobeRemoved.Add(paramToRemove);
                }

                foreach (AppModelParameter Removeit in tobeRemoved)
                {
                    mAAMB.AppModelParameters.Remove(Removeit);
                }

                mAAMB.AppModelParameters.Add(mergedParam);
                GingerCore.General.DoEvents();
                ModelParametersGrid.DataSourceList.Move(ModelParametersGrid.DataSourceList.Count - 1, selctedIndex);

                //Update all places with new placeholder merged param name
                //TODO: Fix with New Reporter (on GingerWPF)
                if (System.Windows.MessageBox.Show(string.Format("Do you want to update the merged instances on all model configurations?"), "Models Parameters Merge", System.Windows.MessageBoxButton.YesNo, System.Windows.MessageBoxImage.Warning, System.Windows.MessageBoxResult.No) == System.Windows.MessageBoxResult.Yes)
                {
                    mAAMB.UpdateParamsPlaceholder(mAAMB, placeHoldersToReplace, newParamName);
                }
            }
        }
Esempio n. 6
0
        private void MergeSelectedParams(object sender, RoutedEventArgs e)
        {
            if (ModelParametersGrid.Grid.SelectedItems.Count < 1)
            {
                return;
            }

            string newParamName = ((AppModelParameter)ModelParametersGrid.Grid.SelectedItems[0]).PlaceHolder;

            if (InputBoxWindow.GetInputWithValidation("Merge Parameters", "Set Placeholder for Merged Parameters", ref newParamName, new char[0]))
            {
                //Create new Merged param
                AppModelParameter mergedParam = new AppModelParameter();
                mergedParam.PlaceHolder = newParamName;

                //Merged optional values
                SetMergedOptionalValues(mergedParam);

                //Set Grid selected index
                int selctedIndex = ModelParametersGrid.Grid.SelectedIndex;

                List <string> placeHoldersToReplace = new List <string>();
                //Save Placeholders and remove old params for merge, and add the new merged one

                List <AppModelParameter> tobeRemoved = new List <AppModelParameter>();
                for (int i = 0; i < ModelParametersGrid.Grid.SelectedItems.Count; i++)
                {
                    AppModelParameter paramToRemove = (AppModelParameter)ModelParametersGrid.Grid.SelectedItems[i];
                    placeHoldersToReplace.Add(paramToRemove.PlaceHolder);
                    tobeRemoved.Add(paramToRemove);
                }

                foreach (AppModelParameter Removeit in tobeRemoved)
                {
                    mApplicationModel.AppModelParameters.Remove(Removeit);
                }

                mApplicationModel.AppModelParameters.Add(mergedParam);
                GingerCore.General.DoEvents();
                ModelParametersGrid.DataSourceList.Move(ModelParametersGrid.DataSourceList.Count - 1, selctedIndex);

                //Update all places with new placeholder merged param name
                if (Reporter.ToUser(eUserMsgKeys.ParameterMerge) == Amdocs.Ginger.Common.MessageBoxResult.Yes)
                {
                    mApplicationModel.UpdateParamsPlaceholder(mApplicationModel, placeHoldersToReplace, newParamName);
                }
            }
        }
Esempio n. 7
0
        public override void AddTreeItem()
        {
            string runSetName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation(string.Format("Add New {0}", GingerDicser.GetTermResValue(eTermResKey.RunSet)), string.Format("{0} Name:", GingerDicser.GetTermResValue(eTermResKey.RunSet)), ref runSetName, System.IO.Path.GetInvalidPathChars()))
            {
                RunSetConfig Runsets = LocalRepository.CreateNewRunset(runSetName, Path);

                RunSetTreeItem BFTI = new RunSetTreeItem();
                BFTI.RunSetConfig = Runsets;
                ITreeViewItem addTreeViewItem = mTreeView.Tree.AddChildItemAndSelect(this, BFTI);

                ////Must do the action after the node was added to tree!
                //Runsets.Save();
                ////add BF to cach
                //refresh header- to reflect source control state
                mTreeView.Tree.RefreshHeader(addTreeViewItem);
            }
        }
Esempio n. 8
0
        private void AddSubTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string folderName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation("Add Sub Folder", "Folder Name:", ref folderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(folderName))
                {
                    string path = Path.Combine(this.NodePath(), folderName);
                    if (System.IO.Directory.Exists(path) == true)
                    {
                        Reporter.ToUser(eUserMsgKeys.FolderExistsWithName);
                        mTreeView.Tree.RefreshSelectedTreeNodeChildrens();
                    }
                    else
                    {
                        object folderItem = AddSubFolder(this.GetType(), folderName, path);
                    }
                }
            }
        }
Esempio n. 9
0
        private void RenameTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string originalName  = mTreeView.Tree.GetSelectedTreeNodeName();
            string newFolderName = originalName;

            if (InputBoxWindow.GetInputWithValidation("Rename Folder", "New Folder Name:", ref newFolderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(newFolderName))
                {
                    string path = Path.Combine(Path.GetDirectoryName(this.NodePath().TrimEnd('\\', '/')), newFolderName);
                    if (System.IO.Directory.Exists(path) == true && originalName.ToUpper() != newFolderName.ToUpper())
                    {
                        //TODO: Fix with New Reporter (on GingerWPF)
                        MessageBox.Show("Folder with same name already exists. Please choose a different name for the folder.", "Folder Creation Failed", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                        mTreeView.Tree.RefreshSelectedTreeNodeParent();
                        return;
                    }
                    else
                    {
                        try
                        {
                            if (RenameTreeFolder(originalName, newFolderName, path) == false)
                            {
                                //TODO: Fix with New Reporter (on GingerWPF)
                                MessageBox.Show(string.Format("Rename the folder to '{0}' failed.", path), "Folder Rename Failed", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                                return;
                            }
                        }
                        catch (Exception ex)
                        {
                            //TODO: Fix with New Reporter (on GingerWPF)
                            MessageBox.Show(string.Format("Rename the folder to '{0}' failed.", path), "Folder Rename Failed", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                            Reporter.ToLog(eLogLevel.ERROR, $"Method - {MethodBase.GetCurrentMethod().Name}, Error - {ex.Message}");
                            return;
                        }
                    }
                }
            }
        }
Esempio n. 10
0
        private void AddSubTreeFolderHandler(object sender, System.Windows.RoutedEventArgs e)
        {
            string folderName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation("Add Sub Folder", "Folder Name:", ref folderName, System.IO.Path.GetInvalidPathChars()))
            {
                if (!String.IsNullOrEmpty(folderName))
                {
                    string path = Path.Combine(this.NodePath(), folderName);
                    if (System.IO.Directory.Exists(path) == true)
                    {
                        //TODO: Fix with New Reporter (on GingerWPF)
                        MessageBox.Show("Folder with same name already exists. Please choose a different name for the folder.", "Folder Creation Failed", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
                        mTreeView.Tree.RefreshSelectedTreeNodeChildrens();
                    }
                    else
                    {
                        object folderItem = AddSubFolder(this.GetType(), folderName, path);
                    }
                }
            }
        }
        private void AddGlobalParam(object sender, RoutedEventArgs e)
        {
            GlobalAppModelParameter newModelGlobalParam = new GlobalAppModelParameter();

            SetUniquePlaceHolderName(newModelGlobalParam);

            string newParamPlaceholder = newModelGlobalParam.PlaceHolder;

            while (InputBoxWindow.GetInputWithValidation("Add Model Global Parameter", "Parameter Name:", ref newParamPlaceholder, System.IO.Path.GetInvalidPathChars()))
            {
                newModelGlobalParam.PlaceHolder = newParamPlaceholder;
                if (!IsParamPlaceholderNameConflict(newModelGlobalParam))
                {
                    newModelGlobalParam.OptionalValuesList.Add(new OptionalValue()
                    {
                        Value = GlobalAppModelParameter.CURRENT_VALUE, IsDefault = true
                    });
                    WorkSpace.Instance.SolutionRepository.AddRepositoryItem(newModelGlobalParam);
                    break;
                }
            }
        }
Esempio n. 12
0
        private void XAddGroupBtn_Click(object sender, RoutedEventArgs e)
        {
            string groupName = string.Empty;

            if (InputBoxWindow.GetInputWithValidation("New Group", "New Group Name:", ref groupName))
            {
                if (!string.IsNullOrEmpty(groupName))
                {
                    if (mBusinessFlow.ActivitiesGroups.Where(x => x.Name.Trim() == groupName.Trim()).FirstOrDefault() == null)
                    {
                        ActivitiesGroup activitiesGroup = new ActivitiesGroup()
                        {
                            Name = groupName.Trim()
                        };
                        mBusinessFlow.AddActivitiesGroup(activitiesGroup);
                        xGroupComboBox.SelectedItem = activitiesGroup;
                    }
                    else
                    {
                        Reporter.ToUser(eUserMsgKey.StaticWarnMessage, "Group with same name already exist, please set unique name.");
                    }
                }
            }
        }