Exemple #1
0
        public ReportWriter(ProjectContainer project, ExperimentContainer experiment)
        {
            m_initializationSuccess = false;
            m_lastErrorString       = "";

            m_waveguideReportDirectory = GlobalVars.DefaultWaveGuideReportFileDirectory;
            m_format = REPORT_FILEFORMAT.EXCEL;

            m_wgDB       = new WaveguideDB();
            m_project    = project;
            m_experiment = experiment;


            bool success = m_wgDB.GetMethod(m_experiment.MethodID, out m_method);

            if (m_method == null)
            {
                success = false;
            }
            if (success)
            {
                success = m_wgDB.GetPlate(m_experiment.PlateID, out m_plate);
                if (m_plate == null)
                {
                    success = false;
                }
                if (success)
                {
                    success = m_wgDB.GetUser(m_plate.OwnerID, out m_user);
                    if (m_user == null)
                    {
                        success = false;
                    }
                    if (success)
                    {
                        success = m_wgDB.GetPlateType(m_plate.PlateTypeID, out m_plateType);
                        if (m_plateType == null)
                        {
                            success = false;
                        }
                    }
                }
            }

            m_initializationSuccess = success;
        }
Exemple #2
0
        public ExperimentExplorer()
        {
            m_maxPixelValue = 65535;

            InitializeComponent();
            m_vm        = new ExperimentExplorer_ViewModel();
            DataContext = m_vm;

            m_db = new WaveguideDB();


            m_imageTool = new ImageTool();
            bool success = m_imageTool.Init();

            m_rangeLower = 0;
            m_rangeUpper = m_maxPixelValue;

            byte[] red, green, blue;
            m_vm.colorModel.BuildColorMapForGPU(out red, out green, out blue, m_maxPixelValue);

            m_imageTool.Set_ColorMap(red, green, blue, m_maxPixelValue);



            try
            {
                if (!GetUserList())
                {
                    System.Windows.MessageBox.Show("Failed to Get User List from Database!", "Database Error",
                                                   MessageBoxButton.OK, MessageBoxImage.Error);
                }
                else
                {
                    if (GlobalVars.Instance.UserRole == GlobalVars.USER_ROLE_ENUM.ADMIN)
                    {
                        UserPB.IsEnabled = true;
                    }
                    else
                    {
                        UserPB.IsEnabled = false;
                    }

                    UserContainer user;
                    if (m_db.GetUser(GlobalVars.Instance.UserID, out user))
                    {
                        m_vm.user = user;

                        if (m_vm.user != null)
                        {
                            GetProjectList(m_vm.user.UserID);
                        }
                        m_vm.plates.Clear();
                        m_vm.experiments.Clear();
                        m_vm.indicators.Clear();
                        m_vm.images.Clear();
                        ClearImage();

                        m_vm.userStatus       = ExperimentExplorer_ViewModel.STEP_STATUS.READY;
                        m_vm.projectStatus    = ExperimentExplorer_ViewModel.STEP_STATUS.NEEDS_INPUT;
                        m_vm.plateStatus      = ExperimentExplorer_ViewModel.STEP_STATUS.WAITING_FOR_PREDECESSOR;
                        m_vm.experimentStatus = ExperimentExplorer_ViewModel.STEP_STATUS.WAITING_FOR_PREDECESSOR;
                        SetExperimentDescriptionText();
                    }
                    else
                    {
                        m_vm.userStatus       = ExperimentExplorer_ViewModel.STEP_STATUS.NEEDS_INPUT;
                        m_vm.projectStatus    = ExperimentExplorer_ViewModel.STEP_STATUS.WAITING_FOR_PREDECESSOR;
                        m_vm.plateStatus      = ExperimentExplorer_ViewModel.STEP_STATUS.WAITING_FOR_PREDECESSOR;
                        m_vm.experimentStatus = ExperimentExplorer_ViewModel.STEP_STATUS.WAITING_FOR_PREDECESSOR;
                        SetExperimentDescriptionText();
                    }
                }
            }
            catch (Exception ex)
            {
                System.Windows.MessageBox.Show("Failed to Get User List from Database!\n" + ex.Message,
                                               "Database Error",
                                               MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }