Exemple #1
0
        private void buttonApply_Click(object sender, EventArgs e)
        {
            FormForDRCDesignValidation FFDRCVal = new FormForDRCDesignValidation();

            PanelForPlatesSelection PanelForPlates = new PanelForPlatesSelection(true, null, false);
            PanelForPlates.Width = FFDRCVal.panelForPlatesName.Width;
            PanelForPlates.Height = FFDRCVal.panelForPlatesName.Height;
            FFDRCVal.panelForPlatesName.Controls.Add(PanelForPlates);

            if (!this.radioButtonConcentrationsManual.Checked) FFDRCVal.label.Text = "";

            if (FFDRCVal.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            this.Visible = false;

            //cScreening CurrentScreen = cGlobalInfo.CurrentScreening;
            int IdxGroup = 0;

            foreach (cPlate TmpPlate in PanelForPlates.GetListSelectedPlates())
            {
                TmpPlate.ListDRCRegions = new cListDRCRegion();

                int SizeX, SizeY;
                if (TemplateRegion.IsConcentrationHorizontal)
                {
                    SizeX = TemplateRegion.NumConcentrations;
                    SizeY = TemplateRegion.NumReplicate;
                }
                else
                {
                    SizeX = TemplateRegion.NumReplicate;
                    SizeY = TemplateRegion.NumConcentrations;
                }

                int NumRepeatX = (AssociatedPlate.ParentScreening.Columns - (TemplateRegion.PosXMin - 1)) / SizeX;
                int NumRepeatY = (AssociatedPlate.ParentScreening.Rows - (TemplateRegion.PosYMin - 1)) / SizeY;

                if (!this.radioButtonOrientationColumn.Checked)
                {
                    for (int j = 0; j < NumRepeatY; j++)
                        for (int i = 0; i < NumRepeatX; i++)
                        {
                            cDRC_Region TempRegion = new cDRC_Region(TmpPlate, (int)this.numericUpDownConcentrationNumber.Value, (int)this.numericUpDownReplication.Value, i * SizeX + (TemplateRegion.PosXMin - 1), j * SizeY + (TemplateRegion.PosYMin - 1), true);
                            TmpPlate.ListDRCRegions.AddNewRegion(TempRegion);

                            // Update the concentration from the manual entry

                            for (int Replicate = 0; Replicate < TempRegion.NumReplicate; Replicate++)
                            {
                                cWell[] TmpList = TempRegion.GetlistReplicate(Replicate);
                                for (int IdxConc = 0; IdxConc < TmpList.Length; IdxConc++)
                                {

                                    if ((this.radioButtonConcentrationsManual.Checked) && (TmpList[IdxConc] != null))
                                        TmpList[IdxConc].ListProperties.UpdateValueByName("Concentration", (double)Convert.ToDouble(dataGridViewForConcentration.Rows[IdxConc].Cells[1].Value.ToString(), CultureInfo.CreateSpecificCulture("en-US")));

                                    if ((FFDRCVal.checkBoxUpdateGroupID.Checked) && (TmpList[IdxConc] != null))
                                        TmpList[IdxConc].ListProperties.UpdateValueByName("Group", (int)IdxGroup);

                                }
                            }

                            IdxGroup++;

                        }
                }
                else
                {
                    for (int j = 0; j < NumRepeatY; j++)
                        for (int i = 0; i < NumRepeatX; i++)
                        {
                            cDRC_Region TempRegion = new cDRC_Region(TmpPlate, (int)this.numericUpDownConcentrationNumber.Value, (int)this.numericUpDownReplication.Value, i * SizeX + (TemplateRegion.PosXMin - 1), j * SizeY + (TemplateRegion.PosYMin - 1), false);
                            TmpPlate.ListDRCRegions.AddNewRegion(TempRegion);

                            // Update the concentration from the manual entry
                            //   if (this.radioButtonConcentrationsManual.Checked)
                            {
                                for (int Replicate = 0; Replicate < TempRegion.NumReplicate; Replicate++)
                                {
                                    cWell[] TmpList = TempRegion.GetlistReplicate(Replicate);
                                    for (int IdxConc = 0; IdxConc < TmpList.Length; IdxConc++)
                                    {
                                        if ((this.radioButtonConcentrationsManual.Checked) && (TmpList[IdxConc] != null))
                                            TmpList[IdxConc].ListProperties.UpdateValueByName("Concentration", Convert.ToDouble(dataGridViewForConcentration.Rows[IdxConc].Cells[1].Value.ToString()));

                                        if ((FFDRCVal.checkBoxUpdateGroupID.Checked) && (TmpList[IdxConc] != null))
                                            TmpList[IdxConc].ListProperties.UpdateValueByName("Group", (int)IdxGroup);
                                    }
                                }
                            }
                            IdxGroup++;
                        }
                }
            }

            //cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().Refresh3D(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);
        }
        private void buttonApply_Click(object sender, EventArgs e)
        {
            this.Visible = false;

            if (this.radioButtonConcentrationsManual.Checked)
            {
                System.Windows.Forms.DialogResult ResWin = MessageBox.Show("By applying this process, concentration values of the concerned wells will be modified ! Proceed ?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
                if (ResWin == System.Windows.Forms.DialogResult.No) return;
            }

            cScreening CurrentScreen = this.ListWells[0].AssociatedPlate.ParentScreening;

            //this.ListWells[0].AssociatedPlate.ListDRCRegions = new cListDRCRegion();

            foreach (cPlate TmpPlate in CurrentScreen.ListPlatesActive)
            {
                TmpPlate.ListDRCRegions = new cListDRCRegion();

                int SizeX, SizeY;
                if (TemplateRegion.IsConcentrationHorizontal)
                {
                    SizeX = TemplateRegion.NumConcentrations;
                    SizeY = TemplateRegion.NumReplicate;
                }
                else
                {
                    SizeX = TemplateRegion.NumReplicate;
                    SizeY = TemplateRegion.NumConcentrations;
                }

                int NumRepeatX = (this.ListWells[0].AssociatedPlate.ParentScreening.Columns - (TemplateRegion.PosXMin - 1)) / SizeX;
                int NumRepeatY = (this.ListWells[0].AssociatedPlate.ParentScreening.Rows - (TemplateRegion.PosYMin - 1)) / SizeY;

                if (!this.radioButtonOrientationColumn.Checked)
                {
                    for (int j = 0; j < NumRepeatY; j++)
                        for (int i = 0; i < NumRepeatX; i++)
                        {
                            cDRC_Region TempRegion = new cDRC_Region(TmpPlate, (int)this.numericUpDownConcentrationNumber.Value, (int)this.numericUpDownReplication.Value, i * SizeX + (TemplateRegion.PosXMin - 1), j * SizeY + (TemplateRegion.PosYMin - 1), true);
                            TmpPlate.ListDRCRegions.AddNewRegion(TempRegion);

                            // Update the concentration from the manual entry
                            if (this.radioButtonConcentrationsManual.Checked)
                            {
                                for (int Replicate = 0; Replicate < TempRegion.NumReplicate; Replicate++)
                                {
                                    cWell[] TmpList = TempRegion.GetlistReplicate(Replicate);
                                    for (int IdxConc = 0; IdxConc < TmpList.Length; IdxConc++)
                                        if (TmpList[IdxConc] != null) TmpList[IdxConc].Concentration = Convert.ToDouble(dataGridViewForConcentration.Rows[IdxConc].Cells[1].Value.ToString());
                                }
                            }
                        }
                }
                else
                {
                    for (int j = 0; j < NumRepeatY; j++)
                        for (int i = 0; i < NumRepeatX; i++)
                        {
                            cDRC_Region TempRegion = new cDRC_Region(TmpPlate, (int)this.numericUpDownConcentrationNumber.Value, (int)this.numericUpDownReplication.Value, i * SizeX + (TemplateRegion.PosXMin - 1), j * SizeY + (TemplateRegion.PosYMin - 1), false);
                            TmpPlate.ListDRCRegions.AddNewRegion(TempRegion);

                            // Update the concentration from the manual entry
                            if (this.radioButtonConcentrationsManual.Checked)
                            {
                                for (int Replicate = 0; Replicate < TempRegion.NumReplicate; Replicate++)
                                {
                                    cWell[] TmpList = TempRegion.GetlistReplicate(Replicate);
                                    for (int IdxConc = 0; IdxConc < TmpList.Length; IdxConc++)
                                        if (TmpList[IdxConc] != null) TmpList[IdxConc].Concentration = Convert.ToDouble(dataGridViewForConcentration.Rows[IdxConc].Cells[1].Value.ToString());
                                }
                            }
                        }
                }
            }

            CurrentScreen.GetCurrentDisplayPlate().Refresh3D(CurrentScreen.ListDescriptors.CurrentSelectedDescriptor);
        }