Beispiel #1
0
        public List <TFSBuildDefinitionItem> GetBuildList()
        {
            _isBackgroundProcessRunning = true;
            var curPrj = SelectedProjects.FirstOrDefault();

            if (curPrj == null)
            {
                throw new ApplicationException("No one TFS project has been selected");
            }
            var buildDefs = BuildServer.QueryBuildDefinitions(curPrj.Name);

            //convert flat build list to our contracts
            var result = new List <TFSBuildDefinitionItem>(buildDefs.Length);

            foreach (var item in buildDefs)
            {
                var newDef = new TFSBuildDefinitionItem()
                {
                    Name                = item.Name,
                    HierarchyName       = item.Name.Split('.'),
                    Id                  = item.Id,
                    Description         = item.Description,
                    TFSBuildDefInstance = item,
                    LastRun             = new TFSBuildRunItem()
                    {
                        BuildStatus = BuildStatusType.None
                    }
                };

                result.Add(newDef);
            }
            _isBackgroundProcessRunning = false;
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Removes the project from the selected list.  This method is invoked by the RemoveCommand.
        /// </summary>
        public void RemoveProject()
        {
            ProjectViewModel selectedProjectVM = SelectedProjects.FirstOrDefault(p => p.IsSelected == true);

            UnassignedProjects.Add(selectedProjectVM);
            SelectedProjects.Remove(selectedProjectVM);
        }
        protected override void OnBeforeQueryStatus()
        {
            var projects = SelectedProjects.ToArray();

            if (projects.Length == 1)
            {
                _project     = projects[0];
                _projectFile = _project.FullName;
                Text         = "AntDeploy";
                Visible      = true;
                return;

                //var project = projects[0];
                //if (ProjectHelper.IsDotNetCoreProject(project))
                //{
                //    _projectFile = project.FullName;
                //    Text = "AntDeploy";
                //    Visible = true;

                //}
                //else
                //{
                //    Visible = false;
                //}
            }
            else
            {
                Visible = false;
            }
        }
        public async Task ValidateCustomSkillsetConfigsAsyncInternal(
            string azureFunctionUrl,
            CustomTextConfigModel skillsetConfigs,
            SelectedProjects selectedProjects)
        {
            // send request
            var body = new RequestBody()
            {
                Values = new RequestValue[]
                {
                    new RequestValue()
                    {
                        RecordId = "123",
                        Data     = new RequestData()
                        {
                            Text = "some testing text"
                        }
                    }
                }
            };
            var headers  = CreateHeaders(skillsetConfigs, selectedProjects);
            var response = await SendJsonPostRequestAsync(url : azureFunctionUrl, body : body, headers : headers, parameters : null);

            // validate response
            var result = JsonConvert.DeserializeObject <Response>(await response.Content.ReadAsStringAsync());

            ValidateResponse(result);
        }
Beispiel #5
0
        private async void SaveQueryMethod()
        {
            if (SelectedProjects == null)
            {
                SelectedProjects = new ObservableCollection <Models.ProjectsManagementPageModels.Project>();
            }
            if (QueryDescription.Length > 1 && QueryDescription.Length < 100)
            {
                var skillsQuery    = string.Join(",", SkillsConditions?.Select(s => $"{s.Skill.Id}:{s.From.Id}-{s.To.Id}"));
                var languagesQuery = string.Join(",", LanguagesConditions?.Select(l => $"{l.Language.Id}:{l.From.Id}-{l.To.Id}"));
                var projectsQuery  = string.Join(",", SelectedProjects?.Select(p => p.Id));

                var query = $"{skillsQuery}&{languagesQuery}&{projectsQuery}";

                using (var _database = new ITManagerEntities())
                {
                    var user = await _database.Users.Where(u => u.Id == ShellViewModel.CurrentUserId)
                               .Include(u => u.Queries).FirstOrDefaultAsync();

                    user.Queries.Add(new Query()
                    {
                        Description = QueryDescription,
                        QueryString = query,
                        UserId      = ShellViewModel.CurrentUserId
                    });
                    await _database.SaveChangesAsync();
                }
                _eventAggregator.GetEvent <UpdateQueriesEvent>().Publish();
                QueryErrors = string.Empty;
            }
            else
            {
                QueryErrors = "Query description length must be from 1 to 100 sybmols.";
            }
        }
Beispiel #6
0
 private void ProjectAdded(Project project)
 {
     if (!SelectedProjects.IsExist(project) && project.Activity != null)
     {
         SelectedProjects.Add(new Project {
             Id = project.Id, Name = project.Name, Activity = project.Activity
         });
     }
 }
        public static List <CCProject> GetSelectedProjects()
        {
            var server   = GetServer();
            var projects = server.GetProjects().Where(p => SelectedProjects.Contains(p.Name)).ToList();
            var failing  = projects.Where(p => p.LastBuildStatus == CCBuildStatus.Failure);

            FailingProjects = PassingProjects.Where(p => failing.Any(f => f.Name == p)).ToList();
            PassingProjects = projects.Where(p => p.LastBuildStatus == CCBuildStatus.Success).Select(p => p.Name).ToList();
            return(projects);
        }
 public async Task ValidateCustomSkillsetConfigsAsync(
     string azureFunctionUrl,
     CustomTextConfigModel skillsetConfigs,
     SelectedProjects selectedProjects)
 {
     try
     {
         await ValidateCustomSkillsetConfigsAsyncInternal(azureFunctionUrl, skillsetConfigs, selectedProjects);
     }
     catch (Exception)
     {
         throw new Exception("Custom Text App Credentials Are Invalid!");
     }
 }
        public async Task ValidateAppConfigs(ConfigModel appConfigs, SelectedProjects selectedProjects)
        {
            await _blobStorageValidationService.ValidateBlobConfigsAsync(
                appConfigs.BlobStorage.ConnectionString,
                appConfigs.BlobStorage.ContainerName);

            await _cognitiveSearchValidationService.ValidateCognitiveSearchConfigs(
                appConfigs.CognitiveSearch.EndpointUrl,
                appConfigs.CognitiveSearch.ApiKey);

            await _skillsetValidationService.ValidateCustomSkillsetConfigsAsync(
                appConfigs.AzureFunction.FunctionUrl,
                appConfigs.CustomText,
                selectedProjects);
        }
Beispiel #10
0
        public async Task IndexCustomText(
            string indexName,
            CustomTextSchema customtexSchema,
            SelectedProjects selectedProjects)
        {
            // initialize resource names
            var dataSourceName      = indexName.ToLower() + "-data";
            var indexerName         = indexName.ToLower() + "-indexer";
            var skillSetName        = indexName.ToLower() + "-skillset";
            var customTextSkillName = indexName.ToLower() + "-customtext-skill";

            // create models (index & skillset)
            var indexSchema = _cognitiveSearchSchemaCreatorService.CreateSearchIndexSchema(
                customtexSchema,
                indexName,
                selectedProjects);
            var skillsetSchema = _cognitiveSearchSchemaCreatorService.CreateSkillSetSchema(
                skillSetName,
                customTextSkillName,
                _appConfigs.AzureFunction.FunctionUrl,
                _appConfigs.CustomText,
                selectedProjects);
            var indexerSchema = _cognitiveSearchSchemaCreatorService.CreateIndexerSchema(
                customtexSchema,
                indexerName,
                dataSourceName,
                skillSetName,
                indexName,
                selectedProjects);

            // indexing pipeline
            _loggerService.LogOperation(OperationType.CreateDataSource, $"{dataSourceName}");
            await _cognitiveSearchService.CreateDataSourceConnectionAsync(dataSourceName, _appConfigs.BlobStorage.ContainerName, _appConfigs.BlobStorage.ConnectionString);

            _loggerService.LogOperation(OperationType.CreatingSearchIndex, $"{indexName}");
            await _cognitiveSearchService.CreateIndexAsync(indexSchema);

            _loggerService.LogOperation(OperationType.CreatingSkillSet, $"{skillSetName}");
            await _cognitiveSearchService.CreateSkillSetAsync(skillsetSchema);

            _loggerService.LogOperation(OperationType.CreatingIndexer, $"{indexerName}");
            await _cognitiveSearchService.CreateIndexerAsync(indexerSchema);

            // log success message
            _loggerService.LogSuccessMessage("Indexing Application Was Successfull!");
        }
        public async Task CustomSkillsetValidationServiceAsyncTest(
            string azureFunctionUrl,
            CustomTextConfigModel customTextConfigs,
            SelectedProjects selectedProjects,
            bool isValidCredentials)
        {
            var validationService = new SkillsetValidationService();

            if (isValidCredentials)
            {
                await validationService.ValidateCustomSkillsetConfigsAsync(azureFunctionUrl, customTextConfigs, selectedProjects);
            }
            else
            {
                await Assert.ThrowsAsync <Exception>(() => validationService.ValidateCustomSkillsetConfigsAsync(azureFunctionUrl, customTextConfigs, selectedProjects));
            }
        }
        public async Task <CustomTextSchema> LoadCustomTextAppSchema(
            CustomTextResource customTextResource,
            CustomTextProjects customTextProjects,
            SelectedProjects selectedProjects)
        {
            var client = new CustomTextAuthoringClient(customTextResource.Endpoint, customTextResource.Key);
            var result = new CustomTextSchema();

            // load extractors
            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                var extractors = await LoadExtractors(client, customTextProjects.EntityRecognition.ProjectName);

                result.EntityNames = extractors.Select(e => e.Name).ToList();
            }

            // return result
            return(result);
        }
        public void OnJiraUrlSetting(Office.IRibbonControl control)
        {
            if (!CheckUserAuth())
            {
                return;
            }
            var jiraUrlForm = new FormJiraUrl(JiraOperator, BaseJiraUrl);

            if (jiraUrlForm.ShowDialog() == DialogResult.OK)
            {
                if (!BaseJiraUrl.Equals(jiraUrlForm.JiraUrl))
                {
                    BaseJiraUrl = JiraOperator.BaseJiraUrl = jiraUrlForm.JiraUrl;
                    SelectedProjects.Clear();
                    CurrentAssignProject = null;
                    ProjectIssueRequiredFieldsMaps.Maps.Clear();
                    UpdateCurrentProjectUI();
                }
            }
        }
        public SkillSet CreateSkillSetSchema(
            string skillSetName,
            string customTextSkillName,
            string azureFunctionUrl,
            CustomTextConfigModel customTextConfigs,
            SelectedProjects selectedProjects)
        {
            var customSkillSchema = CreateCustomSkillSchema(
                customTextSkillName,
                azureFunctionUrl,
                customTextConfigs,
                selectedProjects);

            return(new SkillSet
            {
                Name = skillSetName,
                Description = "Custom Text Skillset",
                Skills = new List <CustomSkillSchema> {
                    customSkillSchema
                }
            });
        }
Beispiel #15
0
        /// <summary>
        /// Adds a new change
        /// </summary>
        /// <param name="CDVM"></param>
        public void AddChange(ChangeDescriptionViewModel CDVM, bool Notify)
        {
            Changes.Add(CDVM);
            ChangeController.UserName    = CDVM.User;
            ChangeController.ProjectName = CDVM.Project;
            CDVM.PropertyChanged        += new PropertyChangedEventHandler(CDVM_PropertyChanged);
            if (Notify)
            {
                RaisePropertyChanged("NewChange");
            }

            if (!SelectedProjects.Contains(CDVM.Project))
            {
                SelectedProjects.Add(CDVM.Project);
            }
            if (!SelectedUsers.Contains(CDVM.User))
            {
                SelectedUsers.Add(CDVM.User);
            }

            RaisePropertyChanged("SelectedChanges");
        }
        public ExistingProjectInitVM()
        {
            SolutionPath.PathType         = PathPickerVM.PathTypeOptions.File;
            SolutionPath.ExistCheckOption = PathPickerVM.CheckOptions.On;
            SolutionPath.Filters.Add(new CommonFileDialogFilter("Solution", ".sln"));

            AvailableProjects = this.WhenAnyValue(x => x.SolutionPath.TargetPath)
                                .ObserveOn(RxApp.TaskpoolScheduler)
                                .Select(x => Utility.AvailableProjectSubpaths(x))
                                .Select(x => x.AsObservableChangeSet())
                                .Switch()
                                .ObserveOnGui()
                                .ToObservableCollection(this);

            InitializationCall = SelectedProjects.Connect()
                                 .Transform(subPath =>
            {
                if (subPath == null || this.SolutionPath.TargetPath == null)
                {
                    return(string.Empty);
                }
                try
                {
                    return(Path.Combine(Path.GetDirectoryName(SolutionPath.TargetPath) !, subPath));
                }
                catch (Exception)
                {
                    return(string.Empty);
                }
            })
                                 .Transform(path =>
            {
                var pathPicker = new PathPickerVM
                {
                    PathType         = PathPickerVM.PathTypeOptions.File,
                    ExistCheckOption = PathPickerVM.CheckOptions.On,
                    TargetPath       = path
                };
                pathPicker.Filters.Add(new CommonFileDialogFilter("Project", ".csproj"));
                return(pathPicker);
            })
                                 .DisposeMany()
                                 .QueryWhenChanged(q =>
            {
                if (q.Count == 0)
                {
                    return(GetResponse <InitializerCall> .Fail("No projects selected"));
                }
                var err = q
                          .Select(p => p.ErrorState)
                          .Where(e => e.Failed)
                          .And(ErrorResponse.Success)
                          .First();
                if (err.Failed)
                {
                    return(err.BubbleFailure <InitializerCall>());
                }
                return(GetResponse <InitializerCall> .Succeed(async(profile) =>
                {
                    return q.Select(i =>
                    {
                        var patcher = new SolutionPatcherVM(profile);
                        patcher.SolutionPath.TargetPath = SolutionPath.TargetPath;
                        patcher.ProjectSubpath = i.TargetPath.TrimStart($"{Path.GetDirectoryName(SolutionPath.TargetPath)}\\" !);
                        return patcher;
                    });
                }));
            });
        }
        public static TheoryData CustomSkillsetValidationServiceAsyncTestData()
        {
            var customTextConfigs = new CustomTextConfigModel()
            {
                Resource = new CustomTextResource()
                {
                    Endpoint = Secrets.Instance.CustomSkillsetCustomtextServiceEndpoint,
                    Key      = Secrets.Instance.CustomSkillsetCustomtextServiceKey
                },
                Projects = new CustomTextProjects()
                {
                    EntityRecognition = new ProjectCredentials()
                    {
                        ProjectName    = Secrets.Instance.CustomSkillsetCustomtextProjectName,
                        DeploymentName = Secrets.Instance.CustomSkillsetCustomtextDeploymentName,
                    }
                }
            };

            var selectedProjects = new SelectedProjects()
            {
                IsSelected_EntityRecognitionProject    = false,
                IsSelected_SingleClassificationProject = false,
                IsSelected_MultiClassificationProject  = false
            };

            return(new TheoryData <string, CustomTextConfigModel, SelectedProjects, bool>
            {
                {
                    Secrets.Instance.CustomSkillsetAzureFunctionUrl,
                    customTextConfigs,
                    selectedProjects,
                    true
                },

                /*{
                 *  "https://customtextfunction20asd017202545.azurewebsites.net/api/customtext-extractor?code=kfOKcelrasdlvn64VobUn/CiU2asdAFdb2n/Tasdgknvx8IsAEMwoA==",
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceEndpoint,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceKey,
                 *  Secrets.Instance.CustomSkillsetCustomtextProjectName,
                 *  Secrets.Instance.CustomSkillsetCustomtextDeploymentName,
                 *  false
                 * },
                 * {
                 *  Secrets.Instance.CustomSkillsetAzureFunctionUrl,
                 *  "lknlknasdlnlasjdnlajknsdljnasdljnasd",
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceKey,
                 *  Secrets.Instance.CustomSkillsetCustomtextProjectName,
                 *  Secrets.Instance.CustomSkillsetCustomtextDeploymentName,
                 *  false
                 * },
                 * {
                 *  Secrets.Instance.CustomSkillsetAzureFunctionUrl,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceEndpoint,
                 *  "lojunaiosudbiaubsdasdasd",
                 *  Secrets.Instance.CustomSkillsetCustomtextProjectName,
                 *  Secrets.Instance.CustomSkillsetCustomtextDeploymentName,
                 *  false
                 * },
                 * {
                 *  Secrets.Instance.CustomSkillsetAzureFunctionUrl,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceEndpoint,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceKey,
                 *  "z9h8s6f664hf",
                 *  Secrets.Instance.CustomSkillsetCustomtextDeploymentName,
                 *  false
                 * },
                 * {
                 *  Secrets.Instance.CustomSkillsetAzureFunctionUrl,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceEndpoint,
                 *  Secrets.Instance.CustomSkillsetCustomtextServiceKey,
                 *  Secrets.Instance.CustomSkillsetCustomtextProjectName,
                 *  "iuygsdgulmae",
                 *  false
                 * },*/
            });
        }
        public Indexer CreateIndexerSchema(
            CustomTextSchema schema,
            string indexerName,
            string dataSourceName,
            string skillSetName,
            string indexName,
            SelectedProjects selectedProjects)
        {
            // field mappings
            var fieldMappings = new List <IndexerFieldMapping>
            {
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_name",
                    TargetFieldName = "id",
                    MappingFunction = new MappingFunction
                    {
                        Name = "base64Encode"
                    }
                },
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_name",
                    TargetFieldName = "document_name",
                },
                new IndexerFieldMapping
                {
                    SourceFieldName = "metadata_storage_path",
                    TargetFieldName = "document_uri",
                }
            };

            // output fields mapping
            var outputFieldMappings = new List <IndexerFieldMapping>();

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                foreach (string entityName in schema.EntityNames)
                {
                    outputFieldMappings.Add(new IndexerFieldMapping
                    {
                        SourceFieldName = $"/document/content/{Constants.SkillsetResponseEntitiesKey}/{entityName}",
                        TargetFieldName = entityName
                    });
                }
            }
            if (selectedProjects.IsSelected_SingleClassificationProject)
            {
                outputFieldMappings.Add(new IndexerFieldMapping
                {
                    SourceFieldName = $"/document/content/{Constants.SkillsetResponseSingleClassKey}",
                    TargetFieldName = Constants.SearchIndexSingleClassColumnName
                });
            }
            if (selectedProjects.IsSelected_MultiClassificationProject)
            {
                outputFieldMappings.Add(new IndexerFieldMapping
                {
                    SourceFieldName = $"/document/content/{Constants.SkillsetResponseMultiClassKey}",
                    TargetFieldName = Constants.SearchIndexMultiClassColumnName
                });
            }

            // configs
            var indexerParameters = new IndexerParameters
            {
                Configuration = new IndexerConfiguration
                {
                    IndexedFileNameExtensions = ".txt"
                }
            };

            return(new Indexer
            {
                Name = indexerName,
                DataSourceName = dataSourceName,
                TargetIndexName = indexName,
                SkillsetName = skillSetName,
                FieldMappings = fieldMappings,
                OutputFieldMappings = outputFieldMappings,
                Parameters = indexerParameters
            });
        }
Beispiel #19
0
 private void ProjectDeleted(Project project)
 {
     SelectedProjects.Remove(project);
 }
        public SearchIndex CreateSearchIndexSchema(CustomTextSchema schema, string indexName, SelectedProjects selectedProjects)
        {
            // core fields
            var indexFields = new List <SearchField>
            {
                new SearchField("id", SearchFieldDataType.String)
                {
                    IsKey = true
                },
                new SearchField("document_name", SearchFieldDataType.String),
                new SearchField("document_uri", SearchFieldDataType.String)
            };

            // classifers
            if (selectedProjects.IsSelected_SingleClassificationProject)
            {
                var singleClassField = new SearchField(
                    Constants.SearchIndexSingleClassColumnName,
                    SearchFieldDataType.String);
                indexFields.Add(singleClassField);
            }
            if (selectedProjects.IsSelected_MultiClassificationProject)
            {
                var multiClassField = new SearchField(
                    Constants.SearchIndexMultiClassColumnName,
                    SearchFieldDataType.Collection(SearchFieldDataType.String));
                indexFields.Add(multiClassField);
            }

            // extractors
            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                foreach (var entityName in schema.EntityNames)
                {
                    var entityField = new SearchField(
                        entityName,
                        SearchFieldDataType.Collection(SearchFieldDataType.String));
                    indexFields.Add(entityField);
                }
            }

            // return
            return(new SearchIndex(indexName)
            {
                Fields = indexFields
            });
        }
        private static Dictionary <string, string> CreateHeaders(CustomTextConfigModel skillsetConfigs, SelectedProjects selectedProjects)
        {
            var headers = new Dictionary <string, string>()
            {
                [Constants.CustomTextResourceEndpointHeader] = skillsetConfigs.Resource.Endpoint,
                [Constants.CustomTextResourceKeyHeader]      = skillsetConfigs.Resource.Key,
            };

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                headers.Add(Constants.EntityRecognitionProjectNameHeader, skillsetConfigs.Projects.EntityRecognition.ProjectName);
                headers.Add(Constants.EntityRecognitionDeploymentNameHeader, skillsetConfigs.Projects.EntityRecognition.DeploymentName);
            }
            if (selectedProjects.IsSelected_SingleClassificationProject)
            {
                headers.Add(Constants.SingleClassificationProjectNameHeader, skillsetConfigs.Projects.SingleClassification.ProjectName);
                headers.Add(Constants.SingleClassificationDeploymentNameHeader, skillsetConfigs.Projects.SingleClassification.DeploymentName);
            }
            if (selectedProjects.IsSelected_MultiClassificationProject)
            {
                headers.Add(Constants.MultiClassificationProjectNameHeader, skillsetConfigs.Projects.MultiClassification.ProjectName);
                headers.Add(Constants.MultiClassificationDeploymentNameHeader, skillsetConfigs.Projects.MultiClassification.DeploymentName);
            }
            return(headers);
        }
        private static CustomSkillSchema CreateCustomSkillSchema(
            string customTextSkillName,
            string azureFunctionUrl,
            CustomTextConfigModel customTextConfigs,
            SelectedProjects selectedProjects)
        {
            // basic info
            var customSkillSchema = new CustomSkillSchema()
            {
                name = customTextSkillName,
                uri  = azureFunctionUrl
            };

            // add headers / outputs
            var outputs = new List <Output>();
            var headers = new HttpHeaders()
            {
                CustomTextResourceEndpointHeader = customTextConfigs.Resource.Endpoint,
                CustomTextResourceKeyHeader      = customTextConfigs.Resource.Key
            };

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                headers.EntityRecognitionProjectNameHeader    = customTextConfigs.Projects.EntityRecognition.ProjectName;
                headers.EntityRecognitionDeploymentNameHeader = customTextConfigs.Projects.EntityRecognition.DeploymentName;
                var output = new Output()
                {
                    name       = Constants.SkillsetResponseEntitiesKey,
                    targetName = Constants.SkillsetResponseEntitiesKey
                };
                outputs.Add(output);
            }
            if (selectedProjects.IsSelected_SingleClassificationProject)
            {
                headers.SingleClassificationProjectNameHeader    = customTextConfigs.Projects.SingleClassification.ProjectName;
                headers.SingleClassificationDeploymentNameHeader = customTextConfigs.Projects.SingleClassification.DeploymentName;
                var output = new Output()
                {
                    name       = Constants.SkillsetResponseSingleClassKey,
                    targetName = Constants.SkillsetResponseSingleClassKey
                };
                outputs.Add(output);
            }
            if (selectedProjects.IsSelected_MultiClassificationProject)
            {
                headers.MultiClassificationProjectNameHeader    = customTextConfigs.Projects.MultiClassification.ProjectName;
                headers.MultiClassificationDeploymentNameHeader = customTextConfigs.Projects.MultiClassification.DeploymentName;
                var output = new Output()
                {
                    name       = Constants.SkillsetResponseMultiClassKey,
                    targetName = Constants.SkillsetResponseMultiClassKey
                };
                outputs.Add(output);
            }

            customSkillSchema.HttpHeaders = headers;
            customSkillSchema.outputs     = outputs;


            // return
            return(customSkillSchema);
        }
Beispiel #23
0
        private bool ValidateSchemaInternal(CustomTextSchema schema, CustomTextProjects projects, SelectedProjects selectedProjects)
        {
            var result = true;

            if (selectedProjects.IsSelected_EntityRecognitionProject)
            {
                result &= ValidateEntityNames(schema);
            }

            return(result);
        }
Beispiel #24
0
        public void ValidateSchema(CustomTextSchema schema, CustomTextProjects projects, SelectedProjects selectedProjects)
        {
            var result = ValidateSchemaInternal(schema, projects, selectedProjects);

            if (result == false)
            {
                throw new Exception("Cognitive Search doesn't support spaces or special characters in entity names! please rename your entities and re-train your model");
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public WorkingFolderViewModel(WorkingFolder workingFolder, IServiceProvider serviceProvider)
     : base(serviceProvider)
 {
     IncludeToggleCommand = new DelegateCommand <object>("Include/Exclude", ToggleSelectedProjects, o => SelectedProjects.Any())
     {
         IconImage = Images.arrow_Reorder_16xSM.ToImageSource()
     };
     AddSolutionCommand = new DelegateCommand <object>("Add Project/Solution...", AddSolution)
     {
         IconImage = Images.Solution_8308.ToImageSource()
     };
     WorkingFolder    = workingFolder;
     selectedProjects = new ObservableCollection <ProjectViewModel>();
     selectedProjects.CollectionChanged += SelectionChanged;
 }
Beispiel #26
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            this.btnExport.Enabled = false;
            this.btnCancel.Enabled = false;

            selectedProjects = projects.GetSelectedProjects();
            selectedCultures = cultures.SelectedCultures;

            if (SelectedProjects != null)
            {
                if (SelectedProjects.Count() == Solution.Projects.Count())
                {
                    saveFileDialog.FileName = Solution.Name;
                }
                else if (SelectedProjects.Count() > 1)
                {
                    saveFileDialog.FileName = SelectedProjects[0].Name + "-more";
                }
                else
                {
                    saveFileDialog.FileName = SelectedProjects[0].Name;
                }
            }
            else
            {
                saveFileDialog.FileName = Solution.Name;
            }

            if (SelectedCultures.Count() == 1)
            {
                if (SelectedCultures.First().Culture.Name != "")
                {
                    saveFileDialog.FileName += "-" + SelectedCultures.First().Culture.Name;
                }
            }
            else if (SelectedCultures.Count() == 2)
            {
                saveFileDialog.FileName += "-" + SelectedCultures.First().Culture.Name
                                           + "," + SelectedCultures.ElementAt(1).Culture.Name;
            }
            saveFileDialog.FileName += ".xlsx";

            DialogResult result = saveFileDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                try
                {
                    XlsxConverter excel = null;
                    if (SelectedFileGroups.Count != 0)
                    {
                        excel = new XlsxConverter(SelectedFileGroups, Solution);
                    }
                    else if (SelectedProjects.Count != 0)
                    {
                        excel = new XlsxConverter(SelectedProjects);
                    }
                    else
                    {
                        excel = new XlsxConverter(Solution);
                    }

                    excel.ExportComments = cbkExportComments.Checked;
                    excel.ExportDiff     = cbkExportDiff.Checked;
                    excel.IncludeProjectsWithoutTranslations = cbkIncludeProjectsWithoutTranslations.Checked;
                    excel.AutoAdjustLayout        = cbkAutoAdjustLayout.Checked;
                    excel.IgnoreInternalResources = cbkIgnoreInternalResources.Checked;
                    excel.Cultures = cultures.SelectedCultures;

                    excel.Export(saveFileDialog.FileName);
                }
                catch
                {
                    throw;
                }
                finally
                {
                    this.btnExport.Enabled = true;
                    this.btnCancel.Enabled = true;
                }
            }

            this.Close();
        }
Beispiel #27
0
        private static async Task <CustomTextSchema> LoadAndValidateAppSchema(ConfigModel appConfigs, SelectedProjects selectedProjects)
        {
            // log operation
            _logger.LogOperation(OperationType.ReadAndValidateAppSchema, $"CustomText Resource");

            // load schema
            var customTextSchema = await _customtextSchemaLoader.LoadCustomTextAppSchema(
                appConfigs.CustomText.Resource,
                appConfigs.CustomText.Projects,
                selectedProjects);

            // validate schema
            _schemaValidationService.ValidateSchema(customTextSchema, appConfigs.CustomText.Projects, selectedProjects);

            return(customTextSchema);
        }