public override void OnButtonClick(ConsoleButton consoleButton) { var svcMgr = Helper.GetServicesManager(); var workspaceArtifactId = Helper.GetActiveCaseID(); var eddsDbContext = Helper.GetDBContext(-1); var activeArtifactId = ActiveArtifact.ArtifactID; var savedSearchArtifactId = (int?)ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.SavedSearch.ToString()].Value.Value; var extractorProfileArtifactId = (int?)ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.ExtractorProfile.ToString()].Value.Value; var sourceLongTextFieldArtifactId = (int?)ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.SourceLongTextField.ToString()].Value.Value; ExecutionCurrentUserIdentity = ExecutionIdentity.CurrentUser; var buttonName = consoleButton.Name; var consoleJob = new ConsoleJob(svcMgr, _artifactQueries, _sqlQueryHelper, ExecutionCurrentUserIdentity, eddsDbContext, workspaceArtifactId, activeArtifactId, savedSearchArtifactId, extractorProfileArtifactId, sourceLongTextFieldArtifactId, buttonName); try { consoleJob.Execute(); } catch (CustomExceptions.TextExtractorSetMissingFieldsException ex) { throw new Exception(ex.Message); } catch (CustomExceptions.TextExtractorSetConsoleCancelException ex) { throw new Exception(ex.Message); } }
public async Task OnButtonClickAsync(ConsoleButton consoleButton) { var recordExists = await DoesRecordExistAsync(); var resourceGroupId = 0; //If no db record exists, get the Resource Pool fpor the agent and add it to the Import Job record if (recordExists == false) { resourceGroupId = await WorkspaceQueryHelper.GetResourcePoolAsync(SvcManager, ExecutionIdentity.System, Helper.GetActiveCaseID()); } switch (consoleButton.Name) { case Constant.Buttons.SUBMIT: if (recordExists == false && resourceGroupId > 0) { //Add the record to the Export Manager queue table await InsertExportJobToExportManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, CurrentArtifactId, CurrentUserArtifactId, Constant.Status.Queue.NotStarted, resourceGroupId); //Set the Export Job RDO status to Validating await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, Identity, Constant.Guids.ObjectType.MarkupUtilityExportJob, CurrentArtifactId, Constant.Guids.Field.MarkupUtilityExportJob.Status, Constant.Status.Job.SUBMITTED); } break; case Constant.Buttons.CANCEL: if (recordExists == false && resourceGroupId > 0) { //Set the Export Job RDO status to Cancel Requested await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, Identity, Constant.Guids.ObjectType.MarkupUtilityExportJob, CurrentArtifactId, Constant.Guids.Field.MarkupUtilityExportJob.Status, Constant.Status.Job.CANCELREQUESTED); } break; } }
private void Initialize() { BackButton = new ConsoleButton("Back"); AddTranslation = new ConsoleButton("Add new translation"); TranslationInput = new ConsoleInput("Translation"); Languages = new ConsoleRadioBox("Select language"); BackButton.OnClick += OnBackButtonClick; OnStart += AddTranslationToWordPage_OnStart; AddTranslation.OnClick += AddNewTranslation_OnClick; foreach (var l in Parent.Parent.Parent.GetAllLanguagesInvoker()) { if (l != Language) { Languages.Elements.Add(new ConsoleRadioBoxElement(Languages, l)); } } Controls.Add(BackButton); Controls.Add(TranslationInput); Controls.Add(Languages); Controls.Add(AddTranslation); }
public async Task InternalButtonClick(ConsoleButton consoleButton) { // Update Security Protocol ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; switch (consoleButton.Name) { case _BUTTON_NAME: //Get Group ID int groupArtifactId = (int)ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionImage.GROUP)].Value.Value; string groupIdValue = await GetGroupIdValue(_currentWorkspaceArtifactId, groupArtifactId); //Get Current Image Location int imageArtifactId = (int)ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionImage.IMAGE)].Value.Value; string imageLocation = GetFileLocation(_currentWorkspaceArtifactId, imageArtifactId); //Identify People in Image for the select Group Dictionary <string, double> personList = await IdentifyImage(imageLocation, groupIdValue); //Match People In Group await MatchPeople(_currentWorkspaceArtifactId, personList, ActiveArtifact.ArtifactID); break; } }
static void Main(string[] args) { var service = new ConsoleButton { Boundary = "-", Width = 8, Height = 20, Text = "Button", InsideColor = ConsoleColor.Red, BoundaryColor = ConsoleColor.Yellow }; service.Button(); service.ButtonAction += new Action <int>(Console.WriteLine); service.ButtonAction += Console.WriteLine; service.ButtonAction += data => Console.WriteLine(data); int[] integers = { 1, 2, 3, 4, 5, 6, 7, 8, 9 }; var result = integers.Where(integer => integer > 5); foreach (var value in result) { Console.Write($"{value} "); } }
private async Task AddPersonAndImages(ConsoleButton consoleButton) { // Update Security Protocol ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; switch (consoleButton.Name) { case _ADD_PERSON: //Get Group ID int groupArtifactId = (int)ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionPerson.GROUP)].Value.Value; string groupIdValue = await GetGroupIdValue(_currentWorkspaceArtifactId, groupArtifactId); //Create Person in Group string personName = ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionPerson.NAME)].Value.Value.ToString(); personName = Methods.ModifyName(personName); //Create person in Azure Group Guid personGuid = await CreatePersonInGroup(groupIdValue, personName); //Set Person Id on current object await SetPersonName(_currentWorkspaceArtifactId, ActiveArtifact.ArtifactID, personGuid); //Get List of Image for the Person List <string> imageList = GetPersonImageList(_currentWorkspaceArtifactId); //Add Image for Person in Group await AddPersonImages(groupIdValue, personGuid, personName, imageList); //Set Status of Person await SetPersonStatus(_currentWorkspaceArtifactId, ActiveArtifact.ArtifactID, "Complete"); break; } }
public override void OnButtonClick(ConsoleButton consoleButton) { switch (consoleButton.Name) { case "submit": case "retry": case "cancel": //Retrieve flag field FlagFieldFieldArtifactID = RetrieveFieldArtifactID(MainApp.Helper.Constant.FIELD_JOB_MISSING_FILE_INDICATOR_GUID); FlagFieldArtifactID = (int)this.ActiveArtifact.Fields[FlagFieldFieldArtifactID].Value.Value; RetrieveColumnName(); break; } switch (consoleButton.Name) { case "submit": HandleSubmit(); break; case "retry": HandleRetry(); break; case "cancel": HandleCancel(); break; } }
private async Task ManageGroup(ConsoleButton consoleButton) { // Update Security Protocol ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; switch (consoleButton.Name) { case _CREATE_GROUP: int nameArtifactId = GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionGroup.NAME); string groupId = await CreatePersonGroup(ActiveArtifact.Fields[nameArtifactId].Value.Value.ToString()); await SetGroupId(groupId); await SetGroupStatus(Constant.Group.GROUP_CREATION_STATUS_DESC, true); break; case _DELETE_GROUP: int artifactIdByGuidGroupId = GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionGroup.GROUP_ID); await DeletePersonGroup(artifactIdByGuidGroupId); await SetGroupId(); await SetGroupStatus(Constant.Group.GROUP_DELETION_STATUS_DESC, true); break; case _TRAIN_GROUP: int groupIdArtifactId = GetArtifactIdByGuid(Constant.Guids.Field.FaceRecognitionGroup.GROUP_ID); bool trainingResult = await TrainGroup(ActiveArtifact.Fields[groupIdArtifactId].Value.Value.ToString()); await SetGroupStatus(Constant.Group.GROUP_TRAINING_STATUS_DESC, trainingResult); break; } }
public void incorrectAnswer(ConsoleButton consoleButton) { TriggerText(incorrectAnswerText); consoleButton.gameObject.SetActive(false); unselectedAnswers.Remove(selectedAnswer); selectedAnswer = null; GameTimer.Instance.AddPenalty(1); }
public void openMenu() { screenAnimators[0].SetBool("MenuOpen", true); screenAnimators[1].SetBool("MenuButtonsActive", true); menuOpen = true; TriggerText(); setConsoleButtonsActive(true); selectedAnswer = null; }
public void OnButtonClickTestSubmit() { var consoleButton = new ConsoleButton { Name = "Submit" }; _console.OnButtonClick(consoleButton); MockQuery.Verify(x => x.RetrieveSingleInJobManagerQueueByArtifactIdAsync(It.IsAny <IDBContext>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <string>()), Times.Once); MockQuery.Verify(x => x.InsertJobToManagerQueueAsync(It.IsAny <IDBContext>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), It.IsAny <int>(), Constant.Tables.ReproduceManagerQueue, "ReproduceJobArtifactID"), Times.Once); }
public async Task <Console> GetConsoleAsync(PageEvent pageEvent, IAPILog logger) { var console = new Console { Items = new List <IConsoleItem>(), Title = "Manage Import Job" }; var validateButton = new ConsoleButton { Name = Constant.Buttons.VALIDATE, DisplayText = "Validate", ToolTip = "Click here to validate this job", RaisesPostBack = true }; var submitButton = new ConsoleButton { Name = Constant.Buttons.SUBMIT, DisplayText = "Submit", ToolTip = "Click here to add this job to the queue", RaisesPostBack = true }; var cancelButton = new ConsoleButton { Name = Constant.Buttons.CANCEL, DisplayText = "Cancel", ToolTip = "Click here to cancel this job", RaisesPostBack = true }; if (pageEvent == PageEvent.PreRender) { var recordExists = await DoesRecordExistAsync(); if (recordExists) { validateButton.Enabled = false; submitButton.Enabled = false; cancelButton.Enabled = true; } else { validateButton.Enabled = true; submitButton.Enabled = true; cancelButton.Enabled = false; } } console.Items.Add(validateButton); console.Items.Add(submitButton); console.Items.Add(cancelButton); return(console); }
public void closeMenu() { screenAnimators[0].SetBool("MenuOpen", false); screenAnimators[1].SetBool("MenuButtonsActive", false); menuOpen = false; setConsoleButtonsActive(false); selectedAnswer = null; if (!puzzleComplete) { openConsoleButton.SetActive(true); } }
public override Console GetConsole(ConsoleEventHandler.PageEvent pageEvent) { _console = new Console { Items = new List <IConsoleItem>(), Title = "Manage Set" }; _submitButton = new ConsoleButton { Name = Constant.Names.Console.SUBMIT, DisplayText = "Submit", ToolTip = "Click here to submit this Extractor Set to the queue.", RaisesPostBack = true }; _cancelButton = new ConsoleButton { Name = Constant.Names.Console.CANCEL, DisplayText = "Cancel", ToolTip = "Click here to cancel this Extractor Set.", RaisesPostBack = true }; _separator = new ConsoleSeparator(); if (pageEvent == PageEvent.PreRender) { var textExtractorStatus = ActiveArtifact.Fields[Constant.Guids.Fields.ExtractorSet.Status.ToString()].Value.Value; if (textExtractorStatus == null) { _submitButton.Enabled = true; _cancelButton.Enabled = false; } else if (textExtractorStatus.ToString() == Constant.ExtractorSetStatus.CANCELLED || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.COMPLETE_WITH_ERRORS || textExtractorStatus.ToString() == Constant.ExtractorSetStatus.ERROR) { _submitButton.Enabled = false; _cancelButton.Enabled = false; } else { _submitButton.Enabled = false; _cancelButton.Enabled = true; } } _console.Items.Add(_submitButton); _console.Items.Add(_cancelButton); _console.Items.Add(_separator); _console.AddRefreshLinkToConsole().Enabled = true; return(_console); }
public async Task OnButtonClickAsync(ConsoleButton consoleButton) { ImportUtilityJob.ButtonName = consoleButton.Name; try { await Task.Run(() => ImportUtilityJob.ExecuteAsync()); } catch (AdminMigrationUtilityException ex) { throw new Exception(ex.Message); } }
public void checkAnswer() { areYouSureOpen = false; if (selectedAnswer.answerNum == correctAnswerNum) { correctAnswer(); } else { incorrectAnswer(selectedAnswer); } selectedAnswer = null; }
private async Task ExtractInfo(ConsoleButton consoleButton) { switch (consoleButton.Name) { //Handle each Button's functionality case "Extract Info": int workspaceID = this.Helper.GetActiveCaseID(); int invoiceArtifactID = this.ActiveArtifact.ArtifactID; Guid modelGuid = Guid.Empty; string documentLocation = String.Empty; //Get Model and Document could be made a function to get doc location, but keeping for demo int modelArtifactId = (int)this.ActiveArtifact.Fields[Guids.Invoice.TRAINING_MODEL.ToString()].Value.Value; int documentArtifactId = (int)this.ActiveArtifact.Fields[Guids.Invoice.DOCUMENT.ToString()].Value.Value; if ((modelArtifactId > 0) && (documentArtifactId > 0)) { Model model = new Model(); await model.ReadModelGuid(Helper.GetServicesManager(), workspaceID, modelArtifactId); modelGuid = model.ModelGuid; IDBContext workspaceContext = Helper.GetDBContext(workspaceID); string sql = @"SELECT [Location] FROM [file] WITH(NOLOCK) WHERE [DocumentArtifactId] = @documentArtifactID AND [Type] = 0"; SqlParameter documentArtifactIdParam = new SqlParameter("@documentArtifactID", SqlDbType.Int); documentArtifactIdParam.Value = documentArtifactId; documentLocation = workspaceContext.ExecuteSqlStatementAsScalar <String>(sql, new SqlParameter[] { documentArtifactIdParam }); } //get secrets AzureSettings azureSettings = new AzureSettings(); ISecretStore secretStore = this.Helper.GetSecretStore(); Secret secret = secretStore.Get(azureSettings.SecretPath); string congnitiveServicesKey = secret.Data[azureSettings.CognitiveServicesKeySecretName]; string congnitiveServicesEndPoint = secret.Data[azureSettings.CognitiveServicesEndpointSecretName]; AzureFormRecognitionService azureFormRecognitionService = new FormRecognition.AzureFormRecognitionService(congnitiveServicesKey, congnitiveServicesEndPoint, Helper); Microsoft.Azure.CognitiveServices.FormRecognizer.Models.AnalyzeResult results = await azureFormRecognitionService.AnalyzeForm(azureFormRecognitionService.GetClient(), modelGuid, documentLocation); Invoice invoice = new Invoice(); invoice = invoice.ConvertAnalyzeResultToInvoice(results, Helper); IServicesMgr mgr = Helper.GetServicesManager(); await invoice.UpdateRelativity(mgr, workspaceID, invoiceArtifactID); break; } }
private void Initialize() { BackButton = new ConsoleButton("Back"); AddWord = new ConsoleButton("Add new word"); Words = new ConsoleList("Words"); BackButton.OnClick += OnBackButtonClick; OnStart += LanguagePage_OnStart; AddWord.OnClick += AddWord_OnClick; Controls.Add(BackButton); Controls.Add(AddWord); Controls.Add(Words); }
private void Initialize() { Title = "Library Project"; ExitButton = new ConsoleButton("Exit"); SaveData = new ConsoleButton("Save"); Languages = new ConsoleList("Languages"); ExitButton.OnClick += OnExitButtonClick; OnStart += MainMenu_OnStart; SaveData.OnClick += SaveData_OnClick; Controls.Add(ExitButton); Controls.Add(SaveData); Controls.Add(Languages); }
public async Task OnButtonClickAsync(ConsoleButton consoleButton) { var record = await RetrieveRecordAsync(); var resourceGroupId = 0; //If no db record exists, get the Resource Pool for the agent and add it to the Job record if (record == null) { resourceGroupId = await WorkspaceQueryHelper.GetResourcePoolAsync(SvcManager, ExecutionIdentity.System, Helper.GetActiveCaseID()); } if (consoleButton.Name == Constant.Buttons.SUBMIT) { if (record == null && resourceGroupId > 0) { await InsertExportJobToManagerQueueAsync(DbContextEdds, WorkspaceArtifactId, CurrentArtifactId, CurrentUserArtifactId, Constant.Status.Queue.NotStarted, resourceGroupId); await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, Identity, Constant.Guids.ObjectType.MarkupUtilityReproduceJob, CurrentArtifactId, Constant.Guids.Field.MarkupUtilityReproduceJob.Status, Constant.Status.Job.SUBMITTED); } } else if (consoleButton.Name == Constant.Buttons.CANCEL) { if (record == null && resourceGroupId > 0) { await UpdateJobStatusAsync(SvcManager, WorkspaceArtifactId, Identity, Constant.Guids.ObjectType.MarkupUtilityReproduceJob, CurrentArtifactId, Constant.Guids.Field.MarkupUtilityReproduceJob.Status, Constant.Status.Job.CANCELREQUESTED); } } // ******************************************************************************************************* // // ********* // * * // ********* * // * * * * // * ********* // * * // ********* // // This functionality currently needs to be completed. // // If you are interested in building this functionality, please make sure to write associated unit tests. // The basic concept is that the Import Worker Agent will retrieve all the redactrions that were imported // for the selected job and delete them from the Redaction table. // ******************************************************************************************************* //else if (consoleButton.Name == Constant.Buttons.REVERT) //{ // //} }
public ButtonAction(ConsoleButton _button, int _time) { button = _button; if (_button == ConsoleButton.None) { time = 0; } if (_time >= 0) { time = _time; } else { time = -1; } }
static void Main(string[] args) { var service = new ConsoleButton { Boundary = "-", Width = 8, Height = 20, Text = "Button", InsideColor = ConsoleColor.Red, BoundaryColor = ConsoleColor.Yellow, Action = new ActionDelegate(Console.WriteLine) }; service.Button(); service.Action += new ActionDelegate(Console.WriteLine); service.Action -= new ActionDelegate(Console.WriteLine); }
/// <summary> /// Registers a new console button /// </summary> /// <param name="id">The id of the button</param> /// <param name="button">Button to register</param> /// <returns>True if registered succesfully, false otherwise</returns> public static bool RegisterButton(string id, ConsoleButton button) { if (id.Equals("all")) { LogWarning($"Trying to register command button with id '<color=white>all</color>' but '<color=white>all</color>' is not a valid id!"); return(false); } if (cmdButtons.ContainsKey(id)) { LogWarning($"Trying to register command button with id '<color=white>{id}</color>' but the ID is already registered!"); return(false); } cmdButtons.Add(id, button); return(true); }
private void Initialize() { BackButton = new ConsoleButton("Back"); //AddWord = new ConsoleButton("Add new word"); WordText = new ConsoleLabel($" {Word}"); Translations = new ConsoleList("Translations"); BackButton.OnClick += OnBackButtonClick; OnStart += WordPage_OnStart; //AddWord.OnClick += AddWord_OnClick; //ConsoleButton addNewTranslation = new ConsoleButton(" Add new one"); //addNewTranslation.OnClick += AddNewTranslation_OnClick; //Translations.Elements.Add(addNewTranslation); Controls.Add(BackButton); Controls.Add(WordText); Controls.Add(Translations); //Controls.Add(AddWord); }
public async Task OnButtonClickAsync(ConsoleButton consoleButton, IAPILog logger) { var selectedObjectType = string.Empty; var colObjectType = (ChoiceCollection)ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.ExportUtilityJob.ObjectType)].Value.Value; foreach (Choice objectType in colObjectType) { if (!objectType.IsSelected) { continue; } selectedObjectType = objectType.Name; break; } var exportManagerResultsTableName = $"{Constant.Names.TablePrefix}Export_Manager_Results_{Guid.NewGuid()}"; switch (consoleButton.Name) { case Constant.Buttons.SUBMIT: logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.SUBMIT} button clicked."); var recordExists = await DoesRecordExistAsync(); if (recordExists == false) { var resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactId(Helper.GetServicesManager(), ExecutionIdentity.System, Helper.GetActiveCaseID()); await SqlQueryHelper.InsertRowIntoExportManagerQueueAsync(Helper.GetDBContext(-1), Helper.GetActiveCaseID(), 1, Helper.GetAuthenticationManager().UserInfo.ArtifactID, ActiveArtifact.ArtifactID, resourceGroupId, selectedObjectType, exportManagerResultsTableName); } break; case Constant.Buttons.DOWNLOAD_FILE: logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.DOWNLOAD_FILE} button clicked."); var id = await RetrieveIdByArtifactIdAsync(); if (id > 0) { await SqlQueryHelper.RemoveRecordFromTableByIdAsync(Helper.GetDBContext(-1), Constant.Tables.ExportManagerQueue, id); } break; } }
public async Task <Console> GetConsoleAsync(PageEvent pageEvent, IAPILog logger) { var console = new Console { Items = new List <IConsoleItem>(), Title = "Manage Export Job" }; var submitButton = new ConsoleButton { Name = Constant.Buttons.SUBMIT, DisplayText = "Submit", ToolTip = "Click here to add this job to the queue", RaisesPostBack = true }; var downloadFileButton = new ConsoleButton { Name = Constant.Buttons.DOWNLOAD_FILE, DisplayText = "Download File", ToolTip = "Click here to download the export file", RaisesPostBack = true }; if (pageEvent == PageEvent.PreRender) { var recordExists = await DoesRecordExistAsync(); if (recordExists) { submitButton.Enabled = false; downloadFileButton.Enabled = true; } else { submitButton.Enabled = true; downloadFileButton.Enabled = false; } } console.Items.Add(submitButton); console.Items.Add(downloadFileButton); return(console); }
public async Task OnButtonClickAsync(ConsoleButton consoleButton, IAPILog logger) { bool recordExists; var selectedObjectType = ActiveArtifact.Fields[GetArtifactIdByGuid(Constant.Guids.Field.ExportUtilityJob.ObjectType)].Value.Value.ToString(); switch (consoleButton.Name) { case Constant.Buttons.VALIDATE: logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.VALIDATE} button clicked."); recordExists = await DoesRecordExistAsync(); if (recordExists == false) { Int32 resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactId(Helper.GetServicesManager(), ExecutionIdentity.System, Helper.GetActiveCaseID()); await SqlQueryHelper.InsertRowIntoImportManagerQueueAsync(Helper.GetDBContext(-1), Helper.GetActiveCaseID(), 1, Helper.GetAuthenticationManager().UserInfo.ArtifactID, ActiveArtifact.ArtifactID, resourceGroupId, selectedObjectType, Constant.ExportUtilityJob.JobType.VALIDATE); } break; case Constant.Buttons.SUBMIT: logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.SUBMIT} button clicked."); recordExists = await DoesRecordExistAsync(); if (recordExists == false) { Int32 resourceGroupId = await ArtifactQueries.GetResourcePoolArtifactId(Helper.GetServicesManager(), ExecutionIdentity.System, Helper.GetActiveCaseID()); await SqlQueryHelper.InsertRowIntoImportManagerQueueAsync(Helper.GetDBContext(-1), Helper.GetActiveCaseID(), 1, Helper.GetAuthenticationManager().UserInfo.ArtifactID, ActiveArtifact.ArtifactID, resourceGroupId, selectedObjectType, Constant.ExportUtilityJob.JobType.VALIDATE_SUBMIT); } break; case Constant.Buttons.CANCEL: logger.LogDebug($"{Constant.Names.ApplicationName} - {Constant.Buttons.CANCEL} button clicked."); var id = await RetrieveIdByArtifactIdAsync(); if (id > 0) { await SqlQueryHelper.RemoveRecordFromTableByIdAsync(Helper.GetDBContext(-1), Constant.Tables.ImportManagerQueue, id); } break; } }
private void Initialize() { BackButton = new ConsoleButton("Back"); AddWord = new ConsoleButton("Add new word"); WordInput = new ConsoleInput("New word"); Translations = new ConsoleList("Translations"); BackButton.OnClick += OnBackButtonClick; OnStart += AddNewWordPage_OnStart; AddWord.OnClick += AddWord_OnClick; ConsoleButton addNewTranslation = new ConsoleButton(" Add new one"); addNewTranslation.OnClick += AddNewTranslation_OnClick; Translations.Elements.Add(addNewTranslation); Controls.Add(BackButton); Controls.Add(WordInput); Controls.Add(Translations); Controls.Add(AddWord); }
public override void OnButtonClick(ConsoleButton consoleButton) { bool result = true; int activeWorkspaceId = this.Helper.GetActiveCaseID(); //Use the name to determine which button was clicked. switch (consoleButton.Name) { case INSERT_JOB_BUTTON_NAME: //The user clicked the button for the insert job so add the job to the queue table on the EDDS database. result = insertJob(this.Helper.GetDBContext(activeWorkspaceId), this.Helper.GetAuthenticationManager().UserInfo.FullName, this.ActiveArtifact); break; case DELETE_JOB_BUTTON_NAME: result = deleteJob(this.Helper.GetDBContext(activeWorkspaceId), this.ActiveArtifact.ArtifactID); break; } }
/// <summary> /// Executes the appropriate action for the clicked button. /// </summary> /// <param name="consoleButton">The button that was clicked.</param> public sealed override void OnButtonClick(ConsoleButton consoleButton) { if (!consoleButton.RaisesPostBack) { return; // client-side event } var button = Buttons.Single(x => x.Button.Name == consoleButton.Name); try { button.ServerOnClick(); } catch (kCura.Relativity.Client.APIException ex) { // Api Exception doesn't bubble up well throw new Exception(ex.ToString()); } catch (Exception ex) { throw new Exception(ex.ToString()); } }
public void TestConsoleButtonEventIsFiredWhenClicked() { var box = new ConsoleButton<ConsoleColor>( 10, 10, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Blue, ConsoleColor.Blue, "test"); box.ClickEvent += (sender, args) => { this.isButtonClicked = true; }; this.isButtonClicked = false; box.Click(); Assert.AreEqual(this.isButtonClicked, true, "Button click do not trigger an event!"); }
public void TestConsoleButtonTriggerColorsAreFlipped() { var box = new ConsoleButton<ConsoleColor>( 10, 10, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Blue, ConsoleColor.Blue, "test"); box.Trigger(); Assert.AreEqual(box.ColorBackSelected, ConsoleColor.Black, "Invalid color after trigger"); Assert.AreEqual(box.ColorTextSelected, ConsoleColor.Black, "Invalid color after trigger"); box.Trigger(); Assert.AreEqual(box.ColorBackSelected, ConsoleColor.Blue, "Invalid color after trigger"); Assert.AreEqual(box.ColorTextSelected, ConsoleColor.Blue, "Invalid color after trigger"); }
public void TestConsoleButtonWithNullColorsShouldThrow() { var box = new ConsoleButton<string>(10, 10, "c1", "c2", null, null, "test"); }
public void TestConsoleButtonWithValidValuesShouldContainCorrectValues() { var box = new ConsoleButton<ConsoleColor>( 10, 10, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, ConsoleColor.Black, "test"); Assert.AreEqual(box.SizeX, 10, "Invalid parameter"); Assert.AreEqual(box.SizeY, 10, "Invalid parameter"); Assert.AreEqual(box.ColorBackground, ConsoleColor.Black, "Invalid parameter"); Assert.AreEqual(box.ColorText, ConsoleColor.Black, "Invalid parameter"); Assert.AreEqual(box.ColorTextSelected, ConsoleColor.Black, "Invalid parameter"); Assert.AreEqual(box.ColorBackSelected, ConsoleColor.Black, "Invalid parameter"); Assert.AreEqual(box.Text, "test", "Invalid parameter"); }