Esempio n. 1
0
        public ExperimentConfiguratorViewModel()
        {
            _expParams = ExperimentParams.GetExperimentParams;

            PlateEnabled           = false;
            CompoundPlateEnabled   = false;
            MethodEnabled          = false;
            ImagerEnabled          = false;
            RuntimeAnalysisEnabled = false;
            RunEnabled             = false;


            RedArrowFileUri   = "pack://application:,,,/Waveguide;component/Images/red_arrow_2.png";
            GreenCheckFileUri = "pack://application:,,,/Waveguide;component/Images/green_check_1.png";
            BlankFileUri      = "pack://application:,,,/Waveguide;component/Images/blank.png";

            // Status: 0 = not yet enabled, i.e. something before it needs input (blank)
            //         1 = needs input (red arrow)
            //         2 = properly completed (green check)
            ProjectStatus            = STEP_STATUS.NEEDS_INPUT;
            MethodStatus             = STEP_STATUS.WAITING_FOR_PREDECESSOR;
            PlateConfigStatus        = STEP_STATUS.WAITING_FOR_PREDECESSOR;
            RuntimeAnalysisStatus    = STEP_STATUS.WAITING_FOR_PREDECESSOR;
            StaticRatioStatus        = STEP_STATUS.WAITING_FOR_PREDECESSOR;
            ControlSubtractionStatus = STEP_STATUS.WAITING_FOR_PREDECESSOR;
            DynamicRatioStatus       = STEP_STATUS.WAITING_FOR_PREDECESSOR;

            MethodFilter = 0;
        }
Esempio n. 2
0
        public MainWindowViewModel()
        {
            WindowTitle = "WaveGuide";

            _expParams = ExperimentParams.GetExperimentParams;

            CameraTargetTemp = GlobalVars.Instance.CameraTargetTemperature;
            CameraTempString = "-";
            CoolingOn        = true;

            InsideTargetTemp = GlobalVars.Instance.InsideTargetTemperature;
            InsideTempString = "-";
            HeatingOn        = false;

            DoorStatus = DOOR_STATUS.OPEN;

            CameraTempReady = false;

            InsideTempReady = false;

            ShowRunExperimentPanel = false;

            ShowHeaterOnOffPopup = false;

            ExperimentRunState = ViewModel_RunExperimentControl.RUN_STATE.NEEDS_INPUT;
        }
Esempio n. 3
0
        private void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            string        username = txtUserName.Text;
            string        password = txtPassword.Password;
            UserContainer user;

            bool success = wgDB.IsServerConnected();

            if (success)
            {
                success = wgDB.GetUserByUsername(username, out user);

                if (success)
                {
                    if (user != null)
                    {
                        if (user.Password == password)
                        {
                            GlobalVars.Instance.UserID          = user.UserID;
                            GlobalVars.Instance.UserDisplayName = user.Firstname + " " + user.Lastname;
                            GlobalVars.Instance.UserRole        = user.Role;

                            ExperimentParams expParams = ExperimentParams.GetExperimentParams;
                            expParams.user = user;

                            LoginSuccess = true;

                            Close();
                        }
                        else
                        {  // password not correct
                            MessageBoxResult result = MessageBox.Show("Incorrect Password", "Login Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                        }
                    }
                    else
                    {
                        // username not found
                        MessageBoxResult result = MessageBox.Show("Username: '******' not found", "Login Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                }
                else
                {
                    // database query issue
                    MessageBoxResult result = MessageBox.Show("Database query failure!", "Database Failure", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                // database connection issue
                string           errMsg = wgDB.GetLastErrorMsg();
                MessageBoxResult result = MessageBox.Show(errMsg, "Database Connection Failure",
                                                          MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 4
0
        /////////////////////////////////////////////////////////////////////////////////////////////
        ///////////////////////////////////////////////////////////////////////////////////////////
        // Constructor

        public VWorks()
        {
            m_expParams = ExperimentParams.GetExperimentParams;

            // Set up VWorks Event handlers
            try
            {
                VWorks_ = new VWorks4Lib.VWorks4API();
            }
            catch (Exception e)
            {
                m_vworksOK = false;
                PostVWorksCommand(VWORKS_COMMAND.Error, "VWorks Exception", e.Message);
                return;
            }

            if (VWorks_ != null)
            {
                m_vworksOK = true;

                VWorks_.InitializationComplete += new VWorks4Lib._IVWorks4APIEvents_InitializationCompleteEventHandler(VWorks__InitializationComplete);

                // uncomment the following 2 lines if you want to see the VWorks log messages (they are already shown in VWorks)
                logEventHandler     = new VWorks4Lib._IVWorks4APIEvents_LogMessageEventHandler(VWorks__LogMessage);
                VWorks_.LogMessage += logEventHandler;

                VWorks_.MessageBoxAction   += new VWorks4Lib._IVWorks4APIEvents_MessageBoxActionEventHandler(VWorks__MessageBoxAction);
                VWorks_.ProtocolAborted    += new VWorks4Lib._IVWorks4APIEvents_ProtocolAbortedEventHandler(VWorks__ProtocolAborted);
                VWorks_.ProtocolComplete   += new VWorks4Lib._IVWorks4APIEvents_ProtocolCompleteEventHandler(VWorks__ProtocolComplete);
                VWorks_.RecoverableError   += new VWorks4Lib._IVWorks4APIEvents_RecoverableErrorEventHandler(VWorks__RecoverableError);
                VWorks_.UnrecoverableError += new VWorks4Lib._IVWorks4APIEvents_UnrecoverableErrorEventHandler(VWorks__UnrecoverableError);
                VWorks_.UserMessage        += new VWorks4Lib._IVWorks4APIEvents_UserMessageEventHandler(VWorks__UserMessage);

                //TODO Change this Login this seems like a security risk.
                VWorks_.Login(GlobalVars.Instance.VWorksUsername, GlobalVars.Instance.VWorksPassword);
                VWorks_.ShowVWorks(false);

                m_stopwatch = new Stopwatch();

                m_protocolStartTime = new DateTime();
            }
            else
            {
                m_vworksOK = false;
            }
        }