Пример #1
0
        public bool StartVWorks()
        {
            bool success = true;

            m_vworks = new VWorks();
            GlobalVars.Instance.VWorks = m_vworks;


            if (!m_vworks.m_vworksOK)
            {
                PostMessage("VWorks Failed to Start!");
                success = false;
            }
            else if (!m_vworks.VWorks_CreatedSuccessfully())
            {
                PostMessage("VWorks Creation Failure!");
                success = false;
            }

            if (success)
            {
                m_vworks.PostVWorksCommandEvent += MyRunExperimentControl.m_vworks_PostVWorksCommandEvent;
            }

            return(success);
        }
Пример #2
0
        void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            // catch closing event caused by hitting X button if experiment is running

            if (VM.RunState == RunExperiment_ViewModel.RUN_STATE.RUNNING)
            {
                e.Cancel = true;

                MessageBoxResult result = MessageBox.Show("Are you sure you want to Abort?", "Abort Experiment",
                                                          MessageBoxButton.YesNo, MessageBoxImage.Question);

                switch (result)
                {
                case MessageBoxResult.Yes:
                    RunPB_Click(null, null);     // this will Abort the Experiment (calling RunPB_Click when VM.RunState == RUNNING)
                    break;

                case MessageBoxResult.No:
                    break;
                }
            }

            // Good time to unload/shutdown VWorks


            m_vworks = null;

            // set this if you want to cancel the close event: e.Cancel = true;
        }
Пример #3
0
        public RunExperiment(Imager imager, TaskScheduler uiTask)
        {
            //if(vworks == null)
            //{
            //    MessageBox.Show("VWorks not running!", "VWorks Error", MessageBoxButton.OK, MessageBoxImage.Error);
            //    return;
            //}

            m_vworks = new VWorks();

            InitializeComponent();

            m_wgDB = new WaveguideDB();

            VM = new RunExperiment_ViewModel();

            m_uiTask = uiTask;

            m_dispatcher = this.Dispatcher;

            this.DataContext = VM;

            m_timer          = new DispatcherTimer();
            m_timer.Tick    += m_timer_Tick;
            m_timer.Interval = TimeSpan.FromMilliseconds(1000);


            VM.RunState = RunExperiment_ViewModel.RUN_STATE.WAITING_TO_RUN;


            m_imager = imager;

            if (m_imager == null)
            {
                m_imager = new Imager();
                m_imager.Initialize();
            }

            m_imager.m_cameraEvent      += m_imager_cameraEvent;
            m_imager.m_temperatureEvent += m_imager_temperatureEvent;


            m_vworks.PostVWorksCommandEvent += m_vworks_PostVWorksCommandEvent;


            m_simulationRunning = false;
            m_indicatorIndex    = 0;
            m_imageIndex        = 0;

            LoadDefaultColorModel();


            // catch close event caused by clicking X button
            this.Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);
        }
Пример #4
0
        string m_timestamp;        // timestamp of last command message received

        public MainWindow()
        {
            InitializeComponent();

            Application.Current.MainWindow.WindowState = WindowState.Maximized;

            m_wgDB = new WaveguideDB();
            m_enclosureCameraViewer = null;


            switch (GlobalVars.Instance.UserRole)
            {
            case GlobalVars.USER_ROLE_ENUM.ADMIN:
                break;

            case GlobalVars.USER_ROLE_ENUM.USER:
                UsersTab.Visibility       = Visibility.Collapsed;
                FiltersTab.Visibility     = Visibility.Collapsed;
                PlateTypesTab.Visibility  = Visibility.Collapsed;
                MaintenanceTab.Visibility = Visibility.Collapsed;
                break;

            case GlobalVars.USER_ROLE_ENUM.OPERATOR:
                MethodsTab.Visibility     = Visibility.Collapsed;
                ProjectsTab.Visibility    = Visibility.Collapsed;
                UsersTab.Visibility       = Visibility.Collapsed;
                FiltersTab.Visibility     = Visibility.Collapsed;
                PlateTypesTab.Visibility  = Visibility.Collapsed;
                MaintenanceTab.Visibility = Visibility.Collapsed;
                break;
            }



            m_imager      = null;
            m_vworks      = null;
            m_vworksReady = false;



            VM = new MainWindowViewModel();

            this.DataContext = VM;

            VM.WindowTitle = "Waveguide     " + GlobalVars.Instance.UserDisplayName + "  (" + GlobalVars.Instance.UserRole.ToString() + ")";

            // catch close event caused by clicking X button
            this.Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);

            m_uiTask = TaskScheduler.FromCurrentSynchronizationContext();
            GlobalVars.Instance.UITask = m_uiTask;

            MyRunExperimentControl.PostMessage_RunExperimentPanelEvent += MyRunExperimentControl_PostMessage_RunExperimentPanelEvent;
            MyRunExperimentControl.BringToFrontRunExperimentPanelEvent += MyRunExperimentControl_BringToFrontRunExperimentPanelEvent;

            m_tcpServer = new SimpleTcpServer();
            m_tcpServer.ClientConnected       += M_tcpServer_ClientConnected;
            m_tcpServer.ClientDisconnected    += M_tcpServer_ClientDisconnected;
            m_tcpServer.DataReceived          += M_tcpServer_DataReceived;
            m_tcpServer.DelimiterDataReceived += M_tcpServer_DelimiterDataReceived;
            m_tcpServer.Start(GlobalVars.Instance.TCPCommand_Port);
            m_commandMessageCount = 0;

            GlobalVars.Instance.m_statusChangeEvent += StatusChangeEvent;

            GlobalVars.Instance.Status = WGStatus.ONLINE;
        }
Пример #5
0
        public MainWindow()
        {
            InitializeComponent();

            Application.Current.MainWindow.WindowState = WindowState.Maximized;

            m_wgDB = new WaveguideDB();
            m_enclosureCameraViewer = null;


            // SET Arction LightningChart Deployment License Key (this key is generated by the License manager located in C:\Program Files (x86)\Arction\LightningChart Ultimate SDK v.8\LicenseManager)
            //Set Deployment Key for Arction components
            string deploymentKey = "lgCAALwgjYPfmNIBJABVcGRhdGVhYmxlVGlsbD0yMDE4LTAyLTIxI1JldmlzaW9uPTAC/z9RMX8f5kurNjaFxccuADLxbK6lqM22zoVs0PjqOimZGOh5Of+fUyLaQXp/cIp7yMraliTZTxzfR+bGoyiCLC0r5ISOje5A2uN0gsfp0PwgAm8lPKZ/b38tTW5Bt7H5fSexpGO4Eh9zbou68P8TKA1YCTCgknu8zITZcGVxWmSAz8aRCKCofN6Hqr/IjhY5NocKN3iTd1oP5ue9OG7RbGoefmUVSTV277fOjc1TLr4RRFtZslR6iZIplFOs+i5bwfQg7UpTefFkFJNKauV0tjdqW2aWbkzysgwv8ZMmsE2ZfBPcTQbtyvnJHgaeO3JDPh4Bjl29lIrk96Ar0Zuu6K/0TxNXMfW5OLXs7V0+CaRDzcwp9IkF6jqUj4oTQr8KiCWJzdTlRRKYLHMAePBANLMyWorZz9aq6gV3fSawkPz4Z7Wf4ouPnESF9x/SbBXp6a6noeefwZvF+BkPrBjdK7I+L9T3ogEIObZ2tiK8y84Y2fT/IHVDvwk9Dhhu7nb3yvM=";

            //Set Deployment Key for fully bindable chart, if you use it
            //Arction.Wpf.BindableCharting.LightningChartUltimate .SetDeploymentKey(deploymentKey);

            //Set Deployment Key for semi-bindable chart, if you use it
            // Arction.Wpf.SemibindableCharting.LightningChartUltimate .SetDeploymentKey(deploymentKey);

            //Set Deployment Key for non-bindable chart, if you use it
            Arction.Wpf.Charting.LightningChartUltimate.SetDeploymentKey(deploymentKey);



            //GlobalVars.UserID = 1;  // should get from login

            switch (GlobalVars.UserRole)
            {
            case GlobalVars.USER_ROLE_ENUM.ADMIN:
                break;

            case GlobalVars.USER_ROLE_ENUM.USER:
                UsersTab.Visibility       = Visibility.Collapsed;
                FiltersTab.Visibility     = Visibility.Collapsed;
                PlateTypesTab.Visibility  = Visibility.Collapsed;
                MaintenanceTab.Visibility = Visibility.Collapsed;
                break;

            case GlobalVars.USER_ROLE_ENUM.OPERATOR:
                MethodsTab.Visibility     = Visibility.Collapsed;
                ProjectsTab.Visibility    = Visibility.Collapsed;
                UsersTab.Visibility       = Visibility.Collapsed;
                FiltersTab.Visibility     = Visibility.Collapsed;
                PlateTypesTab.Visibility  = Visibility.Collapsed;
                MaintenanceTab.Visibility = Visibility.Collapsed;
                break;
            }



            m_imager      = null;
            m_vworks      = null;
            m_vworksReady = false;

            this.Title = "Waveguide     " + GlobalVars.UserDisplayName + "  (" + GlobalVars.UserRole.ToString() + ")";


            VM = new MainWindowViewModel();

            this.DataContext = VM;

            // catch close event caused by clicking X button
            this.Closing += new System.ComponentModel.CancelEventHandler(Window_Closing);

            m_uiTask          = TaskScheduler.FromCurrentSynchronizationContext();
            GlobalVars.UITask = m_uiTask;

            MyRunExperimentControl.PostMessage_RunExperimentPanelEvent += MyRunExperimentControl_PostMessage_RunExperimentPanelEvent;
            MyRunExperimentControl.BringToFrontRunExperimentPanelEvent += MyRunExperimentControl_BringToFrontRunExperimentPanelEvent;
        }