Esempio n. 1
0
 public void VWorks_PauseProtocol()
 {
     try
     {
         VWorks_.PauseProtocol();
         PostVWorksCommand(VWORKS_COMMAND.Protocol_Paused);
     }
     catch (Exception ex)
     {
         PostVWorksMessage("VWorks Error: " + ex.Message);
     }
 }
Esempio n. 2
0
        void VWorks__UserMessage(int session, string caption, string message, bool wantsData, out string userData)
        {
            // caption = vworks Title, message = vworks Body
            userData = "";


            // received command to pause Bravo's protocol for a given number of milliseconds
            // assumes that within the Bravo's UserMessage parameters are set to: Title = "Timer" and Body = <milliseconds>
            if (String.Compare(caption.Trim(), "Timer", true) == 0)
            {
                int timerDelay = Convert.ToInt32(message);

                VWorks_.PauseProtocol();
                PostVWorksCommand(VWORKS_COMMAND.Protocol_Paused, timerDelay);

                WaitResumeAsync(timerDelay);
            }

            else if (String.Compare(caption.Trim(), "TimeMarker", true) == 0)
            {
                // this starts the stopwatch timer that will be used by the ResumeAfter
                m_stopwatch.Restart();

                PostVWorksCommand(VWORKS_COMMAND.Set_Time_Marker);
            }

            else if (String.Compare(caption.Trim(), "PauseUntil", true) == 0)
            {
                // sends a Protocol Resume after given milliseconds after last TimeMarker
                int timerDelay = Convert.ToInt32(message);
                if (!m_stopwatch.IsRunning)
                {
                    PostVWorksCommand(VWORKS_COMMAND.Error, "Time Marker Never Set", "PauseUntil will be Ignored");
                }
                else if (m_stopwatch.ElapsedMilliseconds >= timerDelay)
                {
                    PostVWorksCommand(VWORKS_COMMAND.Error, "PauseUntil time too short", "Actual Pause time: " + m_stopwatch.ElapsedMilliseconds.ToString() + " msecs");
                }
                else
                {
                    VWorks_.PauseProtocol();
                    PostVWorksCommand(VWORKS_COMMAND.Pause_Until, timerDelay - (int)m_stopwatch.ElapsedMilliseconds,
                                      "Protocol Paused", "Waiting for " + timerDelay.ToString() + " msecs past last TimerMarker");
                    WaitResumeAsync(timerDelay - (int)m_stopwatch.ElapsedMilliseconds);
                }
            }

            else if (String.Compare(caption.Trim(), "EventMarker", true) == 0)
            {
                string[] parameter = message.Split(',');
                string   name      = parameter[0].Trim();
                string   desc      = parameter[1].Trim();
                PostVWorksCommand(VWORKS_COMMAND.Event_Marker, name, desc);
            }

            else if (String.Compare(caption.Trim(), "StartImaging", true) == 0)
            {
                PostVWorksCommand(VWORKS_COMMAND.Start_Imaging);
            }

            else if (String.Compare(caption.Trim(), "StopImaging", true) == 0)
            {
                PostVWorksCommand(VWORKS_COMMAND.Stop_Imaging);
            }

            else
            {
                PostVWorksCommand(VWORKS_COMMAND.Error, "Unknown Command Received", caption + ", " + message);
            }
        }