/// <summary> /// Initialise the form with the Worker Object /// </summary> /// <param name="currentWorker"></param> public FormWorkerOrCommunityDetail(Worker currentWorker, ExperimentModel relatedExperimentItem) { InitializeComponent(); this.currentWorker = currentWorker; //Display the workerId in the form title this.Text = "[Worker]" + currentWorker.WorkerId; this.relatedExperimentItem = relatedExperimentItem; this.labelForWorkerId.Text = currentWorker.WorkerId; this.labelModelDetail.Text = relatedExperimentItem.ToString(); RunType[] runTypesHaveWorkerMatrices = { RunType.DawidSkene, RunType.BCC, RunType.CBCC }; //Only display the confusion matrices if it matches the runType if (runTypesHaveWorkerMatrices.Contains(relatedExperimentItem.runType)) { indexOfExperimentItem = MainPage.mainPageForm.currentExperimentSetting.GetExperimenModelIndex(relatedExperimentItem); printableConfusionMatrix = MainPage.mainPageForm.currentExperimentSetting.getWorkerResults(indexOfExperimentItem, currentWorker.WorkerId); LoadConfusionMatrix(); //SetUpChart(); labelConfusionMatrix.Text = MainPage.mainPageForm.currentExperimentSetting.getConfusionMatrixString(printableConfusionMatrix); textBoxConfusionMatrix.Text = labelConfusionMatrix.Text; //start background thread to update the confusion matrice accordingly if it is activeLearning if (MainPage.mainPageForm.currentExperimentSetting.experimentType == ExperimentType.ActiveLearning) { backgroundUpdateConfusionMatrix.RunWorkerAsync(); } } else //for the RunType that does not have confusion matrix { //hide all controls related to confusion matrix confusionMatrixGraph.Visible = false; textBoxConfusionMatrix.Visible = false; } }
/// <summary> /// Display Popup of the corresponding popup /// </summary> /// <param name="currentComboBox"></param> /// <param name="currentDataGridView"></param> /// <param name="currentType"></param> private void DisplayPopUp(ComboBox currentComboBox, DataGridView currentDataGridView, string currentType) { //At least one row is selected if (currentDataGridView.SelectedRows.Count >= 1) { ExperimentModel relatedExperimentItem = currentExperimentSetting.GetExperimentModel(currentComboBox.SelectedIndex); //for each worker row selected for (int i = 0; i < currentDataGridView.SelectedRows.Count; i++) { //open a new form showing the worker's detail int currentSelectedRowIndex = currentDataGridView.SelectedRows[i].Index; KryptonForm currentForm = null; String currentId = currentDataGridView.Rows[currentSelectedRowIndex].Cells[0].Value.ToString(); if (currentType == "worker") { Worker tempWorker = new Worker(); tempWorker.WorkerId = currentId; currentForm = new FormWorkerOrCommunityDetail(tempWorker, relatedExperimentItem); } //Open task form else if (currentType == "task") { currentForm = new FormTaskDetails(currentId, relatedExperimentItem); } //Open the Community Form else { currentForm = new FormWorkerOrCommunityDetail(currentSelectedRowIndex, relatedExperimentItem); } //Add this openedForm into the openForms List openedForms.Add(currentForm); currentForm.Show(); } //End For selected dataGridViewForInnerWorker }// if there is more than one selected rows } //End DisplayPopUp