예제 #1
0
        public ExperimentConfigurator()
        {
            VM = new ExperimentConfiguratorViewModel();

            InitializeComponent();

            wgDB = new WaveguideDB();



            m_imager = null;

            this.DataContext = VM;

            PlateTypeContainer ptc;
            bool success = wgDB.GetDefaultPlateType(out ptc);

            if (success)
            {
                WellSelection.Init(ptc.Rows, ptc.Cols);
                VM.ExpParams.plateType         = ptc;
                PlateTypeComboBox.SelectedItem = ptc;
            }
            else
            {
                WellSelection.Init(16, 24);
                VM.ExpParams.plateType = null;
                VM.ExpParams.mask      = null;
            }

            WellSelection.NewWellSetSelected += WellSelection_NewWellSetSelected;
        }
예제 #2
0
        private void MaskComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if (m_imager != null)
            {
                // get selection
                VM.ExpParams.mask = (MaskContainer)MaskComboBox.SelectedItem;
                m_imager.m_mask   = VM.ExpParams.mask;

                VM.SetExperimentStatus();


                if (VM.ExpParams.mask != null)
                {
                    WellSelection.Init(VM.ExpParams.mask.Rows, VM.ExpParams.mask.Cols);

                    if (VM.ExpParams.indicatorList != null)
                    {
                        foreach (ExperimentIndicatorContainer expInd in VM.ExpParams.indicatorList)
                        {
                            expInd.MaskID = VM.ExpParams.mask.MaskID;
                        }
                    }
                }
            }
        }
예제 #3
0
        private void PlateTypeComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ComboBox cbox = (ComboBox)sender;

            if (cbox.SelectedItem == null)
            {
                return;
            }

            if (cbox.SelectedItem.GetType() == typeof(PlateTypeContainer))
            {
                PlateTypeContainer ptc = (PlateTypeContainer)cbox.SelectedItem;

                if (wgDB == null)
                {
                    wgDB = new WaveguideDB();
                }

                bool success = wgDB.GetAllMasksForPlateType(ptc.PlateTypeID);

                if (success)
                {
                    WellSelection.Init(ptc.Rows, ptc.Cols);

                    VM.MaskList.Clear();
                    VM.ExpParams.mask         = null;
                    MaskComboBox.SelectedItem = null;

                    foreach (MaskContainer mc in wgDB.m_maskList)
                    {
                        VM.MaskList.Add(mc);

                        if (mc.IsDefault)
                        {
                            VM.ExpParams.mask         = mc;
                            MaskComboBox.SelectedItem = mc;
                        }
                    }
                }
            }
        }
예제 #4
0
        public bool SetConfiguration(ExperimentConfiguration config)
        {
            bool success = true;

            // run on UI thread
            Application.Current.Dispatcher.Invoke(new Action(() => {
                RefreshProjectList();

                bool projectOK   = false;
                bool methodOK    = false;
                bool plateTypeOK = false;
                bool maskOK      = false;

                // load project
                foreach (ProjectContainer pc in VM.ProjectList)
                {
                    if (pc.ProjectID == config.project.ProjectID)
                    {
                        ProjectComboBox.SelectedItem = pc;
                        projectOK = true;

                        // load method
                        foreach (MethodContainer m in VM.MethodList)
                        {
                            if (m.MethodID == config.method.MethodID)
                            {
                                MethodComboBox.SelectedItem = m;
                                methodOK = true;

                                // load plate type
                                foreach (PlateTypeContainer ptc in VM.PlateTypeList)
                                {
                                    if (ptc.PlateTypeID == config.plateType.PlateTypeID)
                                    {
                                        PlateTypeComboBox.SelectedItem = ptc;
                                        plateTypeOK = true;

                                        // load mask
                                        foreach (MaskContainer mask in VM.MaskList)
                                        {
                                            if (mask.MaskID == config.mask.MaskID)
                                            {
                                                MaskComboBox.SelectedItem = mask;
                                                maskOK = true;

                                                // set Fo Frames
                                                VM.ExpParams.numFoFrames = config.numFoFrames;

                                                // set control subtraction wells
                                                VM.ExpParams.controlSubtractionWellList = config.controlSubtWells;
                                                WellSelection.Init(mask.Rows, mask.Cols, config.controlSubtWells);

                                                // set dynamic ratio
                                                foreach (ExperimentIndicatorContainer eic in VM.ExpParams.indicatorList)
                                                {
                                                    if (eic.Description == config.dynamicRatioNum.Description)
                                                    {
                                                        DynamicRatioNumeratorComboBox.SelectedItem = eic;
                                                    }
                                                    if (eic.Description == config.dynamicRatioDen.Description)
                                                    {
                                                        DynamicRatioDenominatorComboBox.SelectedItem = eic;
                                                    }
                                                }


                                                break;
                                            }
                                        }

                                        break;
                                    }
                                }

                                break;
                            }
                        }

                        break;
                    }
                }

                success = (projectOK && methodOK && plateTypeOK && maskOK);
            }));



            return(success);
        }