Beispiel #1
0
 private void PointingExperimenterWithDistraction(TrackingData t, Point s)
 {
     if (targets.CurrentScheduleTable() != null)
     {
         bool c = (bool)(targets.CurrentScheduleTable());        //only display a target for the experimenter when the element in schedule table is TRUE
         if (c && studyOnGoing && t.PositionZ > minZ && t.PositionZ < maxZ && targets.testTouch(s.X, s.Y))
         {
            FetchSchedule();
            Console.WriteLine("detected!");
         }
     }
 }
Beispiel #2
0
        private void UpdateRemote(TrackingData pakage)
        {
            Point screenCoordinate = MappingRemote(pakage.PositionX, pakage.PositionY);
            
#if !SERVER_SIDE            
            Action workAction = delegate
            {

                switch (configWindow.config.Vis)
                {
                    case ConfigStatus.VisSts.Dot:

                        ((DotVis)this.visualization).Move(screenCoordinate.X, screenCoordinate.Y);
                        this.visualization.Resize(-Math.Abs((double)pakage.PositionZ) * 2 / 250 + 2);
                        if (pakage.PositionZ > 0) ((DotVis)this.visualization).ToggleColor(true);
                        else ((DotVis)this.visualization).ToggleColor(false);
                        break;
                    case ConfigStatus.VisSts.Ripple:
                        ((RippleVis)this.visualization).Move(screenCoordinate.X, screenCoordinate.Y);
                        ((RippleVis)this.visualization).Resize(-Math.Abs((double)pakage.PositionZ) * 2 / 250 + 2);
                        if (pakage.PositionZ > 0) ((RippleVis)this.visualization).ToggleColor(true);
                        else ((RippleVis)this.visualization).ToggleColor(false);
                        break;
                    default:
                        break;
                }
            };
            this.Dispatcher.BeginInvoke(workAction, System.Windows.Threading.DispatcherPriority.Normal);
#else
            if (pakage.PositionZ < 30 && pakage.PositionZ > 0)
            {
                /*
                Console.WriteLine("Remote localLogged: {0} remoteLogged : {1}", lData.LocalLogged, lData.RemoteLogged);

                if (lData.LogRemoteOrNot())
                {
                    lData.remoteX = pakage.PositionX;
                    lData.remoteY = pakage.PositionY;
                    lData.remoteTouchTime = stopwatch.ElapsedMilliseconds;
                    Console.WriteLine("write remote!");
                    lData.RemoteLogged = true;
                }
                else
                    lData.RemoteLogged = false;
                 */
                if (lData.LocalReady)
                {
                    remoteBeingUpdated = true;
                }
            }
            if (remoteBeingUpdated)
            {
                if (lData.compareRemote(pakage.PositionZ))
                {
                    lData.remoteX = pakage.PositionX;
                    lData.remoteY = pakage.PositionY;
                    lData.remoteTouchTime = stopwatch.ElapsedMilliseconds;
                }
                if (lData.RemoteCount == 1)
                {
                    Console.WriteLine("remote 30 times!");
                    lData.RemoteLogged = true;
                    lData.RemoteCount = 0;
                    remoteBeingUpdated = false;
                }
            }

            if (lData.Completed())
            {
                logger.LogLine(lData.GetStrings());
                lData.EverythingNull();
                Console.WriteLine("log file");
            }
            
#endif
        }
Beispiel #3
0
        private void PointingExperimenter(TrackingData t, Point s)
        {
            /*
           Action positionAction = delegate
           {
               _position.Text = pakage.PositionZ.ToString();
           };
           this.Dispatcher.BeginInvoke(positionAction, System.Windows.Threading.DispatcherPriority.Normal);*/
            if (studyOnGoing && t.PositionZ > minZ && t.PositionZ < maxZ && targets.testTouch(s.X, s.Y)) // so that the pointer has touched the target
            {
                if (lData.LocalLogged && (!lData.RemoteLogged))
                {
                    lData.remoteX = 0;
                    lData.remoteY = 0;
                    lData.remoteTouchTime = 0;
                    logger.LogLine(lData.GetStrings());
                    Console.WriteLine("special logging, missing remote");
                    lData.EverythingNull();
                }
                bool end = targets.NextMarker();
#if SERVER_SIDE
                //send the message of updating distractor ("n") to the other side
                mcServer.Send(mcServer.serverStateObject.workSocket, "n");
#endif

                /*
                Console.WriteLine("local localLogged: {0} remoteLogged : {1}", lData.LocalLogged, lData.RemoteLogged);
                if (lData.LogLocalOrNot())
                {
                    lData.localX = pakage.PositionX;
                    lData.localY = pakage.PositionY;
                    lData.localTouchTime = stopwatch.ElapsedMilliseconds;
                    targets.CurrentTargetGrid(ref lData.targetGridX, ref lData.targetGridY);
                    lData.LocalLogged = true;
                    Console.WriteLine("log local!");
                }
                else { Console.WriteLine("cannot log local!"); }
                 */
                localBeingUpdated = true;
                if (end)
                {
                    OneRoundEnd();
                }
                else
                {
                    Action workAction = delegate
                    {
                        targets.MoveMarker();
                    };
                    this.Dispatcher.BeginInvoke(workAction, System.Windows.Threading.DispatcherPriority.Normal);
                }
            }
            if (localBeingUpdated)
            {
                lData.LocalReady = true;
                if (lData.compareLocal(t.PositionZ))
                {
                    lData.localX = t.PositionX;
                    lData.localY = t.PositionY;
                    lData.localTouchTime = stopwatch.ElapsedMilliseconds;
                    targets.CurrentTargetGrid(ref lData.targetGridX, ref lData.targetGridY);
                }
                if (lData.LocalCount == 1)
                {
                    Console.WriteLine("local 30 times! Stop tracking local!");
                    localBeingUpdated = false;
                    lData.LocalLogged = true;
                    lData.LocalCount = 0;
                }
            }
        }
Beispiel #4
0
        private void UpdateLocal(TrackingData pakage)
        {
           
            Point screenCoordinate = MappingLocal(pakage.PositionX, pakage.PositionY);
            Action displayAction = delegate
            {
                _position.Text = screenCoordinate.X.ToString() + "," + screenCoordinate.Y.ToString();
                //_position.Text = pakage.PositionZ.ToString();
            };
            this.Dispatcher.Invoke(displayAction, System.Windows.Threading.DispatcherPriority.Normal);
#if SERVER_SIDE
            PointingExperimenterWithDistraction(pakage, screenCoordinate);
#endif
        }